Permanently dos to arctokenpurchase contract
The contract's setPurchaseToken function reverts if any token sale is enabled, and enableToken does not require a purchase token to be set. An attacker can create a token via the public factory, enable its sale, and then the admin cannot set the purchase token, permanently blocking configuration.
Originally disclosed on Immunefi
- Disclosed after under an hour
52620 sc medium permanently dos to arctokenpurchase contract
- Submitted on Aug 12th 2025 at 03:48:59 UTC by @IronsideSec for Attackathon | Plume Network
- Report ID: #52620
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcTokenPurchase.sol
- Impacts:
- Protocol insolvency
Description
Any factory user can permanently DoS the contract’s purchase-token configuration. An attacker can enable a sale for a token they control (minted via the public factory) before the admin sets purchaseToken. After any token is enabled, setPurchaseToken always reverts, and only the token’s admin can disable the sale. This permanently blocks the purchase-token configuration and operational use of the storefront.
Short summary:
setPurchaseTokenneeds to be set in order for users to buy the enabled arc tokens. If an attacker enables a token sale before the admin callssetPurchaseToken, the admin can never set the purchase token becausesetPurchaseTokenreverts whenever there are enabled sales.- Calling
setPurchaseTokenin the contract's initialization transaction would avoid this race; relying on a subsequent transaction risks permanent DoS.
Vulnerability Details
Root causes
setPurchaseTokenreverts if any arc token is enabled.enableTokenlacks a guard ensuring a non-zeropurchaseToken.- Only token admins can call
disableToken. The factory grantsADMIN_ROLEto the token creator; that creator can revoke roles granted to the factory during token creation, preventing admins from disabling the sale.
Exploit flow (PoC steps)
{% stepper %} {% step %}
Step: Deploy and initialize
Deploy a new ArcTokenPurchase and initialize it with a valid factory, but do not call setPurchaseToken in the same transaction.
{% endstep %}
{% step %}
Step: Create token
Attacker creates a token via factory.createToken, becoming that token's admin.
{% endstep %}
{% step %}
Step: Fund and enable sale
Attacker transfers 1 wei of their token to the purchase contract and calls enableToken(token, 1, 1).
{% endstep %}
{% step %}
Step: Admin attempt to set purchase token
When the ArcTokenPurchase admin attempts setPurchaseToken(...), the call reverts with CannotChangePurchaseTokenWithActiveSales.
{% endstep %}
{% step %}
Step: Admin cannot disable sale
The admin cannot call disableToken(...) because it reverts with NotTokenAdmin. Only the token admin (attacker) can disable, so the admin is locked out and the purchase-token configuration is permanently blocked.
{% endstep %}
{% endstepper %}
Notes
- This issue does not occur if
enableTokenvalidates thatpurchaseTokenis set (non-zero) before enabling a sale.
Relevant code snippets
- setPurchaseToken (reverts if any enabled tokens exist):
function setPurchaseToken(address purchaseTokenAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
PurchaseStorage storage ps = _getPurchaseStorage();
if (ps.enabledTokens.length() > 0) {
revert CannotChangePurchaseTokenWithActiveSales();
}
if (purchaseTokenAddress == address(0)) {
revert InvalidPurchaseTokenAddress();
}
ps.purchaseToken = IERC20(purchaseTokenAddress);
emit PurchaseTokenUpdated(purchaseTokenAddress);
}
- enableToken (no check that purchase token is set):
function enableToken(
address _tokenContract,
uint256 _numberOfTokens,
uint256 _tokenPrice
) external
onlyTokenAdmin(_tokenContract) {
// ...
ps.tokenInfo[_tokenContract] =
TokenInfo({ isEnabled: true, tokenPrice: _tokenPrice, totalAmountForSale: _numberOfTokens, amountSold: 0 });
ps.enabledTokens.add(_tokenContract);
// ...
}
- disableToken (only token admin can call):
function disableToken(address _tokenContract)
external
onlyTokenAdmin(_tokenContract)
{
PurchaseStorage storage ps = _getPurchaseStorage();
TokenInfo storage info = ps.tokenInfo[_tokenContract];
// ...
info.isEnabled = false;
ps.enabledTokens.remove(_tokenContract);
emit TokenSaleDisabled(_tokenContract);
}
Impact Details
- Permanent denial-of-service on purchase-token configuration:
- Admin cannot set or change
purchaseTokenonce any sale is enabled by any token admin. - Only token admins can disable their sale; the purchase admin is locked out.
- Admin cannot set or change
- Operational halt of storefront lifecycle:
- Prevents initial configuration and future rotation of the purchase currency.
- Requires contract upgrade or external intervention to recover.
- Severity: High. Any factory user can permanently brick a fresh
ArcTokenPurchaseinstance before configuration.
Remediation
{% hint style="info" %}
- In
enableToken, require purchase token to be set:- Add:
if (address(ps.purchaseToken) == address(0)) revert PurchaseTokenNotSet();
- Add:
- Optional hardening:
- Provide an admin override to force-disable all enabled tokens or allow
setPurchaseTokenif all enabled tokens haveamountSold == 0. {% endhint %}
- Provide an admin override to force-disable all enabled tokens or allow
Proof of Concept
- Exploit gist: https://gist.github.com/IronsideSec/ea8dc6359e40bae2e323bc0e89d02bc1
- Follow the steps in the gist for a working PoC.
References
See code snippets with GitHub links above.
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 does not check that a purchase token has been set, and setPurchaseToken reverts when any sale is enabled, while only the token admin can disable a sale.
Impact
The purchase-token configuration is permanently blocked, preventing initial setup and future rotation of the purchase currency, and recovery requires a contract upgrade or external intervention.
What the attacker needed
Attacker can create a token via factory; admin has not set purchase token yet; attacker becomes token admin
The fix
The enableToken function should require that the purchase token is set before allowing a sale, and optionally an admin override could force-disable all enabled tokens or allow setPurchaseToken if all enabled tokens have amountSold == 0.
How it was found
- Deploy and initialize a new ArcTokenPurchase with a valid factory, but do not call setPurchaseToken in the same transaction.
- Attacker creates a token via factory.createToken, becoming that token's admin.
- Attacker transfers 1 wei of their token to the purchase contract and calls enableToken(token, 1, 1).
- When the ArcTokenPurchase admin attempts setPurchaseToken, the call reverts with CannotChangePurchaseTokenWithActiveSales.
- The admin cannot call disableToken because it reverts with NotTokenAdmin; only the token admin (attacker) can disable, so the admin is locked out.
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.
This smart contract lets people sell tokens, but the admin must first choose which token people use to pay. The contract has a rule that the admin cannot change this payment token while any sale is active. An attacker can start a sale of their own token before the admin sets the payment token, and then the admin is stuck because only the attacker can stop that sale.
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.