The contract's Merkle proof verification for unbalanced trees is flawed. An attacker can craft a valid proof for an unauthorized address, allowing them to claim NFTs and bypass the airdrop's access control. This vulnerability is evidenced by proofs with zero-hashes in output.json
.
The _verify
function does not correctly handle unbalanced Merkle trees, where some leaves are hashed against a zero value. This allows an attacker to forge a proof for a malicious leaf by finding a second pre-image, making the contract trust an invalid claim.
Likelihood:
An attacker can deterministically craft a malicious leaf and proof by observing the legitimate Merkle tree structure and identifying an unbalanced node. This doesn't rely on chance.
The vulnerability is in the core logic of the claim
function and is always present. The output.json
file demonstrates the existence of proofs that can be exploited.
Impact:
An attacker can claim Snowman
NFTs without being on the whitelist, effectively stealing them.
The integrity of the airdrop is compromised, leading to a loss of trust and potential financial loss for the project.
An attacker identifies an unbalanced node from the legitimate tree, crafts a malicious leaf (attacker_address
, amount
), and calculates a proof_element
to create a valid proof for their malicious leaf. They then call claim()
with this forged proof to mint NFTs.
Do not use a custom Merkle proof implementation. Use OpenZeppelin's battle-tested MerkleProof.sol
library which correctly handles unbalanced trees.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.