57738 sc medium name squatting front run on produce allows attacker to preempt legitimate creator and capture future mint revenue

  • Submitted on: Oct 28th 2025 at 15:23:46 UTC by @TECHFUND_inc for Audit Comp | Belongarrow-up-right

  • Report ID: #57738

  • Report Type: Smart Contract

  • Report severity: Medium

  • Target: https://github.com/immunefi-team/audit-comp-belong/blob/main/contracts/v2/platform/Factory.sol

  • Impacts:

    • Theft of unclaimed royalties

Description

Brief / Intro

The produce() function derives the deterministic salt only from name and symbol. An attacker can call produce() first for a given name/symbol and become the registered creator — capturing future royalties/fees and blocking the real creator.

Vulnerability Details

  • produce() computes hashedSalt = _metadataHash(name, symbol) and uses that to check/create the deterministic contracts.

  • Because hashedSalt does not include the creator address, anyone who knows the intended name+symbol can call produce() first.

  • The first caller becomes creator in getNftInstanceInfo[hashedSalt] and in the AccessToken initialization. The legitimate creator who tries later will be blocked by TokenAlreadyExists().

  • The attacker can therefore receive creator payouts or route royalties to themselves when someone mints NFT, and can prevent the real creator from deploying their collection.

Relevant code excerpt from Factory.sol:

Relevant mint and payment flow excerpts:

From AccessToken mintStaticPrice:

From _pay:

Impact Details

An attacker can:

  • Steal future mint revenue and royalties.

  • Block legitimate creators from launching their collections (griefing).

  • Damage the protocol’s reputation.

This is direct, ongoing financial harm — not just a one-time annoyance.

References

  • https://github.com/immunefi-team/audit-comp-belong/blob/a17f775dcc4c125704ce85d4e18b744daece65af/contracts/v2/platform/Factory.sol#L238

  • https://github.com/immunefi-team/audit-comp-belong/blob/a17f775dcc4c125704ce85d4e18b744daece65af/contracts/v2/platform/Factory.sol#L289

  • https://github.com/immunefi-team/audit-comp-belong/blob/a17f775dcc4c125704ce85d4e18b744daece65af/contracts/v2/tokens/AccessToken.sol#L198

  • https://github.com/immunefi-team/audit-comp-belong/blob/a17f775dcc4c125704ce85d4e18b744daece65af/contracts/v2/tokens/AccessToken.sol#L355

Proof of Concept (PoC)

1

Step 1 — Alice prepares signed message off-chain

  • Alice creates signed message for her AccessToken collection (name, symbol, contractURI, feeNumerator, chainId).

  • This signature is what produce() expects to verify.

2

Step 2 — Attacker front-runs produce()

  • Bob monitors the mempool, sees Alice's produce() transaction, and front-runs with higher gas by calling produce() with the same AccessTokenInfo.

  • Because hashedSalt is only derived from name+symbol (not creator), Bob becomes the creator for that hashedSalt.

3

Step 3 — Alice's produce() reverts

  • Alice's transaction reverts with TokenAlreadyExists, losing gas and unable to deploy her collection.

4

Step 4 — Buyers mint from the attacker's collection

  • Buyers mint from the deployed collection; payments/creator share are routed to the attacker (Bob) via _pay, since the on-chain creator is Bob.

  • Result: attacker receives creator share; Alice receives nothing.

PoC test (use in factory.test.ts — run with yarn hardhat test):

Logs (execution output)

chevron-rightShow logshashtag

Was this helpful?