A Denial-of-Service (DoS) vulnerability exists in the claimRewards
function of feeCollector.sol
. When users claim their rewards, the contract resets their accumulated rewards in a way that prevents them from claiming any newly accumulated rewards in subsequent Claiming rounds. This miscalculation causes users to receive zero rewards after the first round of reward distribution, effectively locking their funds.
2025-02-raac/contracts/core/collectors/FeeCollector.sol at main · Cyfrin/2025-02-raac
Issue Description:
The function resets the user's reward balance by setting:
before transferring the rewards. The calculation for pending rewards is then performed in the internal call of
2025-02-raac/contracts/core/collectors/FeeCollector.sol at main · Cyfrin/2025-02-raac
_calculatePendingRewards()
function, which uses:
After the initial claim, userRewards[user]
is equal to totalDistributed
, causing the function to always return 0 for any subsequent claims, even when additional fees have been collected and distributed. This flaw leads to a DoS condition where users are unable to claim rewards beyond the first round.
Proof of Concept (PoC):
Add this to the FeeCollector.test.js
Accumulated fees may remain unclaimed indefinitely, potentially causing significant issues in reward distribution.
Users are unable to claim any rewards in rounds following their first claim, resulting in locked funds and a loss of rewards.
Manual Review and Hardhat
Instead of resetting the user's reward balance to totalDistributed
, adjust the logic to properly account for rewards already claimed. For example, update the balance to reflect only the portion of rewards that has been claimed, leaving pending rewards intact for future claims or reset all users rewards claimed before distributing.
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.