In StabilityPool's liquidateBorrower() function, user debt is scaled twice with interest, causing users to be liquidated for higher amounts than they actually owe.
The liquidateBorrower() function incorrectly scales the user's debt twice:
The user's debt is already scaled with interest in getUserDebt():
The additional rayMul with getNormalizedDebt() in liquidateBorrower() scales this already-scaled debt again, effectively squaring the interest rate.
Users being liquidated will have to pay significantly more than their actual debt
Liquidators will overpay for liquidations
Protocol will incorrectly collect excess debt payments
Financial loss for users and liquidators
Example:
User actual debt with interest: 1000 crvUSD
Interest rate (usageIndex): 1.1
Double scaled debt: 1000 * 1.1 * 1.1 = 1210 crvUSD
Results in 210 crvUSD excess payment vs 100 correct interest
Manual Review
Remove the additional scaling 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.