The StabilityPool's reward calculation mechanism contains a critical flaw where users can claim their entire accumulated RAAC rewards while only withdrawing a minimal amount of their deposited funds. This allows malicious actors to drain rewards disproportionately without significantly reducing their deposited capital.
In the withdraw function computes RAAC rewards by calling calculateRaacRewards(msg.sender).
The calculateRaacRewards functoin computes RAAC rewards based on the entire deposit balance of the user (i.e., userDeposits[user]) rather than proportionally to the withdrawn amount. This allows an attacker to repeatedly withdraw minimal amounts while claiming rewards proportional to their entire remaining deposit, leading to potential drainage of the RAAC token Rewards.
RAAC Token Balance: 100e18
Attacker deposits 1000e18 rToken, receives 1000e18 deToken.
Total deToken Supply: 10,000e18
Attack Steps:
First Withdrawal:
Withdraw 1 wei rToken.
Rewards Calculated: (100e18 RAAC * 1000e18 userDeposit) / 10000e18 totalDeposits = 10e18 RAAC.
Attacker receives 10e18 RAAC.
User deposit reduced to 999.999...e18 rToken.
Second Withdrawal :
Withdraw 1 wei rToken again.
Rewards Calculated: (90e18 RAAC * 999999999999999999999 userDeposit) / 9999999999999999999999 totalDeposits = 8.999999999999999999e18 RAAC.
Attacker claims another 8.9e18 RAAC.
Result: By repeating this process, the attacker drains the RAAC Rewards token despite minimal actual withdrawals.
Malicious users can drain the entire raacToken totalRewards with repeating minimal withdrawal (e.g., 1 wei)
Manual Review
Implement a reward tracking system (e.g., using snapshots or accrued balances) to calculate rewards based on the time-weighted deposit amount.
or
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.