15,000 USDC
View results
Submission Details
Severity: high
Valid

Liquidations do not work when collateralization ratio is below liquidation premium.

Summary

Liquidations do not work when collateralization ratio is below liquidation premium.

Vulnerability Details

The liquidate method in DSCEngine implements the liquidation logic, where the liquidator gets a 10% bonus in received collateral as incentive. This method stops working when the collateralization ratio is above 1, i.e., there are still more dollars available in collateral than debt, but below the liquidation premium, i.e., 1.1.

For example, say a user has $105 in collateral and $100 debt. Even though this position is both far below the minimum health factor, and there is still an incentive for liquidation, it cannot be liquidated:

  • If the liquidator would pay back the full debt of $100, the totalCollateralToRedeem including the 10% bonus would be calculated as $110, which causes the next line, with the call to _redeemCollateral, to revert, since this exceeds the available collateral.

  • If the liquidator would pay back the maximum amount to avoid _redeemCollateral reverting, i.e., $95.4545... since $95.4545... * 1.1 = 105, that would leave debt with no collateral, causing the health factor to decrease, and the method thus also to revert. Paying back lower amounts than that results in the same issue.

Impact

There is no way to liquidate this position, even though there is an incentive. When the price falls further, this could cause the system to become undercollateralized.

Tools Used

None

Recommendations

Adapt the liquidation bonus when the collateralization ratio falls below the default value but is still above 1. In summary, take the minimum of both:

require(collateral >= debt, "Bad debt")
liquidationBonus = min(defaultLiquidationBonus, collateral / debt)

In the above scenario, this would set it to 5%, which would allow the $100 debt to be paid back in full.

Support

FAQs

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