Skip to content
DoS Audit finding Intermediate

Token admin can dos admin to not let admin change purchase token

The setPurchaseToken function reverts if any token is enabled, and a token admin can enable a token without permission and never disable it. This lets the token admin block the protocol admin from changing the purchase token.

ladboy233 Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

52841 sc medium token admin can dos admin to not let admin change purchase token

Description

(see Vulnerability Details)

Vulnerability Details

In ArchTokenPurchase.sol, the admin should be able to setPurchaseToken and change the purchase token.

Relevant code:

Solidity
   function setPurchaseToken(
        address purchaseTokenAddress
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        PurchaseStorage storage ps = _getPurchaseStorage();
        if (ps.enabledTokens.length() > 0) { // @audit token owner can block admin from change the purchase token for sure.
            revert CannotChangePurchaseTokenWithActiveSales();
        }
        if (purchaseTokenAddress == address(0)) {
            revert InvalidPurchaseTokenAddress();
        }
        ps.purchaseToken = IERC20(purchaseTokenAddress);
        emit PurchaseTokenUpdated(purchaseTokenAddress);
    }

However, the code requires that no token is enabled:

Solidity
 if (ps.enabledTokens.length() > 0) { // @audit token owner can block admin from change the purchase token for sure.
   revert CannotChangePurchaseTokenWithActiveSales(); 
 }

But the token admin can permissionlessly enable a token and never disable a token:

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);
        }
        _;
    }

Therefore the token admin can DOS the protocol admin from changing the purchase token by simply not disabling the token or by enabling a token before the protocol setPurchaseToken call.

Impact Details

{% hint style="warning" %} The token admin can permissionlessly DOS the protocol admin to prevent the protocol admin from changing the purchase token by leaving any token enabled (or enabling one before setPurchaseToken). {% endhint %}

Recommendation

Admin should be able to disable token

(Ensure protocol admin has a way to clear/disable enabled tokens or that setPurchaseToken can be executed despite enabled tokens under controlled conditions.)

Proof of Concept

Please see above.

The original report as published on Immunefi, by ladboy233. 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 setPurchaseToken function requires that no tokens are enabled, but the token admin can enable tokens without restriction and the protocol admin has no way to disable them.

Impact

The token admin could prevent the protocol admin from changing the purchase token, causing the contract to fail to deliver promised returns without losing value.

What the attacker needed

Token admin role; no active sales or token enabled

The fix

The protocol admin should be able to clear or disable enabled tokens, or setPurchaseToken should work despite enabled tokens under controlled conditions.

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 has an admin who can change which token is used for purchases. But the code refuses to change it while any token is enabled. Another role, the token admin, can enable a token at any time and never turn it off, so the main admin gets stuck.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by ladboy233

View all

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

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.