The calculateRaacRewards function in the stabilitypool.sol smart contract is vulnerable to a reward exploitation attack. An attacker can deposit tokens and immediately withdraw them to claim rewards without staking for any meaningful duration. This is due to the lack of a time-based mechanism in the reward calculation.
Location: StabilityPool.sol calculateRaacRewards function.
Issue: The function calculates rewards based solely on the amount deposited and total deposits, without considering the duration of the deposit.
Exploit:
An attacker deposits a large amount of tokens.
Immediately calls the withdraw function.
Claims rewards proportional to their deposit, even though the tokens were staked for an extremely short duration.
Root Cause: The absence of a time-weighted or lock-up mechanism allows attackers to game the reward system.
High Severity: This vulnerability allows attackers to drain the reward pool without providing any real value (staking) to the system.
Financial Loss: Legitimate users may receive fewer rewards as attackers exploit the system.
Reputation Damage: The protocol's credibility could be harmed if users lose trust in the fairness of the reward distribution.
Manuel Review
Implement Time-Weighted Rewards:
Calculate rewards based on both the amount deposited and the duration of the deposit.
Example:
solidity
Copy
Introduce a Lock-Up Period:
Require users to stake their tokens for a minimum duration before they can withdraw and claim rewards.
Example:
solidity
Copy
Add Reward Vesting:
Distribute rewards gradually over time, ensuring users cannot claim all rewards immediately.
Example:
solidity
Copy
Penalize Early Withdrawals:
Deduct a percentage of the deposited amount or rewards if users withdraw before the lock-up period ends.
Example:
solidity
Copy
Testing and Auditing:
Conduct thorough testing to ensure the new mechanisms work as intended.
Perform a security audit to identify and fix any other potential vulnerabilities.
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.