Skip to content
Business logic Audit finding Intermediate

StakingRewards.setRewardsDuration allows setting near zero or enormous rewardsDuration , which breaks reward logic

The setRewardsDuration function lacks bounds checking, allowing an admin to set the rewards duration to zero, near zero, or an enormous value. This breaks the reward logic: a zero duration makes notifyRewardAmount inoperable, and extreme values cause meaningless results.

hyh Follow

Originally disclosed on Code4rena

Submitted by hyh

notifyRewardAmount will be inoperable if rewardsDuration is set to zero. If will cease to produce meaningful results if rewardsDuration is too small or too big.

Proof of Concept

The setter does not control the value, allowing zero/near zero/enormous duration:

StakingRewards.sol#L178-185

Division by the duration is used in notifyRewardAmount:

StakingRewards.sol#L143-156

Recommended Mitigation Steps

Check for min and max range in the rewardsDuration setter, as too small or too big rewardsDuration breaks the logic.

ryuheimat (Concur) confirmed

Alex the Entreprenerd (judge) commented:

Finding is valid. Ultimately contingent on admin privilege so I believe Medium Severity to be appropriate.


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

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

Impact

Reward distribution could be disrupted: with zero duration notifyRewardAmount becomes inoperable, and with extreme durations rewards become meaningless, though this requires admin privilege.

What the attacker needed

Admin privilege to call setRewardsDuration

The fix

The setRewardsDuration setter should enforce a minimum and maximum range for the duration to prevent zero or extreme values.

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 staking contract, rewards are spread over a set time called the rewards duration. If that duration is set to zero, the code that calculates rewards per second divides by zero and fails. If it is set extremely small or large, the reward calculations become meaningless, so users may not get fair rewards.

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 by hyh

View all

137 more disclosed reports, best first.

More from Concur Finance contest

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.