The mintSnowman
function allows any user to mint an unlimited number of tokens without enforcing a maximum total supply. This lack of a cap creates a critical vulnerability where users can inflate the total token count arbitrarily, undermining the value, scarcity, and functionality of the token ecosystem.
Without any constraint on s_TokenCounter
, malicious or careless users can flood the supply, potentially crashing interfaces, exhausting storage, or rendering the NFT system unusable or economically broken.
Likelihood:
High — This issue can be easily exploited by any external user without needing special permissions. Exploitation is as simple as calling the mint function with a large amount
parameter.
Impact:
Token Inflation : The absence of a hard cap allows infinite token minting, defeating any intended scarcity and destroying economic value.
Storage and Gas Concerns : A massive number of tokens stored on-chain increases storage and gas costs, possibly leading to out-of-gas failures in future transactions.
Reentrancy Risk : The current pattern places _safeMint()
before updating s_TokenCounter
, increasing the risk window for reentrancy in malicious contracts.
This test demonstrates that:
The user can mint 1,000 tokens in a single call.
No supply cap prevents minting far more.
Repeating this call allows infinite minting, which can crash UIs, disrupt tokenomics, and waste storage.
Global Supply Cap: The use of maxTokenAllowed
enforces a hard limit on how many tokens can exist, preserving scarcity and maintaining ecosystem integrity.
Fail-Fast on Overflows: The minting function now reverts early if the requested amount would exceed the cap, protecting against inflation or overflow bugs.
Scalable Tokenomics: By enforcing this rule from the constructor, different deployments can set different supply limits while maintaining core safety.
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.