Root: The mintSnowman
function lacks an onlyOwner modifier and violates CEI by minting before state updates.
Impact: Allows unauthorized minting, enables reentrancy
attacks.
The mintSnowman
function is designed to mint a specified number of Snowman NFTs to a given receiver address by looping through _safeMint
and incrementing a token counter.
The function lacks an onlyOwner modifier, allowing any address to mint NFTs and violates the Checks-Effects-Interactions (CEI) pattern by minting before updating the state.
Likelihood:
During any transaction where an external address calls mintSnowman
.
When a malicious contract exploits the CEI order to re-enter the function.
Impact:
Unauthorized users can mint unlimited NFTs, draining the contract’s minting capacity.
Reentrancy could allow an attacker to mint excessive tokens, disrupting the token supply and potentially crashing the contract.
Missing onlyOwner Test: A non-owner address (nasar)
successfully mints 10 NFTs, proving anyone can call the function.
CEI Violation: The function’s order _safeMint
before s_TokenCounter++
poses a reentrancy risk, though not fully tested here due to potential validation concerns.
Add an OnlyOwner modifer or add the neccesary require/revert checks required to sustain function Ownership.
Add a NonReentrant modifer from Openzeppelin to avoid any sort of Reentrancy and use the correct CEI format.
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.