The DebtToken contract burns the nominal amount instead of the scaled amount, creating a mismatch between the LendingPool's debt tracking and the actual DebtToken balances.
The RAAC protocol's DebtToken contract contains a critical bug in the burn function, which leads to a discrepancy in debt balance tracking. This bug affects the protocol's accounting system, causing inconsistencies between the LendingPool and DebtToken contracts. The issue arises due to incorrect scaling of the repayment amount, leading to mismatched debt records
The LendingPool reduces the user's debt by the scaled amount (amountScaled), while the DebtToken burns the full repayment amount (amount). This creates a discrepancy between the two systems
Repayment Fails Due to Insufficient Debt Balance
When a user attempts to repay their debt, the LendingPool checks the user's debt balance to ensure the repayment amount does not exceed the outstanding debt. However, because the DebtToken contract has already burned more than it should have (due to the bug), the user's debt balance in the DebtToken contract will be lower than expected
PROOF OF CONCEPT
Initial Borrow:
User borrows 1000 USDC
Initial index = 1.0 RAY (1e27)
Initial scaled debt = 1000
After Interest Accrual:
Index rises to 1.2 RAY
Actual debt = 1000 * 1.2 = 1200 USDC
Partial Repayment Attempt:
User attempts to repay 600 USDC
LendingPool calculation
scaledRepay = 600 / 1.2 = 500
remainingScaledDebt = 1000 - 500 = 500
debttokenbalance tracking
burnAmount = 600 // Burns nominal amount
remainingScaledDebt = 1000 - 600 = 400
due to two different balance tracking when users will try to repay their borrow fully this check will block repayment
this check will block reayment because the userbalance which is debttokens balance tracking will have a lower balance due to the incorrect burn logic
incorrect balance tracking
Users may be unable to fully repay their loans due to the accounting mismatch,
correct the balance tracking logic
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
Interest IS applied through the balanceOf() mechanism. The separate balanceIncrease calculation is redundant/wrong. Users pay full debt including interest via userBalance capping.
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.