The liquidateAccounts function in LiquidationBranch.sol processes liquidations in a single loop over an unbounded array of account IDs. During extreme market conditions (e.g a crash), liquidating hundreds of accounts in one transaction risks exceed the blockchain’s gas limit, causing the transaction to revert. This leaves undercollateralized positions open, threatening the protocol solvency
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/perpetuals/branches/LiquidationBranch.sol#L115
Exploit Scenario:
A sudden market crash causes 500 accounts to become undercollateralized.
The System Keeper calls liquidateAccounts with all 500 account IDs.
Transaction Execution for example:
Gas Limit Exceeded:
Each liquidation consumes ~70,000 gas for (account checks, position updates, events).
Then the total gas required: 500 * 70,000 = 35,000,000.
The Arbitrum’s block gas limit: ~30,000,000.
Result: Transaction reverts after processing 428 accounts and 72 accounts remain open, accumulating bad debt so the Protocol faces insolvency if collateral value continues to drop.
Protocol Insolvency as undercollateralized positions remain open, leading to unrecoverable debt.
Manual review
Process accounts in smaller batches to stay within gas limits.
For example:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.