A critical issue was found in the liquidateBorrower
function in StabilityPool.sol
. The function calculates scaledUserDebt
using:
However, userDebt
is already multiplied by reserve.usageIndex
, so applying getNormalizedDebt()
again results in double application of usageIndex
. This causes incorrect debt calculations during liquidation.
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/pools/StabilityPool/StabilityPool.sol#L449
The function retrieves userDebt
, which is already scaled by usageIndex
.
It then multiplies userDebt
again by lendingPool.getNormalizedDebt()
, which is actually the same usageIndex
.
This results in an inflated value for scaledUserDebt
, leading to overestimation of the borrower’s debt.
Borrowers could be liquidated unfairly due to their debt appearing higher than it actually is.
Borrowers could lose their collateral unfairly due to overestimating the required liquidation repayment.
Manual code review
It should be:
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.