The RToken contract's mint function incorrectly handles token scaling, creating a mismatch between minted tokens and underlying assets. When users deposit assets, the contract should mint scaled tokens representing their share of the pool, but instead mints raw amounts, breaking the fundamental interest-bearing mechanics.
The issue is in the _mint
call where it uses amountToMint
instead of amountScaled
. This creates a mismatch between the token supply and the underlying asset pool's value.
The heart of this issue lies in how RToken handles interest-bearing deposits. Imagine a savings account where the bank accidentally gives you the wrong number of shares in the pool, that's exactly what's happening here.
When users deposit assets into the lending pool, the RToken contract should mint them a proportional amount of shares based on the current interest rate index. If the pool has been accruing interest and the index is 1.5, a deposit of 100 tokens should result in roughly 67 shares (100/1.5). However, the contract is minting shares 1:1 with deposits, completely ignoring the index.
Let's walk through a real scenario:
The lending pool has been running for a while, accumulating an index of 1.5
Alice deposits 1000 USDC
Instead of receiving ~667 RTokens (1000/1.5), she gets 1000 RTokens
When she withdraws, she can claim 1500 USDC (1000 * 1.5), stealing 500 USDC from other depositors
The core of the problem is in this seemingly innocent line: RToken.sol#L136
This is equivalent to a bank crediting your account with $150 when you deposit $100 just because other depositors have earned interest.
Users depositing assets receive more tokens than they should, diluting existing holders' shares. For example, if the current index is 1.5 (indicating 50% interest accrual), a deposit of 100 tokens should mint ~67 scaled tokens, but the contract mints 100, giving the user excessive ownership rights.
The contract fails to maintain the core invariant that scaled token supply must always equal total deposits divided by the current index. This relationship ensures fair distribution of interest among holders.
The fix is straightforward, mint the scaled amount instead
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.