Summary
The RAAC lending protocol’s RToken contract mishandles scaled vs. unscaled amounts when minting and burning tokens. Instead of minting the scaled amount (principal adjusted for the current liquidityIndex), it mints the full unscaled deposit. Likewise, during burn(), it transfers the unscaled amount instead of the interest-accrued sum. As a result, depositors fail to earn interest properly, negating the core function of the lending protocol.
Vulnerability Details
1. Correct Interest Accrual Model
Deposits:
Convert the user’s deposit to a “scaled amount” by dividing by liquidityIndex.
Mint that scaled amount of RTokens.
Withdrawals:
Convert the user’s scaled RToken balance back into an underlying amount by multiplying by liquidityIndex—reflecting principal + accrued interest.
Simple Example
User deposits 100 tokens at liquidityIndex = 1.1.
Should receive 100 / 1.1 ≈ 90.9 RTokens.
Later, if liquidityIndex grows to 1.2, the user’s 90.9 RTokens should yield 90.9 * 1.2 = 109 tokens on withdrawal (9 tokens of interest).
2. Actual Broken Implementation
RToken::mint (unscaled mint)
The user is minted 100 RTokens instead of 90.9.
RToken::burn (unscaled transfer)
The user withdraws only 100 tokens when they should have received ~109.
Impact
Loss of Interest: Depositors never see the accrued amount reflected in withdrawals.
Overminting: The user initially receives too many RTokens, but it doesn’t help them in the end, since withdrawal also ignores interest.
3. Similar Issue in DebtToken::burn
In DebtToken::burn, the contract also calls _burn(from, amount.toUint128()) instead of using the scaled amount. Although this primarily affects borrowers rather than lenders, it is the same scaled/unscaled bug that disrupts consistent accounting across the protocol.
Impact
Interest Accrual is Broken: Lenders fail to collect interest, undermining the protocol’s primary incentive to deposit.
Recommendations
Use Scaled Amounts in RToken::mint:
Use Scaled Amounts in RToken::burn:
Address DebtToken::burn Similarly:
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.