Description:
The claimNft
function in the TokenDivider contract is vulnerable to reentrancy attacks. The function burns ERC20 tokens and transfers the NFT to the caller without following the Checks-Effects-Interactions pattern. An attacker can exploit this by implementing a malicious contract that re-enters the claimNft
function during the NFT transfer.
Impact:
An attacker could potentially claim the same NFT multiple times while only burning the ERC20 tokens once
This could lead to a loss of funds for the protocol and its users
The contract's state could become inconsistent
Proof of Concept:
Tools Used:
Manual code review
Foundry for testing
Slither static analysis
Recommendations:
Implement the Checks-Effects-Interactions pattern:
Consider using OpenZeppelin's ReentrancyGuard:
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.