StabilityPool::liquidateBorrower miscalculates user debt
In contracts/core/pools/StabilityPool/StabilityPool.sol
the liquidateBorrower function retrieves the user’s debt from the LendingPool contract and then applies a ray‑multiplication:
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/StabilityPool/StabilityPool.sol#L449-L470
However, in LendingPool.sol, the getUserDebt function already computes the debt using rayMul:
https://github.com/Cyfrin/2025-02-raac/blob/main/contracts/core/pools/LendingPool/LendingPool.sol#L579-L582
Since userDebt is already the result of user.scaledDebtBalance.rayMul(reserve.usageIndex), applying another ray-multiplication in liquidateBorrower leads to the following incorrect computation:
The incorrect scaling of debt can result in overestimation of the user’s debt during liquidation. This may lead to Excessive crvUSD balance requirements for the StabilityPool to process liquidations.
N/A
Remove the extra rayMul operation in liquidateBorrower. Instead, the function should use the debt value returned by getUserDebt as is, without further modifications:
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.