This vulnerability in the Stability Pool allows users to drain RAAC rewards by repeatedly depositing and withdrawing RTokens. Since the contract does not track already claimed rewards, users can withdraw rewards multiple times by performing cyclic deposits and withdrawals, eventually draining the entire RAAC token balance.
Iam explaining the flow of complete exploit.
1.User Deposits RToken
The user calls the StabilityPool::deposit
function, transferring amount of RToken
to the contract.
The contract mints an equivalent amount of deCRVUSD tokens based on the exchange rate.
The deposited amount is recorded in userDeposits[msg.sender]
.
StabilityPool::_mintRAACRewards()
is called, which mints new RAAC rewards and sends to Stability Pool Contract.
StabilityPool::deposit
:
StabilityPool::_mintRAACRewards
:
2.Rewards Accumulate Over Time
As time passes, the protocol accumulates RAAC rewards inside the contract.
These rewards are meant to be distributed among users proportionally based on their deposits.
3.User Withdraws Deposited RToken and Claims Rewards
The user calls the withdraw function to withdraw their deposit.
The contract calculates the amount of RToken to be returned using calculateRcrvUSDAmount()
.
The contract also calculates RAAC rewards using calculateRaacRewards()
which follows the formula: (totalRewards * userDeposit) / totalDeposits
StabilityPool::withdraw
:
StabilityPool::calculateRaacRewards
:
4.User Repeats the Process to Drain RAAC Rewards
The user immediately redeposits the same amount of RToken.
Since calculateRaacRewards()
does not track previously distributed rewards, the user can withdraw again and receive additional RAAC rewards.
By continuously repeating this deposit-withdraw cycle, the user can drain all RAAC rewards from the contract.
5.Consider two users who each deposit 20 RToken, making the total deposits 40. Over time, the contract accumulates 30 RAAC tokens as rewards. When the first user withdraws, they receive 15 RAAC (since they had 50% of the total deposits). If they redeposit and withdraw again, the remaining 15 RAAC is now split, so they get 7.5 more. By repeating this process, they can keep reducing the available rewards while continuously claiming a portion, eventually draining the entire RAAC balance from the contract.
Full depletion of RAAC rewards: Malicious users can drain all rewards, leaving legitimate users with nothing.
Unfair distribution of rewards: Users who execute this attack early can extract all rewards unfairly.
Severe financial loss: The Stability Pool may lose all incentive mechanisms, damaging user trust.
Manual
Track Already Claimed Rewards and also keep time lock sort of mechanism.
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.