Snowman Merkle Airdrop

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

# [H-4] `SnowmanAirdrop::claimSnowman` function use receiver's snow token balance to calculate leaf node hash. If user's balance of snow token changes after building the Merkle tree, Merkel proof verification will fail

[H-4] SnowmanAirdrop::claimSnowman function use receiver's snow token balance to calculate leaf node hash. If user's balance of snow token changes after building the Merkle tree, Merkel proof verification will fail

Description

  • SnowmanAirdrop::claimSnowman function use receiver's snow token balance to calculate leaf node hash. If user's balance of snow token changes after building the Merkle tree, Merkel proof verification will fail.

function claimSnowman(address receiver, bytes32[] calldata merkleProof, uint8 v, bytes32 r, bytes32 s)
external
nonReentrant
{
if (receiver == address(0)) {
revert SA__ZeroAddress();
}
if (i_snow.balanceOf(receiver) == 0) {
revert SA__ZeroAmount();
}
if (!_isValidSignature(receiver, getMessageHash(receiver), v, r, s)) {
revert SA__InvalidSignature();
}
uint256 amount = i_snow.balanceOf(receiver);
@> bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(receiver, amount))));
if (!MerkleProof.verify(merkleProof, i_merkleRoot, leaf)) {
revert SA__InvalidProof();
}
i_snow.safeTransferFrom(receiver, address(this), amount); // send tokens to contract... akin to burning
s_hasClaimedSnowman[receiver] = true;
emit SnowmanClaimedSuccessfully(receiver, amount);
i_snowman.mintSnowman(receiver, amount);
}

Risk

Likelihood: High

  • There are big chances that user's snow token balance will change.

Impact: High

  • If user's balance of snow token changes after building the Merkle tree, Merkel proof verification will fail. User can't claim nfts!!!

Proof of Concept

Recommended Mitigation

Remove the amount/balance as input to calculate Merkle tree leaf node hash!

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!