Skip to content
Business logic Audit finding Intermediate

Malicious token admin can permanently block setpurchasetoken

Any user can deploy their own token contract, grant themselves the admin role, and call enableToken on ArcTokenPurchase to add that token to the enabled list. Because setPurchaseToken refuses to run while any token is enabled, and only the token's own admin can disable it, the attacker can permanently block legitimate admins from changing the purchase token.

magtentic Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

49732 sc medium malicious token admin can permanently block setpurchasetoken

Submitted on Jul 18th 2025 at 20:31:50 UTC by @magtentic for Attackathon | Plume Network

{% hint style="info" %} Brief/Intro

A malicious user can implement a custom ArcToken contract, assign themselves the ADMIN_ROLE, and use it to call enableToken on ArcTokenPurchase. This adds the malicious token to enabledTokens, which permanently blocks the setPurchaseToken function from being called by legitimate admins. {% endhint %}

Vulnerability Details

Currently within ArcTokenPurchase, any user can call enableToken by having the ADMIN_ROLE on the ArcToken contract and transferring some tokens to make it seem like they have started a sale. This process effectively adds the provided _tokenContract to enabledTokens:

Solidity
function enableToken(
    address _tokenContract,
    uint256 _numberOfTokens,
    uint256 _tokenPrice
) external onlyTokenAdmin(_tokenContract) {
    ...
    ps.enabledTokens.add(_tokenContract);

    emit TokenSaleEnabled(_tokenContract, _numberOfTokens, _tokenPrice);
}

The onlyTokenAdmin modifier simply checks if the caller has ADMIN_ROLE on the _tokenContract contract:

Solidity
modifier onlyTokenAdmin(
    address _tokenContract
) {
    address adminRoleHolder = msg.sender;
    bytes32 adminRole = ArcToken(_tokenContract).ADMIN_ROLE();
    if (!ArcToken(_tokenContract).hasRole(adminRole, adminRoleHolder)) {
        revert NotTokenAdmin(adminRoleHolder, _tokenContract);
    }
    _;
}

Once added, the token is considered an active sale and included in the storage check for setPurchaseToken:

Solidity
function setPurchaseToken(
    address purchaseTokenAddress
) external onlyRole(DEFAULT_ADMIN_ROLE) {
    PurchaseStorage storage ps = _getPurchaseStorage();
    if (ps.enabledTokens.length() > 0) {
        revert CannotChangePurchaseTokenWithActiveSales();
    }
    ...
}

The only way to remove the _tokenContract from the enabledTokens list is by calling disableToken which can only be done by the _tokenContract admin. A malicious actor will not do this, intentionally leaving the contract in a blocked state:

Solidity
function disableToken(address _tokenContract) external onlyTokenAdmin(_tokenContract) {
    ...
    ps.enabledTokens.remove(_tokenContract);
    ...
}

Impact Details

  • A malicious token admin can permanently lock the setPurchaseToken function, blocking protocol upgrades or configuration changes. Since only the admin of the enabled token can disable it, there is no recovery path once the malicious token is added.

References

https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcTokenPurchase.sol

<details> <summary>Proof of Concept</summary>

Details provided in bounty report.

</details>

The original report as published on Immunefi, by magtentic. 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 trusts the caller's admin role on an arbitrary, user-supplied token contract instead of checking that the token is legitimate, and setPurchaseToken is blocked by any enabled token without a privileged override.

Impact

A malicious token admin can permanently lock the setPurchaseToken function, blocking protocol upgrades or configuration changes, with no recovery path once the malicious token is added.

What the attacker needed

Ability to deploy a token contract; some tokens to transfer

The fix

The contract should restrict enableToken to trusted tokens or allow the default admin to force-remove enabled tokens, so a user-supplied token cannot block setPurchaseToken.

How it was found

  1. Deploy a custom token contract that implements the expected admin role interface.
  2. Grant the attacker's address the admin role on that token.
  3. Call enableToken on ArcTokenPurchase with the malicious token address and some tokens transferred.
  4. Refuse to call disableToken, leaving the token enabled and setPurchaseToken blocked.

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.

The contract lets anyone register a token for sale if they control that token's admin role. Once any token is registered, the function that changes which token is used for purchases refuses to run. The attacker registers a token they control and never removes it, so the setting can never be changed again.

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 magtentic

View all

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