Skip to content
Access control Audit finding Intermediate

Arctokenfactory doesn t properly handle role management which allows users to arbitrary upgrade their arctoken s implementation

The ArcTokenFactory grants the token creator the DEFAULT_ADMIN_ROLE, which in OpenZeppelin AccessControl is the admin of all roles including UPGRADER_ROLE. A creator can therefore grant themselves the upgrader role and replace the token implementation with malicious code, bypassing the factory's whitelist control.

valkvalue Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

53034 sc high arctokenfactory doesn t properly handle role management which allows users to arbitrary upgrade their arctoken s implementation

Submitted on Aug 14th 2025 at 17:46:03 UTC by @valkvalue for Attackathon | Plume Network

Impacts

  • Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
  • Permanent freezing of funds
  • Theft of gas

Description

Brief/Intro

ArcTokenFactory doesn't properly handle role management which allows users to arbitrarily upgrade their ArcToken's implementation. This poses great risks because a malicious implementation of the ArcToken could be deployed, enabling theft of user funds. This could also be used to deny upgrade operations for the admin of the ArcTokenFactory.

Vulnerability Details

By design the ArcTokenFactory should only be able to upgrade implementations of existing ArcTokens to avoid malicious ArcToken implementations being deployed via the trusted factory.

The factory's createToken() grants roles to the deployer/owner and grants the UPGRADER_ROLE to the factory itself:

Solidity
        // Grant all necessary roles to the owner
        // Grant the DEFAULT_ADMIN_ROLE to the deployer
        token.grantRole(token.DEFAULT_ADMIN_ROLE(), msg.sender);
        token.grantRole(token.ADMIN_ROLE(), msg.sender);
        token.grantRole(token.MANAGER_ROLE(), msg.sender);
        token.grantRole(token.YIELD_MANAGER_ROLE(), msg.sender);
        token.grantRole(token.YIELD_DISTRIBUTOR_ROLE(), msg.sender);
        token.grantRole(token.MINTER_ROLE(), msg.sender);
        token.grantRole(token.BURNER_ROLE(), msg.sender);
        token.grantRole(token.UPGRADER_ROLE(), address(this));

The factory's upgradeToken enforces that the token was created by the factory and that the new implementation is whitelisted, then performs a UUPS upgrade:

Solidity
function upgradeToken(address token, address newImplementation) external onlyRole(DEFAULT_ADMIN_ROLE) {
    FactoryStorage storage fs = _getFactoryStorage();

    // Ensure the token was created by this factory
    if (fs.tokenToImplementation[token] == address(0)) {
        revert TokenNotCreatedByFactory();
    }

    // Ensure the new implementation is whitelisted
    bytes32 codeHash = _getCodeHash(newImplementation);
    if (!fs.allowedImplementations[codeHash]) {
        revert ImplementationNotWhitelisted();
    }

    // Perform the upgrade (this assumes the token implements UUPSUpgradeable)
    UUPSUpgradeable(token).upgradeToAndCall(newImplementation, "");

    // Update the implementation mapping
    fs.tokenToImplementation[token] = newImplementation;
}

However, the logic misses that DEFAULT_ADMIN_ROLE (granted to the ArcToken's creator) is the admin role for other roles by default in OpenZeppelin's AccessControl. That means the token creator (who holds DEFAULT_ADMIN_ROLE) can grant themselves the UPGRADER_ROLE (or otherwise manipulate role admins) and thus perform arbitrary upgrades of the token's implementation, circumventing the factory's intended upgrade control.

OpenZeppelin reference:

 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.

This allows a creator to change the whole implementation of that ArcToken while keeping it appearing as a legitimately factory-deployed token.

Impact Details

Legit-deployed ArcToken can be modified in many ways to steal funds or disrupt protocol assumptions. Examples (non-exhaustive and illustrative):

  • Remove global sanction checks or other safety logic from a new implementation.
  • Create honeypot tokens that behave normally in some flows but steal funds in others.
  • Integrate malicious behavior in other protocol flows (e.g., ArcTokenPurchase) so purchases don't transfer tokens while taking payment.
  • Brick upgrades from the factory admin by revoking or changing the factory's upgrade permissions.
  • Force users or admins to overspend gas via malicious logic.

References

Proof of Concept

{% stepper %} {% step %}

User deploys RWA token

A user (token creator) deploys an ArcToken via the factory. {% endstep %}

{% step %}

User grants themself the UPGRADE_ROLE

Because the deployer was granted DEFAULT_ADMIN_ROLE during createToken(), they can call AccessControl's grant functions to grant themselves UPGRADER_ROLE (or change role admins). {% endstep %}

{% step %}

Malicious upgrade

The creator (now adversary) upgrades the token to a malicious implementation (while the token still appears as factory-deployed). The malicious implementation can:

  • Remove or bypass global checks (sanctions, restrictions).
  • Steal funds in arbitrary flows (honeypots).
  • Revoke the factory's upgrade permissions to prevent remediation. {% endstep %} {% endstepper %}

The original report as published on Immunefi, by valkvalue. 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

The factory grants DEFAULT_ADMIN_ROLE to the token creator while relying on UPGRADER_ROLE to control upgrades, but in OpenZeppelin AccessControl DEFAULT_ADMIN_ROLE is the default admin of every role, so the creator can grant themselves UPGRADER_ROLE.

Impact

A malicious implementation could steal user funds, remove safety checks, create honeypot behaviour, or revoke the factory's upgrade permissions to block remediation.

What the attacker needed

Ability to create an ArcToken via the factory

The fix

The factory should not leave DEFAULT_ADMIN_ROLE as the admin of UPGRADER_ROLE; it should set a dedicated role admin (for example via _setRoleAdmin) so only the factory can grant or revoke UPGRADER_ROLE.

How it was found

  1. A user deploys an ArcToken through the factory.
  2. Because the deployer received DEFAULT_ADMIN_ROLE, they grant themselves UPGRADER_ROLE or change role admins.
  3. The creator upgrades the token to a malicious implementation while it still appears factory-deployed.

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 factory contract creates tokens and is supposed to be the only one allowed to change their code. But it also gives the person who created the token a powerful admin role, and in the role library used, that admin can hand out any other role, including the one that allows changing the code. So the creator can quietly swap in malicious code while the token still looks like it came from the trusted factory.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by valkvalue

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.