Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 2.53 KB

020.md

File metadata and controls

62 lines (46 loc) · 2.53 KB

Bent Cyan Orca

Medium

Uneconomical Small Position Liquidation Trap

Summary

Positions with small values ​​(below the threshold) may be trapped in an unliquidable state due to gas costs being higher than the liquidator's potential profit, even though the position is below the permitted health factor.

Root Cause

In Aave-v3.3-features.md it says that:

Liquidation is still heavily influenced by gas prices, liquidation bonuses, and secondary market liquidity.

On LiquidationLogic.

uint256 public constant MIN_BASE_MAX_CLOSE_FACTOR_THRESHOLD = 2000e8;

If the gas fee is higher than the liquidation bonus, the liquidator will have no economic incentive to liquidate. As mentioned in Aave-v3.3-features.md:

A threshold of $2000 for example means that, with a 1% bonus, a liquidation should not cost more than $20 before it can no longer be liquidated by an economically sound liquidator.

In LiquidationLogic the close factor logic limits liquidations:

if (
    vars.userReserveCollateralInBaseCurrency >= MIN_BASE_MAX_CLOSE_FACTOR_THRESHOLD &&
    vars.userReserveDebtInBaseCurrency >= MIN_BASE_MAX_CLOSE_FACTOR_THRESHOLD &&
    vars.healthFactor > CLOSE_FACTOR_HF_THRESHOLD
) {
    uint256 totalDefaultLiquidatableDebtInBaseCurrency = vars.totalDebtInBaseCurrency.percentMul(
        DEFAULT_LIQUIDATION_CLOSE_FACTOR  // 50%
    );

And the liquidation bonus calculation does not take into account gas costs:

vars.bonusCollateral = vars.collateralAmount - 
    vars.collateralAmount.percentDiv(liquidationBonus);

vars.liquidationProtocolFeeAmount = vars.bonusCollateral.percentMul(
    vars.liquidationProtocolFeePercentage
);

Attack Path

https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/LiquidationLogic.sol#L75 https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/LiquidationLogic.sol#L283-L290 https://github.com/sherlock-audit/2025-01-aave-v3-3/blob/main/aave-v3-origin/src/contracts/protocol/libraries/logic/LiquidationLogic.sol#L664-L670

Impact

Unhealthy positions remain in the system

PoC

  1. User has a position worth $3000
  2. After the first liquidation (50%), the remaining position is worth $1500
  3. The position is below the MIN_BASE_MAX_CLOSE_FACTOR_THRESHOLD ($2000)
  4. With a 1% liquidation bonus, the liquidator only gets $15
  5. If gas fee > $15, no liquidator will execute a liquidation
  6. The position remains unhealthy but cannot be liquidated