Skip to content
Business logic Audit finding Intermediate

Retroactive reward drain via incomplete reward debt reset

The re-stake initialisation only resets reward pointers for active tokens, not for tokens that were removed. An attacker could re-stake after a token removal and claim rewards accrued while they held no stake, draining the reward pool.

BeastBoy Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

50167 sc high retroactive reward drain via incomplete reward debt reset

Submitted on Jul 22nd 2025 at 08:24:50 UTC by @BeastBoy for Attackathon | Plume Network

Description

In the full-unstake path, the contract correctly advances every token’s “paid” pointer by iterating over all historical tokens:

Solidity
address[] storage historicalTokens = $.historicalRewardTokens;
for (…) {
    updateRewardsForValidatorAndToken($, user, validatorId, historicalTokens[i]);
}

This ensures that when a user fully withdraws, their userValidatorRewardPerTokenPaid for every token moves to the current cumulative index. By contrast, the re-stake initialization only touches the active tokens:

Solidity
address[] memory rewardTokens = $.rewardTokens;
for (…) {
    updateRewardPerTokenForValidator($, token, validatorId);
    $.userValidatorRewardPerTokenPaid[user][validatorId][token] =
        $.validatorRewardPerTokenCumulative[validatorId][token];
    $.userValidatorRewardPerTokenPaidTimestamp[user][validatorId][token] = block.timestamp;
}

Any token that was later removed never has its paid pointer updated on re-entry. Its global cumulative index continued to climb (until removal), so when the user finally calls claim, the delta between the stale pointer and the frozen cumulative index is paid out—even though the user held zero stake during that period.

Impact

Users can siphon unearned rewards for removed tokens, draining the reward pool and causing financial loss to other stakers.

Recommendation

Change the restake initialization to reset pointers over $.historicalRewardTokens rather than $.rewardTokens.

Proof of Concept

{% stepper %} {% step %}

Setup

Deploy the PlumeStaking diamond including the RewardsFacet and RewardLogic library. Register PLUME as a reward token and add a validator (ID 42). Ensure $.historicalRewardTokens and $.rewardTokens both contain PLUME. {% endstep %}

{% step %}

Initial Stake & Unstake

At time T₀ Alice stakes 1 000 PLUME on validator 42. At time T₁ she fully unstakes. The call path enters:

Solidity
updateRewardsForValidator($, Alice, 42)   // uses $.historicalRewardTokens

which advances every token’s userValidatorRewardPerTokenPaid to validatorRewardPerTokenCumulative[42][token] at T₁. {% endstep %}

{% step %}

Accrue Past Unstake

Between T₁ and T₂ the protocol continues issuing PLUME rewards to other stakers. The validator’s cumulative index for PLUME climbs from C₁ at T₁ to C₂ at T₂. {% endstep %}

{% step %}

Token Removal

At T₂ the admin calls removeRewardToken(PLUME), which emits a final checkpoint at cumulative index C₂ and sets the global rate to zero. Alice’s pointer remains at C₁, because her paid pointer was last updated on unstake. {% endstep %}

{% step %}

Re-stake (Pointer Omission)

At T₃ Alice stakes again (any amount). The facet runs _initializeRewardStateForNewStake, which loops over $.rewardTokens (now excluding PLUME) and resets only active tokens’ pointers. PLUME is omitted, so Alice’s PLUME pointer stays at C₁. {% endstep %}

{% step %}

Claim & Drain

Alice invokes claim(PLUME, 42). The code computes:

Solidity
pending = (validatorRewardPerTokenCumulative[42][PLUME] – userValidatorRewardPerTokenPaid[Alice][42][PLUME]) × stake / PRECISION
        = (C₂ – C₁) × 1_000 / 1e18

and transfers that amount, even though Alice held zero stake during [T₁, T₂]. She thereby withdraws unearned PLUME from the pool. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by BeastBoy. 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 re-stake initialisation loops over active reward tokens instead of historical tokens, leaving stale reward pointers for removed tokens.

Impact

Users could siphon unearned rewards for removed tokens, draining the reward pool and causing financial loss to other stakers.

What the attacker needed

A staking account; a reward token that gets removed; admin removes the token

The fix

The re-stake initialisation should reset pointers over historical reward tokens rather than only active tokens.

How it was found

  1. Deploy the staking contract with a reward token and a validator.
  2. Stake tokens, then fully unstake to update all reward pointers.
  3. Allow rewards to accrue for the token.
  4. Admin removes the reward token.
  5. Stake again; the removed token's pointer is not reset.
  6. Call claim for the removed token to receive unearned rewards.

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 you stake tokens, the system tracks how many rewards you have earned so far. If a reward token is removed and you stake again, the system forgets to update that tracking for the removed token, so you can later claim rewards for a period when you had no stake.

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 BeastBoy

View all

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