Skip to content
Business logic Audit finding Intermediate

attacker can deny low decimal token reward accrual for any staker by repeatedly calling `StakingRewardsManagerBase::getRewardFor`

The reward calculation truncates when the time since the last update multiplied by the reward rate is less than the total staked supply, so an attacker can repeatedly call getRewardFor for a victim at short intervals to keep the accrued reward at zero. This can deny or halt reward accrual for any staker, especially with low-decimal tokens like USDT, USDC and WBTC.

0rpse Follow with 0xAlipede, 0xCrypt0nite and 36 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-summer-fi-governance-v2-judging/issues/1

Found by

0rpse, 0xAlipede, 0xCrypt0nite, 0xG0P1, 0xSlowbug, 0xapple, 0xaxaxa, 0xdoichantran, 0xodus, 0xpetern, 0xpiken, 0xspryon, EgisSecurity, ExtraCaterpillar, Falendar, KrisRenZo, Sa1ntRobi, SafetyBytes, SarveshLimaye, Vesko210, X0sauce, Yaneca_b, auditorshambu, cu5t0mPe0, dimulski, drdee, duckee032, farismaulana, gneiss, hard1k, ni8mare, pashap9990, prk0, radevweb3, silver_eth, theboiledcorn, touristS, werulez99, whitehair0330

Summary

it is possible to deny or halt the reward accrual of any staker by calling getRewardFor at specific time to make the reward calculation do truncation thus leading to 0 rewards. this especially can happen for reward using USDT, USDC and WBTC

Root Cause

in the getRewardFor we can specify staker address and it would call internal function _getReward:

Solidity
    function _getReward(
        address account,
        address rewardTokenAddress
@>  ) internal virtual updateReward(account) {
    }

using this, we have access to the updateReward modifier, which would update the state of reward for account.

Solidity
    function _updateReward(address account) internal {
        uint256 rewardTokenCount = _rewardTokensList.length();
        for (uint256 i = 0; i < rewardTokenCount; i++) {
            address rewardTokenAddress = _rewardTokensList.at(i);
            RewardData storage rewardTokenData = rewardData[rewardTokenAddress];
@>          rewardTokenData.rewardPerTokenStored = rewardPerToken(
                rewardTokenAddress
            );
            rewardTokenData.lastUpdateTime = lastTimeRewardApplicable(
                rewardTokenAddress
...

here is the problematic part, where rewardPerToken function would calculate how much reward is increased since last update:

Solidity
    function rewardPerToken(address rewardToken) public view returns (uint256) {
        if (totalSupply == 0) {
            return rewardData[rewardToken].rewardPerTokenStored;
        }
        return
            rewardData[rewardToken].rewardPerTokenStored +
@>          ((lastTimeRewardApplicable(rewardToken) -
@>              rewardData[rewardToken].lastUpdateTime) *
@>              rewardData[rewardToken].rewardRate) /
@>          totalSupply;
    }

there are potential truncation happen on above function by deliberately making the delta time * rate < totalSupply, making the new accrued reward effectively 0. consider a on going reward is already happening using USDT:

Bash
lastUpdated = 10_000
total rewards = 100e6 USDT per 1 week
rate = rewardAmount * WAD / duration = 100e6 * 1e18 / 1 week = 165e18 
total staked or totalSupply = 1_000e18 SUMR

we can calculate the time needed to call `getRewardFor` by finding X:

(X - lastUpdated) * rate < totalSupply
(X - 10_000) * 165e18 < 1_000e18
(X - 10_000) * 165e18 < 1_000e18
(X - 10_000)  < 1_000e18 / 165e18
(X - 10_000)  < 6.06
X < 6.06 + 10_000
X < 10_006.06

if the last time updated is 10_000 and the total weighted SUMR staked is 1_000e18, attacker needs to call getRewardFor at 10_006 timestamp or lower. this can be repeated every 6 second max for the victim so the precision loss happening because of how the calculated delta time * rate is lower than totalSupply.

this issue can be severe if the totalSupply is greater than the example above, making attacker can call the said function on longer interval. as we know the totalSupply is derived from weighted amount so this can easily became huge amount.

Internal Pre-conditions

  1. admin set the reward to 100e6 USDT per 1 week

External Pre-conditions

Attack Path

the attack path already described above in the root cause section.

by calculating the time needed to call getRewardFor so the result of (lastTimeRewardApplicable(rewardToken) - rewardData[rewardToken].lastUpdateTime) * rewardData[rewardToken].rewardRate) < totalSupply so the precision loss happening

Impact

total reward loss for any staker targeted

PoC

No response

Mitigation

there are few options:

  1. inside rewardPerToken function, if the resulting calculated rewardPerToken is not changing but the reward duration still active, we can safely revert as the truncation is happening.
  2. for low decimal token reward, we can inflate their amount to higher decimal at the reward calculation only, so the precision loss can be avoided
  3. disable getRewardFor function

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/OasisDEX/summer-earn-protocol/pull/554

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

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 integer truncation in rewardPerToken when the elapsed time multiplied by the reward rate is smaller than totalSupply, combined with a public getRewardFor that lets anyone trigger the update for any account.

Impact

The targeted staker could lose all accrued rewards because the reward per token never increases while the attacker keeps calling the function.

What the attacker needed

An active reward distribution; attacker can call getRewardFor for the victim; low-decimal reward token such as USDT

The fix

The protocol team fixed this issue in a pull request, and the report suggests reverting when truncation occurs, scaling low-decimal reward amounts, or disabling getRewardFor.

How it was found

  1. Calculate the maximum interval such that elapsed time times reward rate stays below totalSupply.
  2. Repeatedly call getRewardFor for the victim within that interval to keep the reward increment at 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.

A staking contract pays rewards over time by multiplying how long it has been since the last update by a reward rate, then dividing by the total amount staked. If that multiplication is smaller than the total staked amount, the division rounds down to zero, so no new reward is recorded. An attacker can call a public function that updates a victim's reward at just the right moments, keeping the elapsed time tiny and the reward stuck at zero.

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 0rpse

View all

23 more disclosed reports, best first.

More from Summer.fi - governance v2

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.