The mint()
function allows any user to mint any token ID as long as they provide enough ERC-20 tokens. However, it does not restrict who can mint which token, potentially leading to front-running attacks, minting of reserved NFTs, and gas fee waste due to failed transactions.
The contract does not enforce any restrictions on who can mint which tokenId
. This creates two main issues:
Users Can Attempt to Mint an Already Minted Token
The contract relies on the ERC-721 standard to prevent duplicate minting, meaning that failed mint attempts will still cost gas fees.
If two users try to mint the same tokenId
, one will succeed, and the other will waste gas on a failed transaction.
No Verification of Eligible Minters
The contract does not restrict minting to a whitelist or pre-sale buyers.
This allows anyone to mint any token, even if it was meant to be distributed via an auction or private sale.
Users attempting to mint already minted NFTs will pay gas fees for failed transactions.
Attackers can mint NFTs before intended users, leading to unfair distribution.
Anyone can mint any NFT, even if they were meant for specific users (pre-sale, auctions).
PoC
Alice submits a transaction to mint _tokenId = 10
.
Bob sees Alice’s transaction in the mempool and front-runs it with a higher gas fee.
Bob’s transaction gets processed first, and he mints _tokenId = 10
.
Alice’s transaction fails, and she loses gas fees.
Manual Review, Hardhat
Even though _safeMint()
already prevents duplicate minting, explicitly checking _exists(tokenId)
before execution will save gas fees on failed transactions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.