DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: high
Invalid

Delayed liquidations may result in abuse by traders

https://github.com/Cyfrin/2024-07-zaros/blob/main/src/external/chainlink/keepers/liquidation/LiquidationKeeper.sol#L61-L65

Summary

Within the LiquidationKeeper.sol contract, the checkUpkeep function can return upkeepNeeded as false if there aren't a certain number of liquidatable accounts. This can lead to a scenario where a user can fill a market order while liquidations pile up, resulting in market manipulation and significant financial losses.

Description

The checkUpkeep function in the LiquidationKeeper.sol contract checks if there are liquidatable accounts within a specified range. If the number of liquidatable accounts does not exceed a certain threshold, upkeepNeeded is set to false, and the function returns without triggering any liquidations. This predictability allows an attacker to fill a market order just before the liquidations are triggered, securing a favorable market position and profiting from the subsequent liquidation events.

Impact

This vulnerability can be exploited by advanced traders who can predict when liquidations will be delayed due to the insufficient number of liquidatable accounts, allowing them to manipulate the market:

  1. Arbitrage Opportunities: Attackers can exploit the predictable delay in liquidations to place market orders at favorable prices, leading to arbitrage opportunities that can drain liquidity and destabilize the market.

  2. Market Manipulation: Malicious traders can front-run the liquidation process by placing orders before liquidations are executed, benefiting from the expected market movements caused by liquidations.

  3. Increased Volatility: Predictable delays in liquidation can lead to artificial price swings, causing increased volatility and potential long-term market imbalance.

  4. Loss of Market Integrity: The ability to predict and exploit the timing of liquidations can erode trust in the market, leading to decreased participation and liquidity.

Proof of Concept

  1. Monitor Liquidatable Accounts: An attacker identifies accounts that are close to liquidation and monitors the checkUpkeep function's behavior.

  2. Place Market Order: The attacker places a market order when they predict that liquidations will not be triggered immediately.

  3. Profit from Liquidation: The attacker benefits from the price movement caused by the subsequent liquidation events.

Financial Impact Analysis

To illustrate the potential financial impact, consider the following hypothetical scenario:

  • A large number of accounts are close to liquidation, but the number does not exceed the threshold required to trigger upkeepNeeded.

  • The attacker places a market sell order just before the expected liquidations, securing a higher price.

  • After the liquidation eventually occurs, the attacker buys back the asset at a lower price, profiting from the price difference.

If the market capitalization is large, even a small percentage movement due to liquidation manipulation can lead to substantial financial gains for the attacker. For example, if the market has a total value of $500 million and the manipulation causes a 2% price change, the financial impact could be $10 million.

Tools Used

Manual Review

Recommended Mitigation Steps

Handle liquidations as they come instead of waiting for batch processing.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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