> For the complete documentation index, see [llms.txt](https://reports.immunefi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reports.immunefi.com/plume-or-attackathon/51276-sc-low-arctokenpurchase-re-enabling-active-token-sales-causes-accounting-corruption-and-token.md).

# 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**](https://immunefi.com/audit-competition/plume-network-attackathon)

* **Report ID:** #51276
* **Report Type:** Smart Contract
* **Report severity:** Low
* **Target:** <https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcTokenPurchase.sol>
* **Impacts:**
  * Permanent freezing of funds

## 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://reports.immunefi.com/plume-or-attackathon/51276-sc-low-arctokenpurchase-re-enabling-active-token-sales-causes-accounting-corruption-and-token.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
