The LendingPool contract has a vulnerability in its liquidation process where users who have repaid their debt can still be liquidated if they don't explicitly call closeLiquidation. Additionally, liquidators have an incentive to wait until after the grace period to call finalizeLiquidation as they will pay less for the liquidation.
LendingPool.sol#L468 - closeLiquidation function
LendingPool.sol#L496 - finalizeLiquidation function
The vulnerability stems from three key issues:
The liquidation state (isUnderLiquidation) is not automatically cleared when a user repays their debt
Users must manually call closeLiquidation even after full repayment
The grace period check in finalizeLiquidation allows liquidators to wait for better terms
Scenario 1 - User Repays But Forgets to Close Liquidation:
User's position becomes liquidatable
User repays their debt through the repay function
User doesn't call closeLiquidation
Liquidator can still call finalizeLiquidation after grace period
User loses their NFTs despite having repaid the debt
Scenario 2 - Liquidator Waits for Grace Period :
User's position becomes liquidatable
Liquidator waits until after grace period
Calls finalizeLiquidation
Gets NFTs at a potentially lower price due to market conditions
Original user suffers greater losses
Users can lose collateral even after debt repayment
Liquidators can game the system by waiting for grace period expiration
Creates unfair advantages for liquidators
Users may lose more value than necessary in liquidations
Manual code review
Automatically clear liquidation state on full repayment:
Consider removing the manual closeLiquidation requirement and make it automatic based on debt status.
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.