Snowman Merkle Airdrop

First Flight #42
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Reentrancy Vulnerability

Summary

The mintSnowman function in the Snowman contract contains a critical reentrancy vulnerability

Description

  • Reentrancy Vulnerability in mintSnowman() Allows Unauthorized Token Minting

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++;
}
}

Problem:

1.Dangerous external call _safeMint(receiver, s_TokenCounter);
2.Dont have nonReentrant modifier

Impact:

1.Single transaction can mint N tokens while paying for only 1

2.Token counter becomes inconsistent (s_TokenCounter increases but token IDs duplicated)

3.Potential theft of funds if minting involves payments


Proof of Concept

Recommended Mitigation

- function mintSnowman(address receiver, uint256 amount) external {
+ function mintSnowman(address receiver, uint256 amount) external nonReentrant {
for (uint256 i = 0; i < amount; i++) {
- _safeMint(receiver, s_TokenCounter);
+ s_TokenCounter++;
- emit SnowmanMinted(receiver, s_TokenCounter);
- s_TokenCounter++;
+ _safeMint(receiver, s_TokenCounter);
+ emit SnowmanMinted(receiver, s_TokenCounter);
}
}
Updates

Lead Judging Commences

yeahchibyke Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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