sherlock-audit / 2023-06-symmetrical-judging

5 stars 4 forks source link

simon135 - If liquiation is not called in few blocks/timestmaps PartyB other positions can't be liquidated and funds will stuck in ` liquidatePositionsPartyB` #342

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

simon135

high

If liquiation is not called in few blocks/timestmaps PartyB other positions can't be liquidated and funds will stuck in liquidatePositionsPartyB

Summary

because something of the chain can go down/ or just bad incentives it can cause timestamp to go below what the liquidation check needs as shown below

Vulnerability Detail

If liquidation for PartyB is not called in few changes of block.timestamp for monetary reasons of the chain is down/ no incentives PartyB won't be able to get out of the liquidation state and that Opened Position won't be able to be liquidated steps: PartyB gets liquidated The liquidator makes a call to liquidate 10/20 positions 3 blocks later Liquidator calls the function and it reverts since partyBLiquidationTimestamp+ timeout so ex : block.timestamp is at 5 and timstamp at first check is 8 and timestamp happens something happens and priceSig.timestmap + timeout >= block.timstamp ex: 9 in the first check which would make the call revert since block.timestamp is already at 10

Impact

PartyA/PartyB won't be able to use the protocol and funds will be stuck in limbo which if you have huge PartyB and some external chain issue happens or if its just luck then Funds will be stuck and dos for the Partys Which should not happen

Code Snippet

        require(
            priceSig.timestamp <=
                maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout, // @audit H-25
            "LiquidationFacet: Expired signature"
        );
        require(
            maLayout.partyBLiquidationStatus[partyB][partyA],
            "LiquidationFacet: PartyB is solvent"
        );
        require(
            block.timestamp <= priceSig.timestamp + maLayout.liquidationTimeout, // @audit M-03
            "LiquidationFacet: Expired pric sig"
        );

https://github.com/sherlock-audit/2023-06-symmetrical/blob/6d2b64b6732fcfbd07c8217897dd233dbb6cd1f5/symmio-core/contracts/facets/liquidation/LiquidationFacetImpl.sol#L318

Tool used

Manual Review

Recommendation

Add another function for dealing with that edge case or let admin come in and do something like remove that check a better way would to allow PartyB to get liquidted again and not allow the nonLiquidated check on the first PartyB liquidation function

Duplicate of #293