The MerkleAirdrop
contract is vulnerable to an attack where a user can claim their airdrop tokens multiple times due to the lack of a tracking mechanism for claimed statuses.
The contract's claim function does not record whether an airdrop has been claimed by a particular account, allowing the same merkle proof
to be used repeatedly to withdraw tokens.
This vulnerability could lead to the depletion of all airdrop tokens by a single or multiple attackers, resulting in financial loss and a compromised airdrop distribution.
Manual Code Review
To mitigate this issue, implement a mapping to track whether an account has claimed its airdrop and update the claim function to check this mapping:
This change ensures that once an account has claimed its tokens, any subsequent attempts to claim using the same account and merkle proof will fail. Additionally, introduce a custom error for a more gas-efficient way of handling the already claimed scenario:
By implementing this mapping and check, the contract will be protected against the repeated claim vulnerability, preserving the integrity of the airdrop process and ensuring that tokens are distributed as intended.
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.