Description The AirdropToken::claim function lacks a check to verify if a user has already utilized their Merkle tree leaf. Consequently, a malicious user could exploit this vulnerability to claim tokens multiple times using the same leaf, potentially leading to a significant depletion of the contract's token reserves.
Impact A single user can fully drain the contract of tokens just by claiming multiple times.
Proof of Concept This exploit is show in the MerkleAirdropTest::test_user_can_claim_multiple_times
test.
Tools Used Manual review + Foundry
Recommended Mitigation An effective solution would involve integrating a mapping mapping(bytes32 => bool)
to track the usage status of Merkle tree leaves. Once a user successfully claims their tokens, their leaf can be marked as 'used,' enabling the contract to reject any subsequent attempts to reuse it. Additionally, to enhance transparency and user trust, a public-getter function can be implemented for the claimed mapping, empowering users to verify whether their leaf has already been utilized.
With the above mitigation, if we re-run the test, the contract will revert the transaction after the first claim, as the leaf has already been used.
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.