Skip to content
Business logic Audit finding Intermediate

Modification of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR Leads to Unjust Loss of Promised Rewards for Users

The reward calculation uses a mutable cap factor that applies retroactively to past epochs, so changing it can reduce or eliminate rewards users have already earned. An attacker (the contract owner) could lower users' promised rewards by adjusting this factor.

T0_Socrates Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#42166 [SC-Low] Modification of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR Leads to Unjust Loss of Promised Rewards for Users

Submitted on Mar 21st 2025 at 12:48:32 UTC by @T0_Socrates for Audit Comp | Yeet

Description

Brief/Intro

The function getClaimableAmount relies on the value of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR to calculate the rewards users are entitled to, and if MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR changes, it can result in users losing rewards that have already been promised by the contract.

Vulnerability Details

The function getClaimableAmount uses the variable MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR to calculate the unclaimed rewards for users across all epochs. This can lead to a situation where modifying this variable deprives users of rewards that have already been promised by the contract in previous epochs but remain unclaimed. A correct design should ensure that the new value of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR only applies to the epochs after the change and does not affect the epochs prior to this modification.

Specifically, if an owner reduces the value of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR, it retroactively affects all rewards that users have entitled to claim, regardless of the epoch in which they were earned. This leads to a situation where users who participated with expectations of a certain reward structure may find their potential earnings diminished or eliminated after the cap adjustment. This behavior breaks the principle of fairness and could deter users from participating in the contract, as the rewards that have already been promised to users can be diminished by changes made by the contract owner.

Impact Details

The user has lost some rewards that were previously promised to them for a contract in the prior epoch.

References

https://github.com/immunefi-team/audit-comp-yeet/blob/da15231cdefd8f385fcdb85c27258b5f0d0cc270/src/Reward.sol#L171-L198

Proof of Concept

Proof of Concept

  1. A user participates in the contract and earns rewards based on their YEET volume during epoch X, with the total rewards being greater than or equal to the maximum claimable amount (maxClaimable) for that period.
  2. The contract owner changes the MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR to a higher value after the user has accrued these rewards but before they are claimed. An increase in the value of MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR will result in a decrease in the variable maxClaimable.
  3. Upon claiming rewards in the subsequent epochs, the accrued rewards are now less than what the user was originally entitled to based on initial conditions.Although the contract has promised rewards to the user, the unclaimed rewards have now decreased compared to what the user was initially entitled to under the original conditions.
  4. This leads to financial loss for the user based on actions not influenced by their participation or behavior but solely by the owner's decision.

The original report as published on Immunefi, by T0_Socrates. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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

Likely the reward calculation uses a single global cap factor that is applied to all epochs, including past ones, instead of storing the cap value per epoch or only applying changes to future epochs.

Impact

Users could lose rewards they were promised for past epochs if the owner changes the cap factor.

What the attacker needed

User has unclaimed rewards from a past epoch; owner changes the cap factor

How it was found

  1. A user earns rewards in epoch X that are at least the maximum claimable amount for that period.
  2. The contract owner changes MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR to a higher value before the user claims.
  3. The user claims in a later epoch and receives less than originally entitled.

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 promises rewards based on a cap value. If the owner changes that cap later, it also changes the rewards for past periods, so users may get less than they were promised. This is unfair because users cannot control the owner's decision.

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.

More from Yeet

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.