The claimSnowman() function in SnowmanAirdrop.sol allows users to claim Snowman NFTs by providing valid merkle proofs and signatures
The function performs external calls (safeTransferFrom and mintSnowman) before updating state variables, creating a reentrancy vulnerability that allows attackers to claim multiple NFTs in a single transaction
Likelihood:
The external call to safeTransferFrom triggers the receiver's onERC721Received callback before state updates complete
Attackers exploit this callback to re-enter the claimSnowman function and drain NFTs
Impact:
Attackers claim multiple NFTs in a single transaction by exploiting the reentrancy vulnerability
The airdrop pool becomes depleted rapidly, preventing legitimate users from claiming their allocated NFTs
The attack exploits the reentrancy vulnerability in claimSnowman() by implementing a malicious onERC721Received callback. When mintSnowman() calls _safeMint(), it triggers the receiver's onERC721Received() function, allowing the attacker to re-enter claimSnowman() before the first call completes.
Attack Flow:
Attacker obtains valid merkle proof and signature for the airdrop
Attacker deploys ReentrancyAttack contract
Attacker calls attack() with valid credentials
SnowmanAirdrop.claimSnowman() validates the claim and calls mintSnowman()
mintSnowman() calls _safeMint(), which triggers ReentrancyAttack.onERC721Received()
onERC721Received() immediately re-enters claimSnowman() with the same credentials
Steps 4-6 repeat 10 times before the counter limit is reached
The attacker successfully claims 10 NFTs in a single transaction
Expected Result: The attacker receives 10 NFTs instead of the intended 1 NFT allocation. If 1,000 users are eligible for the airdrop with 1,000 NFTs total, 10 attackers can drain the entire pool, leaving 990 legitimate users with nothing.
Add OpenZeppelin's ReentrancyGuard contract and apply the nonReentrant modifier to the claimSnowman function. This prevents recursive calls and protects against reentrancy attacks.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.