Skip to content
Smart contracts Audit finding Advanced

Rewards and commissions accrued in the interval before a slash might be lost

When a validator is slashed, rewards and commissions accrued between the last update and the slash may not be recorded because the cumulative reward per token is not incremented. A user who later claims would receive nothing for that interval, and the validator loses commission for that period.

a16 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

53039 sc high rewards and commissions accrued in the interval before a slash might be lost

Submitted on Aug 14th 2025 at 17:50:39 UTC by @a16 for Attackathon | Plume Network

Description

Brief/Intro

When a validator becomes slashed, all the rewards (and the associated commissions) that were accrued up until that point should still be accounted for. However, since currentCumulativeRewardPerToken might not be properly incremented in such scenario, rewards and commissions might be lost.

Vulnerability Details

The core issue is that when updateRewardPerTokenForValidator() is called for slashed/inactive validators, the currentCumulativeRewardPerToken will not be incremented to account for the time that passed between the last update and the slash/deactivation. This means that a user that was synced with currentCumulativeRewardPerToken on the last update would remain synced even after the call to updateRewardPerTokenForValidator().

If that user later calls claim(), which will eventually trigger the _calculateRewardsCore() function, userValidatorRewardPerTokenPaid[user][validatorId][token] would be the same as currentCumulativeRewardPerToken (even though the timestamps are not synced), and the:

if (
    effectiveEndTime <= lastUserRewardUpdateTime
        || currentCumulativeRewardPerToken <= lastUserPaidCumulativeRewardPerToken
) {
    return (0, 0, 0);
}

shortcut would skip the calculation all together (although it shouldn't, as the accrued rewards between the last update and the slash were not accrued yet).

As noted in the source, currentCumulativeRewardPerToken is also not incremented by updateRewardPerTokenForValidator() in the case of an inactive validator. The key difference is that when a validator becomes inactive, _settleCommissionForValidatorUpToNow() is called, which in turn calls updateRewardPerTokenForValidator() and this happens before the validator becomes inactive, so currentCumulativeRewardPerToken is correctly updated.

This potential problem is mentioned in line 390 in PlumeRewardLogic.sol:

// We DO NOT call updateRewardPerTokenForValidator here because its logic is incorrect for slashed validators.

The problem is that if updateRewardPerTokenForValidator() was already called before calculateRewardsWithCheckpoints() was called (for example, if the relevant token was removed), validatorLastUpdateTimes[validatorId][token] would be incremented to pass effectiveEndTime and currentCumulativeRewardPerToken would never be incremented.

Note that the validator also loses commission for that interval between the last update and the slash since updateRewardPerTokenForValidator() skips that part for slashed validators.

Impact Details

Rewards and commissions earned by users and validators for the interval between the last update and the actual slash might not be accounted for.

Suggestions

Make sure that currentCumulativeRewardPerToken is updated, and consider updating the state for all (validator, reward tokens) pairs before actually slashing that validator.

Proof of Concept

{% stepper %} {% step %} User stakes to a validator.

User _u stakes some amount to Validator _v. {% endstep %}

{% step %} User syncs rewards for a token.

User _u calls claim() for reward token rt. The internal function _processValidatorRewards() calls updateRewardsForValidatorAndToken(), which syncs userValidatorRewardPerTokenPaid[_u][_v][_rt] with validatorRewardPerTokenCumulative[_v][_rt]. {% endstep %}

{% step %} Validator gets slashed.

Some time passes, and Validator _v gets slashed. {% endstep %}

{% step %} Reward token removal triggers update but not cumulative increment.

Reward token _rt is removed. This call iterates over all validators (including the slashed ones) and calls updateRewardPerTokenForValidator(_rt, _v), which updates validatorLastUpdateTimes[_v][_rt] without incrementing validatorRewardPerTokenCumulative[_v][_rt]. {% endstep %}

{% step %} User claims later and accrual is skipped.

User _u calls claim(). This triggers calculateRewardsWithCheckpoints(), which attempts to apply the "patch" that fixes currentCumulativeRewardPerToken but incorrectly skips it since effectiveEndTime > validatorLastUpdateTime is false. _calculateRewardsCore() returns early and no rewards are actually accrued. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by a16. 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 function that updates reward per token for a slashed validator does not increment the cumulative reward per token, and a later early-return check incorrectly skips the reward calculation because the user's paid value equals the cumulative value.

What the attacker needed

User has staked to a validator; validator gets slashed; reward token is removed

The fix

The report suggests making sure that currentCumulativeRewardPerToken is updated, and considering updating the state for all (validator, reward tokens) pairs before actually slashing that validator.

How it was found

  1. A user stakes tokens to a validator.
  2. The user calls claim() for a reward token, syncing their paid reward per token with the validator's cumulative value.
  3. Some time passes and the validator is slashed.
  4. The reward token is removed, which calls updateRewardPerTokenForValidator for all validators, updating the last update time without incrementing the cumulative reward per token.
  5. The user calls claim() again, but the reward calculation returns early because the user's paid value equals the cumulative value, so no rewards are accrued.

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 system, rewards build up over time. The code tracks a running total of rewards per token. When a validator is punished (slashed), the code should still record the rewards earned up to that moment. This report says that under certain conditions, that recording step is skipped, so users and validators lose the rewards they earned before the slash.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by a16

View all

13 more disclosed reports, best first.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.