The contract relies on the configurePass function to set the critical parameters (price and passMaxSupply) for ticket sales. However, the buyPass function is external and callable immediately upon contract deployment.
There is a temporal gap between the moment the contract is deployed and the moment the organizer successfully executes the configurePass transaction. During this window, the passPrice mapping returns the default value of 0.
If passMaxSupply is initialized in the constructor (or set to a default non-zero value), malicious users can front-run the organizer's configuration transaction to mint passes for free.
Likelihood:
High. Front-running bots and MEV searchers constantly monitor the mempool for such opportunities. Even if the organizer submits the configurePass transaction in the same block as deployment, a bot can pay a higher gas tip to insert their buyPass transaction before the configuration.
Impact:
Loss of Revenue. Passes intended to be sold for ETH are given away for free.
Economic Damage. The floor price of the collection is immediately crashed by users who obtained the asset at zero cost.
Assumption: The passMaxSupply is initialized to a non-zero value in the constructor (or elsewhere), making the mint technically possible.
Deployment: Organizer deploys the FestivalPass.
The Gap: The contract is now live on-chain. passPrice[ID] is 0.
Attack:
Attacker observes the deployment.
Attacker calls buyPass(ID) sending 0 ETH.
The check msg.value == passPrice passes (0 == 0).
Attacker receives the NFT.
Too Late: Organizer's transaction configurePass(ID, 1 ether, ...) confirms after the attacker's transaction.
Constructor Initialization: Set the initial price and supply immediately in the constructor so there is never a gap where the state is uninitialized
Pause Mechanism (Recommended): Use a paused boolean (or OpenZeppelin Pausable). The contract should deploy in a paused state, preventing any mints until the organizer explicitly unpauses it after configuration is complete.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.