Skip to content
high Signatures No SWC entry CWE-345

Merkle Proof Validation Error

SAFE-0049 Signatures Checked automatically by the scanner
1

What goes wrong

Merkle airdrop/whitelist verification is flawed: missing per-leaf claim tracking, second-preimage weakness from packed leaves, or accepting proofs for the wrong root, allowing double or unauthorized claims.

2

How to fix it

the pattern that is safe
mapping(address=>bool) public claimed;
function claim(uint256 amt, bytes32[] calldata p) external {
    require(!claimed[msg.sender], "claimed");
    bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(msg.sender, amt))));
    require(MerkleProof.verify(p, root, leaf), "bad proof");
    claimed[msg.sender] = true; _mint(msg.sender, amt);
}
Track claims; use double-hashed, length-safe leaves.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0049 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs