Snowman Merkle Airdrop

AI First Flight #10
Beginner FriendlyFoundrySolidityNFT
EXP
View results
Submission Details
Impact: high
Likelihood: high
Invalid

# [H-2] Reenterancy within `Snowman::mintSnowman` function, mint nft to contract receiver could trigger a external call, makes user can mint more nfts than specific amount

[H-2] Reenterancy within Snowman::mintSnowman function, mint nft to contract receiver could trigger a external call, makes user can mint more nfts than specific amount

Description

  • Reenterancy within Snowman::mintSnowman function, mint nft to contract receiver could trigger a external call, makes user can mint more nfts than the specific amount.

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

Risk

Likelihood: High

  • User just need prepare a contract as nft receiver, within which onERC721Received function call back to the Snowman::mintSnowman function again.

Impact: High

  • User can mint more nfts than the specific amount!!!

Proof of Concept

Recommended Mitigation

Add nonReenterant modifier to function Snowman::mintSnowman to prevent re-enter of function.

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

Lead Judging Commences

ai-first-flight-judge Lead Judge about 5 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!