Skip to content
Business logic Audit finding Intermediate

Party B liquidation can expire, causing the liquidation to be stuck

The liquidation of Party B can become permanently stuck if the liquidation timeout is reached before the positions are liquidated, because the required price signature must be created within that timeout period. An attacker could exploit this by delaying liquidation until the timeout expires, causing the liquidation status to remain true and blocking further liquidations.

Ch_301 Follow with Kose, Yuki and 11 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-06-symmetrical-judging/issues/293

Found by

Ch_301, Kose, Yuki, berndartmueller, bin2chen, cergyk, josephdara, libratus, panprog, shaka, simon135, sinarette, volodya, xiaoming90

Summary

The liquidation of Party B can get stuck if the liquidation timeout is reached and the positions are not liquidated within the timeout period.

Vulnerability Detail

The insolvent Party B's positions are liquidated by the liquidator via the liquidatePositionsPartyB function in the LiquidationFacetImpl library. This function requires supplying the QuotePriceSig memory priceSig parameter, which includes a timestamp and a signature from the Muon app. The signature is verified to ensure the priceSig values were actually fetched by the trusted Muon app.

The signature is expected to be created within the liquidation timeout period. This is verified through the validation of the priceSig.timestamp, as seen in lines 318-322. Failure to do so, i.e., providing a signature that's created beyond the liquidation timeout, results in the signature being treated as expired, thereby causing the function to revert and rendering the liquidation of Party B stuck.

Impact

Party A's locked balance is not decremented by the liquidatable position. Party B's liquidations status is stuck and remains set to true, resulting in the notLiquidated and notLiquidatedPartyB modifiers to revert.

Code Snippet

contracts/facets/liquidation/LiquidationFacetImpl.sol#L318-L322

Solidity
308: function liquidatePositionsPartyB(
309:     address partyB,
310:     address partyA,
311:     QuotePriceSig memory priceSig
312: ) internal {
313:     AccountStorage.Layout storage accountLayout = AccountStorage.layout();
314:     MAStorage.Layout storage maLayout = MAStorage.layout();
315:     QuoteStorage.Layout storage quoteLayout = QuoteStorage.layout();
316:
317:     LibMuon.verifyQuotePrices(priceSig);
318: @>  require(
319: @>      priceSig.timestamp <=
320: @>          maLayout.partyBLiquidationTimestamp[partyB][partyA] + maLayout.liquidationTimeout,
321: @>      "LiquidationFacet: Expired signature"
322: @>  );
323:     require(
324:         maLayout.partyBLiquidationStatus[partyB][partyA],
325:         "LiquidationFacet: PartyB is solvent"
326:     );
327:     require(
328:         block.timestamp <= priceSig.timestamp + maLayout.liquidationTimeout,
329:         "LiquidationFacet: Expired price sig"
330:     );

Tool used

Manual Review

Recommendation

Consider adding functionality to reset the liquidation status (i.e., maLayout.partyBLiquidationStatus[partyB][partyA] = false and maLayout.partyBLiquidationTimestamp[partyB][partyA] = 0) of Party B once the liquidation timeout is reached.

Discussion

MoonKnightDev

Fixed code PR link: https://github.com/SYMM-IO/symmio-core/pull/9

The original report as published on Sherlock, by Ch_301. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the contract requires the price signature timestamp to be within the liquidation timeout period, but provides no way to reset the liquidation status once that timeout has passed, leaving the status permanently stuck.

Impact

Party B's liquidation status remains stuck as true, causing the notLiquidated and notLiquidatedPartyB modifiers to revert and preventing any further liquidation of that position.

What the attacker needed

Party B becomes insolvent; Liquidation timeout is reached before liquidation

The fix

The code was fixed by adding functionality to reset the liquidation status and timestamp once the liquidation timeout is reached.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this system, when a trader (Party B) becomes insolvent, a liquidator must step in to close their positions. The liquidator needs a signed price from a trusted app, and that signature must be created within a certain time window. If that window passes before the liquidation happens, the system gets stuck and no one can liquidate that trader anymore.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Ch_301

View all

39 more disclosed reports, best first.

More from Symmetrical Update

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.