Skip to content
Business logic Audit finding Beginner

ArcTokenPurchase: Re-enabling Active Token Sales Causes Accounting Corruption and Token Loss

The enableToken function does not check if a token is already enabled, so calling it again overwrites the token's sale data and resets the amount sold to zero. This can leave unsold tokens permanently locked in the contract because the recorded availability no longer matches the actual balance.

rilwan99 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

51276 sc low arctokenpurchase re enabling active token sales causes accounting corruption and token loss

Submitted on Aug 1st 2025 at 11:08:35 UTC by @rilwan99 for Attackathon | Plume Network

Description

Brief / Intro

The ArcTokenPurchase.enableToken() function lacks validation to prevent re-enabling already enabled tokens, which leads to accounting inconsistencies and Arc Tokens being permanently locked in the contract.

<details> <summary>Vulnerability Details</summary>

The vulnerability exists in the enableToken() function in ArcTokenPurchase.sol:

Solidity
function enableToken(
    address _tokenContract,
    uint256 _numberOfTokens,
    uint256 _tokenPrice
) external onlyTokenAdmin(_tokenContract) {
    // ... validation checks ...
    
    // No check if token is already enabled
    ps.tokenInfo[_tokenContract] = TokenInfo({
        isEnabled: true,
        tokenPrice: _tokenPrice,
        totalAmountForSale: _numberOfTokens,  // Overwrites previous value
        amountSold: 0  // Resets to 0, losing previous sales data
    });
    
    ps.enabledTokens.add(_tokenContract);
    emit TokenSaleEnabled(_tokenContract, _numberOfTokens, _tokenPrice);
}

No validation checks if the token is already enabled. The assignment completely replaces the existing TokenInfo struct, losing all previous state including sales history and actual token availability.

</details>

Impact Details

  • Token Loss: Unsold tokens become permanently locked when amountSold resets to 0.
  • Accounting Mismatch: Mismatch between actual contract balance and recorded availability.
<details> <summary>References</summary>

https://github.com/plumenetwork/contracts/blob/main/arc/src/ArcTokenPurchase.sol

</details>

Proof of Concept

{% stepper %} {% step %}

Initial Setup

  • Admin calls enableToken(tokenAddr, 100e18, 10e6) // 100 tokens at $10 each
  • Contract receives 100 Arc Tokens
  • State: totalAmountForSale = 100e18, amountSold = 0, isEnabled = true {% endstep %}

{% step %}

Users Purchase Tokens

  • User1 calls buy(tokenAddr, 200e6, 20e18) // Buys 200 tokens
  • User2 calls buy(tokenAddr, 200e6, 20e18) // Buys 200 tokens
  • State after sales: totalAmountForSale = 100e18, amountSold = 40e18, isEnabled = true
  • Remaining for sale: 60e18 Arc tokens {% endstep %}

{% step %}

Token Admin Re-enables (Bug Trigger)

  • Admin calls enableToken(tokenAddr, 50e18, 20e6) // Admin wants to change price
  • State becomes: totalAmountForSale = 50e18, amountSold = 0, isEnabled = true // OVERWRITTEN
  • Contract still holds 60 Arc Tokens, but accounting shows only 50 available

Impact: 10 Arc Tokens (60e18 - 50e18) are left permanently stuck in the contract and not accounted for. There is no way to withdraw/recover these funds. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by rilwan99. 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 lacks a check to prevent re-enabling an already enabled token, so it overwrites the existing TokenInfo struct and resets amountSold to zero.

Impact

Unsold tokens become permanently locked in the contract because the recorded availability no longer matches the actual balance, and there is no way to withdraw them.

What the attacker needed

Token admin role; token already enabled

The fix

The function should be fixed by adding a check that reverts if the token is already enabled, or by updating the existing TokenInfo without resetting amountSold.

How it was found

  1. Admin calls enableToken with 100 tokens at a price, and the contract receives 100 Arc Tokens.
  2. Two users each buy 20 tokens, so amountSold becomes 40 and 60 tokens remain for sale.
  3. Admin calls enableToken again with 50 tokens and a new price, which overwrites totalAmountForSale to 50 and resets amountSold to 0.
  4. The contract still holds 60 tokens but accounting shows only 50 available, leaving 10 tokens permanently stuck.

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 are for sale and how many have been sold. If the admin sets up the same token again, the contract wipes that record and starts from zero, so some tokens already in the contract are no longer counted and cannot be withdrawn.

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 rilwan99

View all

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