The claimRewards() incorrectly resets the user's claimed rewards to totalDistributed rather than incrementing it by the actual amount claimed. This allows users to double-claim or repeatedly claim rewards, leading to an unauthorized loss of protocol funds.
Currently, the function updates userRewards[user] as: userRewards[user] = totalDistributed;
After a claim, only the claimed amount (pendingReward) should be added to userRewards[user], not the entire totalDistributed value.
Setting userRewards[user] = totalDistributed; overwrites all past claims instead of adding only the newly claimed rewards.
Attack scenario:
Assume totalDistributed = 1000 and User A is eligible for pendingReward = 100.
User A calls claimRewards(), receiving 100 tokens.
userRewards[A] is set to totalDistributed = 1000, which is incorrect.
Later, when new rewards are distributed, totalDistributed increases to 1200, and User A appears to have never claimed (since 1000 is incorrect).
User A can claim again, receiving extra rewards they shouldn't have.
Users can claim more than they should.
Governance token rewards are improperly distributed.
manual
Instead of resetting to totalDistributed, increment it by pendingReward
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.