Updating MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR impacts unclaimed rewards of past epochs
The maximum reward per wallet per epoch is stored as a single updatable variable rather than being fixed per epoch. If an admin changes this cap, users claiming rewards from past epochs may receive a different amount than originally calculated.
Originally disclosed on Immunefi
- Disclosed after under an hour
#42407 [SC-Low] Updating MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR impacts unclaimed rewards of past epochs
Submitted on Mar 23rd 2025 at 17:54:49 UTC by @Oxrochimaru for Audit Comp | Yeet
- Report ID: #42407
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Reward.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
Variable RewardSettings::MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR is updatable by admin. It is the max rewards a single wallet can receive per epoch.
The users can claim their rewards of past epochs any time in future. But if MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR is updated, this new value will be applied to past epoch rewards. Hence, creating uncertainty in amount of rewards user will get for an epoch.
Vulnerability Details
A user can claim their past rewards anytime they want. Their past rewards is calculated as getClaimableAmount(). Here, MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR is not stored per epoch. Instead, its a single value used for every epoch. If it is updated then user's past rewards might change too. He might get less or more tokens depending upon new MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR.
The user's rewards should remain fixed for past epochs, no matter when they decide to claim their rewards.
Impact Details
If a user claims the rewards in future, it might get less or more rewards than initially calculated.
References
Add any relevant links to documentation or code
https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/Reward.sol?utm\\_source=immunefi#L187
Proof of Concept
Proof of Concept
- Total rewards to be distributed is 100.
- Max rewards per user is 30%.
- Alice is eligible for 25 rewards.
- The protocol decided to change max rewards to 20%.
- Now, if Alice claims in future, she is eligible for only 20 rewards now instead of 25
- Even though this epoch has ended, Alice rewards are still tied to current max rewards value in the contract.
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 maximum reward per wallet per epoch is stored as a single global variable instead of being recorded per epoch, so updates retroactively affect past epochs.
Impact
Users claiming rewards from past epochs could receive less or more than originally calculated, creating uncertainty in reward amounts.
What the attacker needed
Admin updates the max cap setting; user claims rewards from a past epoch
The fix
The maximum reward per wallet per epoch should be stored per epoch so that past rewards remain fixed.
How it was found
- Total rewards to be distributed is 100.
- Max rewards per user is 30%.
- Alice is eligible for 25 rewards.
- The protocol decided to change max rewards to 20%.
- Now, if Alice claims in future, she is eligible for only 20 rewards now instead of 25
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.
A smart contract lets users claim rewards later. The maximum reward per user is a setting the admin can change. If the admin changes it, past rewards are recalculated with the new limit, so users might get less or more than they earned.
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.