Skip to content
Business logic Audit finding Intermediate

Incorrect reward calculation for slashed validators due to single segment time handling

The reward calculation for slashed validators uses a single time segment with a static reward rate, ignoring intermediate rate changes. This causes incorrect rewards, leading to underpayment of users or overpayment by the protocol.

DSbeX Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52186 sc low incorrect reward calculation for slashed validators due to single segment time handling

Submitted on Aug 8th 2025 at 15:20:58 UTC by @DSbeX for Attackathon | Plume Network

Description

Brief/Intro

The calculateRewardsWithCheckpoints function contains a vulnerability in its slashed validator reward calculation logic. By using a single time segment with a static reward rate between the last update and slash time, it ignores intermediate reward rate changes. This results in reward miscalculations that would cause financial losses to users (through underpayment) or protocol drains (through overpayment) if exploited in production.

Vulnerability Details

The vulnerability is in the slashed validator handling within calculateRewardsWithCheckpoints. When a validator is slashed, rewards should be calculated up to the slash timestamp, accounting for all reward rate changes during this period. However, the current implementation uses a single continuous segment with a static rate:

JavaScript
} else {
    // Slashed validator case
    uint256 currentCumulativeRewardPerToken = ...;
    uint256 effectiveEndTime = validator.slashedAtTimestamp;
    
    if (effectiveEndTime > validatorLastUpdateTime) {
        uint256 timeSinceLastUpdate = effectiveEndTime - validatorLastUpdateTime;
        uint256 effectiveRewardRate = 
            getEffectiveRewardRateAt($, token, validatorId, validatorLastUpdateTime).rate;
        
        //Vulnerable single-segment calculation
        uint256 rewardPerTokenIncrease = timeSinceLastUpdate * effectiveRewardRate;
        currentCumulativeRewardPerToken += rewardPerTokenIncrease;
    }
    return _calculateRewardsCore(...);
}
  • Uses one continuous time segment from validatorLastUpdateTime to effectiveEndTime
  • Static rate application: Applies the initial reward rate at validatorLastUpdateTime for the entire duration
  • Checkpoint ignorance: Fails to account for intermediate reward rate changes captured in validatorRewardRateCheckpoints

Impact Details

{% hint style="warning" %} Reward-rate changes during unprocessed periods can cause large underpayments to users or overpayments by the protocol. Because slashed-validator calculations are final, those errors are permanent and compound as delayed slashes or repeated rate changes amplify the discrepancy. Miscalculated base rewards also corrupt validator commission accounting, creating a stealth drain that looks like minor rounding but adds up. {% endhint %}

References

<details> <summary>Relevant code references</summary> </details>

Proof of Concept

{% stepper %} {% step %}

Setup

  • Validator is active and earning rewards normally
  • Last reward update occurred at time T0
  • Reward rate at T0 is R1 (100 tokens/day) {% endstep %}

{% step %}

Reward rate update (T1)

  • Protocol admin updates reward rate to R2 (200 tokens/day) at T1
  • New checkpoint created at T1 with R2
  • Validator continues operating but hasn't had its rewards updated since T0 {% endstep %}

{% step %}

Validator slashing (T2)

  • Validator is slashed at time T2
  • validator.slashed flag set to true
  • validator.slashedAtTimestamp set to T2
  • Validator stops participating after T2 {% endstep %}

{% step %}

Reward calculation trigger

  • User claims rewards after T2
  • System calls calculateRewardsWithCheckpoints()
  • Since validator is slashed, it enters the vulnerable code path {% endstep %}

{% step %}

Flawed calculation

  • System calculates entire period (T0 to T2) at initial rate R1
  • effectiveRewardRate = getEffectiveRewardRateAt(validatorLastUpdateTime) → returns R1 (rate at T0)
  • rewardPerTokenIncrease = (T2 - T0) * R1 {% endstep %}

{% step %}

Incorrect reward distribution

  • User receives rewards for T0-T2 period calculated entirely at R1

Correct calculation should be:

  • T0-T1 segment: (T1 - T0) × R1
  • T1-T2 segment: (T2 - T1) × R2

Impact:

  • Protocol underpaying user by (T2-T1) × (R2 - R1) tokens
  • Validator commission also miscalculated based on wrong base rewards {% endstep %} {% endstepper %}

The original report as published on Immunefi, by DSbeX. 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

The code uses a single time segment with the reward rate at the last update time, instead of iterating over checkpoints to apply rate changes.

Impact

Reward-rate changes during unprocessed periods can cause large underpayments to users or overpayments by the protocol, and these errors are permanent and compound.

What the attacker needed

Validator is slashed; Reward rate changed between last update and slash; User claims rewards after slash

The fix

The calculation should account for intermediate reward rate changes by iterating over checkpoints between the last update and slash time.

How it was found

  1. Validator is active and earning rewards normally, with last update at T0 and rate R1.
  2. Protocol admin updates reward rate to R2 at T1, creating a new checkpoint.
  3. Validator is slashed at T2, setting slashed flag and timestamp.
  4. User claims rewards after T2, triggering calculateRewardsWithCheckpoints.
  5. System calculates entire period T0-T2 using rate R1, ignoring the rate change at T1.
  6. User receives incorrect rewards based on R1 for the whole period.

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.

When a validator is slashed, the system calculates rewards from the last update to the slash time. The bug is that it uses the reward rate from the start of that period for the whole time, even if the rate changed in between. This means users might get too little or the protocol might pay too much.

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 DSbeX

View all

11 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.

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.