Griefing Attack on ArcTokenPurchase.setPurchaseToken() Function via Front-Running
The setPurchaseToken function refuses to change the purchase token while any token is enabled for sale, and any user can enable a token through the public createToken and enableToken functions. An attacker could therefore keep at least one token enabled and permanently block the admin from switching the purchase token.
- Disclosed after under an hour
52203 sc medium griefing attack on arctokenpurchase setpurchasetoken function via front running
Submitted on Aug 8th 2025 at 17:24:09 UTC by @thesvn for Attackathon | Plume Network
- Report ID: #52203
- Report Type: Smart Contract
- Report severity: Medium
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/arc/src/ArcTokenPurchase.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
- Permanent freezing of funds
Description
Brief/Intro
The setPurchaseToken function in the ArcTokenPurchase contract can be permanently blocked by malicious actors through a griefing attack. Once a purchase token is set and any token is enabled for sale, an attacker can prevent the DEFAULT_ADMIN_ROLE from ever changing the purchase token by maintaining at least one enabled token. This creates a denial-of-service condition that prevents the protocol from upgrading or migrating to a different purchase token, even when necessary due to technical issues, regulatory requirements, or protocol improvements.
Vulnerability Details
The vulnerability exists in the setPurchaseToken function of ArcTokenPurchase.sol. The function includes a check that prevents changing the purchase token when there are active sales:
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);
}
The fundamental problem is that once any token is enabled for sale, the contract permanently blocks the DEFAULT_ADMIN_ROLE from changing the purchase token. This means that if the protocol ever needs to upgrade, migrate, or recover from a misconfiguration of the purchase token (for example, due to a bug, a depegged stablecoin, or a regulatory requirement), it is impossible to do so without disabling all active sales. A malicious token creator can enable a sale and the DEFAULT_ADMIN_ROLE is forever prevented from updating the purchase token.
Impact Details
{% hint style="warning" %} High Likelihood, High Impact - Permanent Protocol Control Loss
Likelihood: High
- Low Barrier to Entry: Any user can create tokens via the public
createToken()function - Minimal Cost: Attack requires only gas fees for token creation and enabling
- Simple Execution: No technical expertise required beyond basic contract interaction
- Immediate Effect: Attack succeeds instantly once a token is enabled
Impact Level: High
- Permanent Protocol Lock: Once exploited, the protocol is permanently locked to the current purchase token
- Governance Failure: Admin loses control over critical protocol parameter (purchase token)
- Upgrade Prevention: Protocol cannot respond to technical issues, regulatory changes, or security concerns
- Economic Disruption: Inability to migrate to better or more stable purchase tokens {% endhint %}
References
<details> <summary>Relevant code links</summary> </details>Proof of Concept
{% stepper %} {% step %}
Initial Setup
- ArcTokenPurchase contract is deployed and initialized
- Admin sets USDC as the purchase token
- Contract is operational with USDC as purchase currency {% endstep %}
{% step %}
Attacker Preparation
- Attacker calls
ArcTokenFactory.createToken()to create a new ArcToken - Attacker becomes the token admin with full privileges
- Attacker transfers some tokens to ArcTokenPurchase contract {% endstep %}
{% step %}
Griefing Attack
- Attacker calls
ArcTokenPurchase.enableToken(attackerToken, amount, price) - Function succeeds;
enabledTokens.length()becomes 1 {% endstep %}
{% step %}
Admin Attempt to Change Purchase Token
- Admin tries to call
setPurchaseToken(USDT_ADDRESS)to migrate from USDC to USDT - Function reverts with
CannotChangePurchaseTokenWithActiveSales() - Admin is permanently blocked from changing the purchase token while any token remains enabled {% endstep %}
{% step %}
Protocol State
- Purchase token remains locked to USDC
- Protocol cannot upgrade to USDT or any other token while the enabled token exists
- All future purchase token changes are blocked while any token is enabled {% endstep %} {% endstepper %}
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
The setPurchaseToken function blocks changes whenever any token is enabled, and enabling a token is open to any user, so a single enabled token permanently locks the purchase token.
Impact
The protocol could be permanently locked to the current purchase token, preventing migration to another token even when needed for technical, regulatory or security reasons.
What the attacker needed
No special access needed; gas fees for token creation and enabling
The fix
The check should be removed or replaced with a mechanism that lets the admin change the purchase token without depending on whether any token is enabled.
How it was found
- The contract is deployed and the admin sets USDC as the purchase token.
- The attacker creates a new token through the public factory and receives admin rights over it.
- The attacker transfers some of those tokens to the purchase contract.
- The attacker enables the token for sale, so the enabled token count becomes one.
- The admin tries to switch the purchase token and the call reverts with CannotChangePurchaseTokenWithActiveSales.
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 is a program on a blockchain that runs automatically. This one lets an admin choose which token people pay with, but it refuses to change that choice while any token is on sale. Because anyone can put a token on sale, anyone can keep the setting frozen and stop the admin from ever switching the payment token.
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.