The liquidateBorrower function in the StabilityPool contract incorrectly scales user debt by multiplying it twice with the usage index, leading to inflated liquidation amounts.
The bug occurs in two steps:
First multiplication in LendingPool.getUserDebt():
Second incorrect multiplication in StabilityPool.liquidateBorrower():
The contract checks if (crvUSDBalance < scaledUserDebt) revert InsufficientBalance();, but since scaledUserDebt is overestimated due to double multiplication, the required balance is higher than it should be.
This unnecessarily revert valid liquidations, preventing liquidation when it should be allowed.
At first the gap between the correct debt and inflated bebt is small, but as time goes by and usageIndex increment, the gap will grow larger and it will affect all liquidations.
The function emits emit BorrowerLiquidated(userAddress, scaledUserDebt);, but since scaledUserDebt is inflated, external systems relying on this event will receive incorrect debt values.
This will affect off-chain analytics, monitoring services, or automated scripts that depend on accurate liquidation reporting.
For example, liquidators may miscalculate profits or losses, and historical liquidation data may become unreliable.
Manual Review
Remove the second multiplication in liquidateBorrower.
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.