The calculateRaacRewards
function in the StabilityPool
contract is vulnerable to front-running attacks and reward manipulation. A malicious user can strategically deposit funds right before reward distribution to receive an unfairly high share of the rewards. This issue results in an uneven distribution of rewards and significantly reduces incentives for honest participants.
The rewards are distributed based on the user's deposit ratio at the time of calculation, without considering when the deposit was made. This allows a last-minute depositor to manipulate the reward distribution.
Victim deposits early with 100 tokens.
Owner funds rewards pool with 500 tokens.
Attacker front-runs and deposits 900 tokens right before rewards are calculated.
Reward distribution occurs, and the attacker receives 90% of the rewards while the victim gets only 10%, despite the victim staking for a longer period.
The impacts of this vulnerability are already outlined in the Impact section of the report. However, I can expand on them further:
Economic Exploitation
Attackers can extract disproportionate rewards by depositing large amounts at the last moment.
The protocol's reward distribution becomes skewed, making the system unfair.
Loss of User Trust
Honest stakers who deposit early receive fewer rewards, discouraging participation.
Users may abandon the protocol if they realize the system is easily exploitable.
Depletion of Reward Pool
Repeated execution of the exploit can drain the reward pool prematurely.
Honest users may never receive their fair share of rewards.
Market Manipulation Risks
Attackers can coordinate deposits to manipulate reward distribution.
May encourage MEV (Miner Extractable Value) attacks where validators prioritize their own transactions to maximize gains.
Adjust the reward formula to factor in how long a user has staked:
Take a snapshot of deposits before rewards are added, ensuring only existing deposits get rewarded.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.