DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Valid

`LiquidationBranch.liquidateAccounts` should cancel off-chain orders of the liquidated account.

Summary

LiquidationBranch.liquidateAccounts should cancel all off-chain orders of the liquidated account.

Vulnerability Details

LiquidationBranch.liquidateAccounts clears a pending market order, but does not update the nonce to cancel off-chain orders.

Impact

An off-chain order may be executed after the account is liquidated if the user deposits more funds to the account.
Users should call OrderBranch.cancelAllOffchainOrders manually.

Tools Used

Manual.

Recommendations

Update as below.

// clear pending order for account being liquidated
MarketOrder.load(ctx.tradingAccountId).clear();
// @audit Update the nonce to cancel off-chain orders.
+ unchecked {
+ tradingAccount.nonce++;
+ }

https://github.com/Cyfrin/2024-07-zaros/blob/7439d79e627286ade431d4ea02805715e46ccf42/src/perpetuals/branches/LiquidationBranch.sol#L163-L164

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`LiquidationBranch.liquidateAccounts` should cancel off-chain orders of the liquidated account.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.