The liquidateBorrower function in StabilityPool retrieves user debt without first updating the lending pool's index, leading to incorrect debt calculations during liquidations.
In StabilityPool.sol, liquidateBorrower() gets user debt from LendingPool:
The issue is that both getUserDebt() and getNormalizedDebt() rely on the usage index which needs to be updated first via updateReserveState(). Without this update, the debt calculation uses stale indices.
In LendingPool.sol, we can see that getUserDebt() uses the potentially stale index:
Incorrect debt calculations during liquidations
Users may be liquidated for the wrong amounts
Protocol may suffer losses due to under-liquidation
Users may suffer losses due to over-liquidation
Manual review
Add index update before debt calculations:
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.