Skip to content
Business logic Audit finding Intermediate

GetAccruedCommission() reverts when token was removed instead of returning the accrued commission

The getAccruedCommission function reverts when a reward token has been removed, even though the accrued commission for that token can still be claimed. An attacker could not exploit this, but it prevents validators from querying their claimable commission for historical tokens.

Plume Network

Originally disclosed on Immunefi

51457 sc low getaccruedcommission reverts when token was removed instead of returning the accrued commission

  • Report ID: #51457
  • Report Type: Smart Contract
  • Report severity: Low

Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/ValidatorFacet.sol

Impacts:

  • Contract fails to deliver promised returns, but doesn't lose value

{% hint style="warning" %} Severity: Low — function reverts when it should return a claimable value for a historical reward token. {% endhint %}

Description

Brief/Intro

When a reward token is removed, ValidatorFacet::getAccruedCommission() reverts even though the accrued commission can still be claimed.

Vulnerability Details

Reward tokens can be added and later removed. When adding a reward token, it becomes both a historical reward token and a currently active reward token. When removing a reward token, it remains a historical reward token to allow claiming of rewards for removed reward tokens. This also includes validator commission claims.

However, when a token was added as a reward token, accumulated commission, and was then removed, the ValidatorFacet::getAccruedCommission() function reverts even though there is accrued commission that can still be claimed.

Impact Details

ValidatorFacet::getAccruedCommission() reverts when the specified token has been removed, even though the commission can still be claimed.

References

Code references (kept as-is):

Proof of Concept

{% stepper %} {% step %}

Add a reward token

Call RewardsFacet::addRewardToken() to add a token as a reward token.

Reference: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/plume/src/facets/RewardsFacet.sol#L153-L202 {% endstep %}

{% step %}

Accrue commission

Some time passes and a validator accrues commission for the added reward token. {% endstep %}

{% step %}

Remove the reward token

Call RewardsFacet::removeRewardToken() to remove the reward token.

Reference: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/plume/src/facets/RewardsFacet.sol#L210-L250 {% endstep %}

{% step %}

Observe revert when querying accrued commission

Call ValidatorFacet::getAccruedCommission() for that token. The function reverts (see reference below), even though the commission can still be claimed. The function should return the commission for historical tokens as well.

Reference: https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/plume/src/facets/ValidatorFacet.sol#L957-L959 {% endstep %} {% endstepper %}

The original report as published on Immunefi. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The report concerns two facets of a smart contract system: RewardsFacet and ValidatorFacet. Two of those facets matter here: RewardsFacet, which manages the set of tokens that can be paid out as rewards, and ValidatorFacet, which exposes validator commission figures. The target of this report is ValidatorFacet.sol, specifically the view function ValidatorFacet::getAccruedCommission().

Reward tokens are not permanent. A token can be added with RewardsFacet::addRewardToken() and later removed with RewardsFacet::removeRewardToken(). The design keeps removed tokens around as historical reward tokens, so that rewards already earned in them can still be claimed. The report states that this includes validator commission claims: the commission accrued in a removed token is still claimable.

getAccruedCommission() is the view function a caller uses to read how much commission has accrued for a given token. The expected behaviour, given the historical-token design, is that it returns the accrued amount for historical tokens as well as active ones.

Setup

The report does not describe any accounts, roles, tooling or versions. The only concrete preconditions it gives are the three contract functions involved and the ordering of events: a token must have been added as a reward token, commission must have accrued for it, and the token must then have been removed. The code references point at these locations:

Function Reference
RewardsFacet::addRewardToken plume/src/facets/RewardsFacet.sol#L153-L202
RewardsFacet::removeRewardToken plume/src/facets/RewardsFacet.sol#L210-L250
ValidatorFacet::getAccruedCommission plume/src/facets/ValidatorFacet.sol#L957-L959

Finding it

The researcher started from the lifecycle of a reward token. Adding a token makes it both a historical reward token and a currently active reward token. Removing it does not delete it from the historical set; it stays there precisely so that claims for removed reward tokens remain possible, validator commission included.

That lifecycle creates an expectation for every read path that touches reward tokens: a removed token is still a valid token to query for amounts that were accrued while it was active. getAccruedCommission() does not meet that expectation. When the token passed to it has been removed, the function reverts, even though the commission for that token can still be claimed. The revert is the bug: the function should return the claimable value for historical tokens.

Exploitation

The proof of concept is a four-step sequence. It is a correctness demonstration rather than an attack: no payloads, requests or commands are given in the report, only the calls to make and the order to make them in.

Step 1: Add a reward token

Call RewardsFacet::addRewardToken() to add a token as a reward token. After this call the token is both a historical reward token and an active reward token.

Step 2: Accrue commission

Let some time pass so that a validator accrues commission for the added reward token.

Step 3: Remove the reward token

Call RewardsFacet::removeRewardToken() to remove the reward token. The token is no longer active, but it remains a historical reward token, so the commission accrued in step 2 is still claimable.

Step 4: Observe the revert when querying accrued commission

Call ValidatorFacet::getAccruedCommission() for that token. The function reverts, even though the commission can still be claimed. The expected result is the accrued commission for the historical token.

Root cause

The report does not include the body of getAccruedCommission(), so the exact check that causes the revert is not shown. What the report establishes is the mismatch between the token lifecycle and the read path: removed tokens are deliberately retained as historical tokens for claiming purposes, but getAccruedCommission() does not treat them as valid inputs and reverts instead of returning the accrued amount. The historical-token mechanism that exists to keep removed tokens claimable is therefore not honoured by this particular view function.

Impact

The impact category is that the contract fails to deliver promised returns, but does not lose value. Concretely, getAccruedCommission() reverts when the specified token has been removed, even though the commission can still be claimed. The report does not describe any loss of funds, any way to block a claim, or any effect on other users; the failure is confined to the read of the accrued commission for a removed token.

Fix

Following its own reasoning, the fix is for getAccruedCommission() to accept historical reward tokens and return the accrued commission for them, rather than reverting when the token is no longer an active reward token.

Variants to test

  1. Other view functions over the same reward-token set. Call each read function with a token that was added, accrued value, and then removed. A positive result is a revert where a historical value should be returned.
  2. Claim paths versus read paths. Compare what a claim function accepts with what the corresponding getter accepts for a removed token. A positive result is a claim that succeeds for a historical token while its getter reverts.
  3. Re-adding a removed token. Add a token, accrue, remove it, then add it again, and query the accrued commission. A positive result is an inconsistent or reverting result across the add/remove cycle.
  4. Other historical registries. Wherever a system keeps removed entries for later claims (reward tokens, asset lists, markets), query the per-entry getters after removal. A positive result is a getter that treats a historical entry as invalid.

Hunting notes

This kind of bug hides in the gap between a lifecycle rule and the functions that read the affected state. The signal during review is a comment or design note saying that removed entries are retained so that claims still work, followed by getters that only check the active set. Grep for the removal function, list every function that takes the same identifier, and check which of them consult the historical set and which do not.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

The report looks at a smart contract system with rewards and validator logic. The report looks at one small part of that system: a function that tells a validator how much commission they have earned in a particular token.

A token here means a digital currency or asset. The system lets tokens be added as rewards and later removed. When a token is removed, the system deliberately keeps a record of it, so that rewards people already earned in that token can still be claimed. That record is called a historical reward token.

The bug is simple to describe. There is a function called getAccruedCommission() whose job is to report how much commission has built up for a given token. If you ask it about a token that has since been removed, it does not answer. It stops with an error, called a revert. But the commission in that token can still be claimed, so the function should have returned the amount. It fails to deliver a promised return, which is why the report is rated low severity: nothing is lost, but a read of the data does not work as it should.

Background concepts, from zero

Before walking through the report, here are the ideas it relies on.

  • Blockchain: a shared record of transactions that many computers keep copies of. Nobody can quietly change past entries.
  • Smart contract: a program stored on the blockchain. It runs automatically when someone calls one of its functions, and its code is public.
  • Function: a named piece of code that does one job. You call it, give it inputs, and it returns an output or changes some stored data.
  • View function: a function that only reads data and returns it. It does not change anything on the blockchain. Think of it as a lookup, like checking your bank balance in an app rather than moving money.
  • Token: a digital asset tracked by the system. Rewards can be paid in different tokens.
  • Validator: a participant who helps run the network and earns commission as a reward for doing so.
  • Commission: the share of rewards that a validator keeps for themselves.
  • Accrued: built up over time but not yet collected. Like interest that has accumulated in a savings account but has not been withdrawn.
  • Revert: when a smart contract stops a call and undoes it, returning an error instead of a result. In everyday terms, the program refuses to answer and throws up an error message.
  • Facet: a module of a larger smart contract system. The system is split into pieces, and each facet handles one area, such as rewards or validators.
  • Historical reward token: a token that was once active as a reward token and has since been removed, but is kept on record so that old rewards can still be claimed.

Context: the two facets involved

The report targets a file called ValidatorFacet.sol, and in particular one function inside it, ValidatorFacet::getAccruedCommission(). The double colon is just a way of writing "the function getAccruedCommission that lives in ValidatorFacet".

Two facets matter here:

  1. RewardsFacet manages the set of tokens that can be paid out as rewards. It has a function to add a token and a function to remove one.
  2. ValidatorFacet exposes figures about validators, including how much commission has accrued.

Reward tokens are not permanent. An operator can add a token with RewardsFacet::addRewardToken() and later remove it with RewardsFacet::removeRewardToken(). The design keeps removed tokens around as historical reward tokens, so that rewards already earned in them can still be claimed. The report states that this includes validator commission claims: commission accrued in a removed token is still claimable.

getAccruedCommission() is the view function a caller uses to read how much commission has accrued for a given token. Given the historical-token design, the expected behaviour is that it returns the accrued amount for historical tokens as well as active ones.

Setup: what you need before reproducing

The report does not describe any accounts, roles, tooling or versions. The only concrete preconditions it gives are the three contract functions involved and the order of events: a token must have been added as a reward token, commission must have accrued for it, and the token must then have been removed. The code references point at these locations:

Function Reference
RewardsFacet::addRewardToken plume/src/facets/RewardsFacet.sol#L153-L202
RewardsFacet::removeRewardToken plume/src/facets/RewardsFacet.sol#L210-L250
ValidatorFacet::getAccruedCommission plume/src/facets/ValidatorFacet.sol#L957-L959

The right-hand column is a pointer into the public code repository: the file name, then the line numbers where the function sits. For example, #L957-L959 means lines 957 to 959 of ValidatorFacet.sol. You can open those lines in a browser on the code hosting site and read the function yourself.

Finding it: how the researcher spotted the bug

The researcher started from the lifecycle of a reward token, meaning the stages a token goes through from being added to being removed.

  1. Adding a token makes it both a historical reward token and a currently active reward token. In other words, it is on the list of tokens that can be paid now, and also on the permanent record of tokens that have ever been reward tokens.
  2. Removing it does not delete it from the historical set. It stays there precisely so that claims for removed reward tokens remain possible, validator commission included.

That lifecycle creates an expectation for every read path that touches reward tokens. A read path is any function that looks up information about tokens. The expectation is that a removed token is still a valid token to query for amounts that were accrued while it was active.

getAccruedCommission() does not meet that expectation. When the token passed to it has been removed, the function reverts, even though the commission for that token can still be claimed. The revert is the bug: the function should return the claimable value for historical tokens.

A useful comparison: imagine a shop that keeps old gift cards on file so customers can still redeem the balance. A clerk who refuses to even look up the balance on an old card, while the card can still be spent at the till, is doing exactly what this function does.

Exploitation: the four-step proof of concept

The proof of concept is a four-step sequence. It is a correctness demonstration rather than an attack: no payloads, requests or commands are given in the report, only the calls to make and the order to make them in. The point is to show that the function misbehaves, not to steal anything.

Step 1: Add a reward token

Call RewardsFacet::addRewardToken() to add a token as a reward token. After this call the token is both a historical reward token and an active reward token.

Why this step: the bug only appears for tokens that have gone through the full add-then-remove cycle, so the first thing to do is put a token into the system.

Step 2: Accrue commission

Let some time pass so that a validator accrues commission for the added reward token.

Why this step: the function under test reports an amount. Without any commission built up, there would be nothing to report and the test would prove little. Waiting lets the system record a real figure for this token.

Step 3: Remove the reward token

Call RewardsFacet::removeRewardToken() to remove the reward token. The token is no longer active, but it remains a historical reward token, so the commission accrued in step 2 is still claimable.

Why this step: this is the condition that triggers the bug. The token is now in the historical set, which is exactly the situation the function should handle.

Step 4: Observe the revert when querying accrued commission

Call ValidatorFacet::getAccruedCommission() for that token. The function reverts, even though the commission can still be claimed. The expected result is the accrued commission for the historical token.

Why this step: this is the observation. A correct system would answer with the amount from step 2. Instead the call fails, which is the evidence for the report.

Root cause: why the function fails

The report does not include the body of getAccruedCommission(), so the exact check that causes the revert is not shown. What the report establishes is the mismatch between the token lifecycle and the read path: removed tokens are deliberately retained as historical tokens for claiming purposes, but getAccruedCommission() does not treat them as valid inputs and reverts instead of returning the accrued amount. The historical-token mechanism that exists to keep removed tokens claimable is therefore not honoured by this particular view function.

In plain terms, the system has two lists: the active tokens and the historical tokens. The claim machinery knows about both. The report does not show the function body, so the exact check that causes the revert is unknown.

Impact: what actually goes wrong

The impact category is that the contract fails to deliver promised returns, but does not lose value. Concretely, getAccruedCommission() reverts when the specified token has been removed, even though the commission can still be claimed.

The failure is confined to the read of the accrued commission for a removed token. That is why the severity is low: the money is still there and still claimable, but anyone relying on this function to display or check the amount gets an error instead of a number.

Fix: what should change

Following its own reasoning, the fix is for getAccruedCommission() to accept historical reward tokens and return the accrued commission for them, rather than reverting when the token is no longer an active reward token.

Variants to test: where else to look

These are follow-up ideas for someone hunting similar bugs. Each one describes a test and what a positive result looks like.

  1. Other view functions over the same reward-token set. Call each read function with a token that was added, accrued value, and then removed. A positive result is a revert where a historical value should be returned.
  2. Claim paths versus read paths. Compare what a claim function accepts with what the corresponding getter accepts for a removed token. A positive result is a claim that succeeds for a historical token while its getter reverts.
  3. Re-adding a removed token. Add a token, accrue, remove it, then add it again, and query the accrued commission. A positive result is an inconsistent or reverting result across the add/remove cycle.
  4. Other historical registries. Wherever a system keeps removed entries for later claims (reward tokens, asset lists, markets), query the per-entry getters after removal. A positive result is a getter that treats a historical entry as invalid.

Hunting notes: the general lesson

This kind of bug hides in the gap between a lifecycle rule and the functions that read the affected state. The signal during review is a comment or design note saying that removed entries are retained so that claims still work, followed by getters that only check the active set. Grep for the removal function, list every function that takes the same identifier, and check which of them consult the historical set and which do not.

Glossary

  • Accrued: built up over time but not yet collected, like interest in a savings account.
  • Blockchain: a shared, tamper-resistant record of transactions kept by many computers.
  • Commission: the share of rewards a validator keeps for themselves.
  • Facet: one module of a larger smart contract system, each handling a specific area.
  • Function: a named piece of code that performs one job when called.
  • Getter: a function whose only job is to read and return a value.
  • Historical reward token: a token that was once active as a reward token, has been removed, and is kept on record so old rewards can still be claimed.
  • Read path: any function that looks up information without changing stored data.
  • Revert: when a smart contract stops a call and returns an error instead of a result.
  • Reward token: a token that the system can pay out as a reward.
  • Severity: a rating of how serious a bug is, here low because nothing is lost.
  • Smart contract: a program stored on a blockchain that runs automatically when called.
  • Validator: a participant who helps run the network and earns commission for it.
  • View function: a function that only reads data and returns it, without changing anything.

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.