The _repay() incorrectly compares repayment amounts against userScaledDebt(scaled debt) instead of userDebt (actual accrued debt), leading to under-repayments that leave residual debt which can leads to bad loans
userScaledDebt
represents the debt principal without interest
userDebt
(actual debt) = userScaledDebt * usageIndex
(principal + interest)
Current logic caps repayments at principal amount, ignoring accrued interest
Attack Scenario:
Alice borrows 100 DAI when usageIndex = 1.0
scaledDebt = 100 DAI
Interest accrues → usageIndex = 1.1
actualDebt = 100 * 1.1 = 110 DAI
Alice repays 105 DAI:
Current Logic: Caps at 100 DAI (scaled) → Leaves 5 DAI unpaid
Proper Logic: Should cap at 110 DAI (actual) → Full repayment
Users can't fully repay debts which can force the protocol underwater
Manual review
Compare against actual debt instead of scaled debt
That amount is not actually used.
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.