A critical vulnerability in PerpetualVault allows users with underwater positions to evade liquidation by front-running liquidation transactions with actions that manipulate the contract's flow state.
This vulnerability allows users to avoid legitimate liquidations, putting the protocol's solvency at risk.
The PerpetualVault contract uses a flow state mechanism (FLOW enum) to control operation sequences. Liquidations can only be executed when the flow state is appropriate. The attack exploits three key factors:
Flow state transitions are not protected against front-running
Liquidations are handled differently depending on the current flow state
Users can observe pending liquidation transactions in the mempool
The issue exists in the afterLiquidationExecution() function:
The behavior of this function depends on the flow state at the time it's called, and an attacker can manipulate this state by front-running the liquidation transaction with an action like a withdrawal.
The following PoC demonstrates the attack:
This vulnerability has several severe impacts:
Protocol Insolvency Risk: Positions that should be liquidated remain active.
Undermining Risk Management: The system is unable to enforce its safety measures.
Market Manipulation: Users can strategically avoid liquidation.
Atomic Liquidation Process: Use a mutex to prevent interference from other transactions.
Transaction Ordering Protection: Use mechanisms like Chainlink Keepers.
Explicit Revert: Replace silent failures with explicit reverts:
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
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.