Skip to content
Business logic Audit finding Intermediate

Validator loses all accrued commission when reward token is removed

A validator's accrued commission for a reward token becomes permanently unclaimable once that token is removed from the active reward list, because the claim function checks only the current reward token registry. An attacker cannot directly exploit this, but the validator loses all accrued commission for that token, causing permanent freezing of funds.

holydevoti0n Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

50477 sc high validator loses all accrued commission when reward token is removed

Submitted on Jul 25th 2025 at 08:19:56 UTC by @holydevoti0n for Attackathon | Plume Network

Description

Brief/Intro

Incorrect logic causes a validator to lose all accrued commission when a reward token is removed.

Vulnerability Details

When requesting commission, the modifier _validateIsToken prevents the validator from claiming his commission for a reward token that was removed.

Relevant code:

Solidity
    modifier _validateIsToken(
        address token
    ) {
@>        if (!PlumeStakingStorage.layout().isRewardToken[token]) {
            revert TokenDoesNotExist(token);
        }
        _;
    }

    function requestCommissionClaim(
        uint16 validatorId,
        address token
    )
        external
        onlyValidatorAdmin(validatorId)
        nonReentrant
        _validateValidatorExists(validatorId)
@>        _validateIsToken(token)
    {
      ...
    }

The root cause is that the modifier should check if the token is a historical token (i.e., claimable even after removal), not whether it is currently an active reward token.

Impact

The validator loses all accrued commission for the reward token that was removed, causing permanent freezing of those funds.

Recommendation

Change the modifier to check if the token is a historical token, not the reward token.

Suggested patch:

Diff
    modifier _validateIsToken(
        address token
    ) {
-        if (!PlumeStakingStorage.layout().isRewardToken[token]) {
-            revert TokenDoesNotExist(token);
-        }
+        if (!PlumeStakingStorage.layout().isHistoricalRewardToken[token]) {
+            revert TokenDoesNotExist(token);
+        }
        _;
    }

{% hint style="warning" %} Ensure that tokens removed from active rewards but for which users/validators have accrued balances remain claimable by checking a historical/legacy registry rather than the current active reward list. {% endhint %}

Proof of Concept

<details> <summary>Context &#x26; PoC test (expand)</summary>

Context

  • Validator accrues commission over time.
  • One of the reward tokens he accrued commission for is removed.
  • Validator is unable to claim his commission for the removed reward token.

PoC test to add in PlumeStakingDiamond.t.sol:

Solidity
function testRequestComission_whenRewardTokenIsRemoved() public {
        // Set a very specific reward rate for predictable results
        uint256 rewardRate = 1e18; // 1 PUSD per second
        vm.startPrank(admin);
        address[] memory tokens = new address[](1);
        tokens[0] = address(pUSD);
        uint256[] memory rates = new uint256[](1);
        rates[0] = rewardRate;
        RewardsFacet(address(diamondProxy)).setRewardRates(tokens, rates);

        // Make sure treasury is properly set
        RewardsFacet(address(diamondProxy)).setTreasury(address(treasury));

        // Ensure treasury has enough PUSD by transferring tokens
        uint256 treasuryAmount = 100 ether;
        pUSD.transfer(address(treasury), treasuryAmount);
        vm.stopPrank();

        // Set a 10% commission rate for the validator
        vm.startPrank(validatorAdmin);
        uint256 newCommission = 10e16;
        ValidatorFacet(address(diamondProxy)).setValidatorCommission(
            DEFAULT_VALIDATOR_ID,
            newCommission
        );
        vm.stopPrank();

        // Create validator with 10% commission
        uint256 initialStake = 10 ether;
        vm.startPrank(user1);
        StakingFacet(address(diamondProxy)).stake{value: initialStake}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward to accrue rewards
        vm.roll(block.number + 100);
        vm.warp(block.timestamp + 100);

        // Trigger reward updates by having a user interact with the system
        // This will internally call updateRewardsForValidator
        vm.startPrank(user2);
        StakingFacet(address(diamondProxy)).stake{value: 1 ether}(
            DEFAULT_VALIDATOR_ID
        );
        vm.stopPrank();

        // Move time forward again
        vm.roll(block.number + 1);
        vm.warp(block.timestamp + 1);

        // Interact again to update rewards once more
        vm.prank(user1);
        // Unstake a minimal amount to trigger reward update
        StakingFacet(address(diamondProxy)).unstake(DEFAULT_VALIDATOR_ID, 1); // Unstake 1 wei

        // Check that some commission has accrued (positive amount)
        uint256 commission = ValidatorFacet(address(diamondProxy))
            .getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD));
        assertGt(commission, 0, "Commission should be greater than 0");

        // print how much commission validator accrued
        console2.log("Validator accrued comission is %e", ValidatorFacet(address(diamondProxy)).getAccruedCommission(DEFAULT_VALIDATOR_ID, address(pUSD)));

        // remove reward token
        vm.prank(admin);
        RewardsFacet(address(diamondProxy)).removeRewardToken(address(pUSD));

        // Try to request comission, but transaction reverts
        // as the reward token was removed
        vm.prank(validatorAdmin);
        vm.expectRevert(abi.encodeWithSelector(TokenDoesNotExist.selector, address(pUSD)));
        ValidatorFacet(address(diamondProxy)).requestCommissionClaim(
            DEFAULT_VALIDATOR_ID,
            address(pUSD)
        );
    }

Run: forge test --mt testRequestComission_whenRewardTokenIsRemoved --via-ir

Output:

JavaScript
Ran 1 test for test/PlumeStakingDiamond.t.sol:PlumeStakingDiamondTest
[PASS] testRequestComission_whenRewardTokenIsRemoved() (gas: 1462778)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.25ms (448.13µs CPU time)
</details>

The original report as published on Immunefi, by holydevoti0n. 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 claim function validates the token against the current active reward token list instead of a historical registry of tokens that were ever reward tokens.

What the attacker needed

Validator has accrued commission; reward token is removed from active list

The fix

The modifier should check a historical reward token registry instead of the current active reward token list, so accrued balances remain claimable after removal.

How it was found

  1. Set a reward rate and treasury, and configure a validator commission.
  2. Stake to accrue commission over time.
  3. Confirm the validator has a positive accrued commission.
  4. Remove the reward token from the active list.
  5. Attempt to request the commission claim and observe the transaction revert.

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 validator earns a commission in various tokens over time. If the system later stops using one of those tokens, the validator can no longer withdraw the commission already earned in it, because the withdrawal check only looks at the current list of active tokens. The fix is to check a historical list so past earnings stay claimable.

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 holydevoti0n

View all

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