Skip to content
Business logic Audit finding Beginner

Sales information is lost when enabling token

The ArcTokenPurchase contract overwrites a token's sales data when that token is re-enabled, resetting amountSold to zero and replacing totalAmountForSale instead of adding to it. This causes the contract to misreport how many tokens have been sold and how many remain available.

holydevoti0n Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

51034 sc low sales information is lost when enabling token

Submitted on Jul 30th 2025 at 15:12:56 UTC by @holydevoti0n for Attackathon | Plume Network

Description

Brief/Intro

The ArcTokenPurchase lost all its historical (amountSold and totalAmountForSale) information when a previously stored token is re-enabled.

Vulnerability Details

The ArcTokenPurchase allows a previously enabled/disabled token to be enabled again, but the problem is that it overrides the information of the previous record:

https://github.com/immunefi-team/attackathon-plume-network/blob/580cc6d61b08a728bd98f11b9a2140b84f41c802/arc/src/ArcTokenPurchase.sol#L172-L173

Solidity
    function enableToken(
        address _tokenContract,
        uint256 _numberOfTokens,
        uint256 _tokenPrice
    ) external onlyTokenAdmin(_tokenContract) {
        ...
        ps.tokenInfo[_tokenContract] =
            TokenInfo({ isEnabled: true, tokenPrice: _tokenPrice, totalAmountForSale: _numberOfTokens, amountSold: 0 });


      ...
    }

This causes the sales information to be broken, as the token previously could have sold an X amount and had a Y amount left for sale.

Example 1 - Token is disabled and re-enabled later

  • Token A is enabled first time with 100 tokens for sale, amountSold is 0.
  • Token A has 50 units sold. Now totalAmountForSale is 50 and amountSold is 50.
  • Token A is disabled, the record information remains.
  • After some time, Token A is enabled again, with 100 tokens. But now:
    1. totalAmountForSale is 100, even though it should be 150
    2. amountSold is 0, even though 50 tokens were sold previously.

Example 2

  • Token A is enabled first time with 100 tokens for sale, amountSold is 0.
  • Token A has 50 units sold. Now totalAmountForSale is 50 and amountSold is 50.
  • enableToken is called again with the same information. The amountSold is set to zero again, and totalAmountForSale is 100, even though it should be 150.

Impact Details

Re-enabling a previously added token resets its sales data, causing amountSold and totalAmountForSale to misrepresent the actual tokens sold and available.

{% hint style="warning" %} Recommendation (two alternatives):

  • Prevent re-enabling a token that is already enabled.
  • When re-enabling a disabled token, merge the new data with existing sales info to preserve accurate amountSold and totalAmountForSale values. {% endhint %}

Proof of Concept

<details> <summary>PoC — examples demonstrating overwritten sales data</summary>

Context

The PoC below represents the same as added in the report. Two cases show how the sales data will be overwritten, hence incorrectly stored.

Example 1 - Token is disabled and re-enabled later

  • Token A is enabled first time with 100 tokens for sale, amountSold is 0.
  • Token A has 50 units sold. Now totalAmountForSale is 50 and amountSold is 50.
  • Token A is disabled, the record information remains.
  • After some time, Token A is enabled again, with 100 tokens. But now:
    1. totalAmountForSale is 100, even though it should be 150
    2. amountSold is 0, even though 50 tokens were sold previously.

Example 2 - Token is enabled again while already active

  • Token A is enabled first time with 100 tokens for sale, amountSold is 0.
  • Token A has 50 units sold. Now totalAmountForSale is 50 and amountSold is 50.
  • enableToken is called again with the same information. The amountSold is set to zero again, and totalAmountForSale is 100, even though it should be 150.
</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

Likely the enableToken function assigns a brand-new TokenInfo struct to the token's storage slot, overwriting the existing amountSold and totalAmountForSale values instead of merging them.

Impact

The contract's sales figures could be wrong, so it fails to deliver promised returns, but no funds are lost.

What the attacker needed

Token admin role; token previously enabled and sold

The fix

The contract should either prevent re-enabling an already enabled token or merge new data with existing sales information when re-enabling a disabled token.

How it was found

  1. Enable Token A with 100 tokens for sale; amountSold is 0.
  2. Sell 50 units; totalAmountForSale becomes 50 and amountSold becomes 50.
  3. Disable Token A; the record remains.
  4. Re-enable Token A with 100 tokens; totalAmountForSale becomes 100 instead of 150 and amountSold becomes 0 instead of 50.

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 smart contract keeps a record of how many tokens have been sold and how many are still for sale. When an admin turns a token back on, the code replaces that record with a fresh one instead of updating it, so the old sales numbers disappear. Anyone reading the contract then sees wrong figures about what has been sold.

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.