Summary: The mintSnowman
function in the Snowman contract lacks any access controls, allowing any address to mint an unlimited number of tokens without restriction.
Description: The Snowman contract implements an ERC721 non-fungible token intended for distribution via a controlled airdrop mechanism. However, the mintSnowman
function that creates new tokens does not implement any access controls or restrictions. This function allows any external address to call it and mint an unlimited number of tokens to any recipient address.
The code's behaviour permits any caller to bypass the entire intended airdrop distribution flow. The SnowmanAirdrop contract implements an elaborate claim mechanism that requires users to:
Acquire Snow tokens by paying fees
Provide valid Merkle proofs of eligibility
Submit valid signatures for verification
Burn their Snow tokens to receive Snowman NFTs
With the unrestricted minting vulnerability, an attacker can completely circumvent these requirements and mint unlimited tokens without any cost or validation checks.
To exploit this vulnerability, an attacker simply needs to call the mintSnowman
function with their address as the recipient and their desired quantity. The attacker could also mint tokens to any other address, acting as an unauthorized distributor.
Step-by-step Analysis:
The mintSnowman
function is declared as external
without any modifiers or checks to restrict who can call it.
The function accepts any address as the recipient and any quantity as the amount parameter.
Within a loop, it mints tokens to the specified recipient using the _safeMint
function.
The token counter is incremented after each minting, allowing sequential token IDs.
No validation exists to ensure the caller is authorized or has satisfied any requirements.
No limit is imposed on the total supply or the amount that can be minted in a single transaction.
Severity Classification:
Impact: High - This vulnerability completely undermines the intended token distribution mechanism, allows unlimited token supply inflation, and removes any economic cost for obtaining the NFTs. It destroys the scarcity and value proposition of the NFT collection.
Likelihood: High - Exploitation requires no special skills or conditions. Any address can call this function directly, making it trivial to exploit.
File Name: src/Snowman.sol
Code:
Recommendation:
Implement access control to restrict minting to authorized addresses only.
Consider adding a maximum supply limit to maintain scarcity.
Add batch minting limits to prevent excessive gas consumption.
Recommended Code Fix:
This fix would ensure that only authorized addresses (including the contract owner) can mint tokens, and would optionally enforce supply and batch size limits.
Proof of Concept:
The mint function of the Snowman contract is unprotected. Hence, anyone can call it and mint NFTs without necessarily partaking in the airdrop.
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.