Claim Restriction Prevents Users from Claiming Multiple Epochs
A smart contract check prevents users from claiming rewards for more than one epoch. After a user claims once, their recorded claim amount is non-zero, so any further claim reverts, blocking rewards for later epochs.
056Security Follow with 0xAadi, 0xDemon and 31 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-10-gamma-rewarder-judging/issues/212
Found by
056Security, 0xAadi, 0xDemon, 0xMosh, 0xNirix, 0xSolus, 0xhuh2005, 0xjarix, 0xlemon, Artur, Atharv, Breeje, Cayde-6, Chonkov, Galturok, Hunter, Japy69, MaslarovK, NoOneWinner, Ollam, PNS, Pro_King, WildSniper, cergyk, dobrevaleri, irresponsible, joshuajee, merlin, ni8mare, rzizah, sammy, silver_eth, spark1, vinica_boy
Summary
After a user makes a claim, they are unable to claim rewards for subsequent epochs due to a check that restricts claims based on prior activity.
Root Cause
The handleProofResult function includes a check that requires the claimed amount to be zero (require(claim.amount == 0, "Already claimed reward.");). Once a user successfully claims rewards, this condition prevents them from claiming for any future epochs, as their claim amount is no longer zero.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
For simplicity, let’s assume the distribution rewards are set to 100 blocks, with a total of 100 rewards to be distributed and blocksPerEpoch set to 20, resulting in 5 epochs. In this scenario, the amountPerEpoch is 20. If Kate is eligible to claim for the entire period and, at block 21, she claims rewards for blocks 0-20, the amount recorded in the CumulativeClaim (in the mapping claimed) for Kate for this token and reward distribution will be 20. If Kate attempts to claim rewards for any other epoch, her request would revert due to the check: require(claim.amount == 0 , "Already claimed reward."); as claim.amount would be 20. Kate should be eligible to claim for other epochs, but she is not. Github Link
Impact
Users are unable to claim rewards for multiple epochs after their initial claim, resulting in missed opportunities to receive rewards. This restriction diminishes user engagement and overall satisfaction with the protocol.
PoC
No response
Mitigation
No response
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/GammaStrategies/GammaRewarder/pull/2
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The contract requires the cumulative claimed amount to be zero before allowing a claim, which incorrectly prevents any subsequent claims across different epochs.
Impact
Users cannot claim rewards for multiple epochs after their first claim, so they miss out on rewards they are entitled to.
What the attacker needed
User is eligible for rewards in multiple epochs
The fix
The protocol team fixed this issue in a pull request.
How it was found
- Set up a reward distribution with multiple epochs.
- User claims rewards for the first epoch.
- User attempts to claim rewards for a later epoch.
- The transaction reverts because the recorded claim amount is no longer zero.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a reward system, users should be able to collect rewards for each period (epoch). A check meant to stop double-claiming in the same period also blocks all future claims because it looks at a running total that is no longer zero after the first claim.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.