Root Cause: The donate function violates the Checks-Effects-Interactions (CEI) pattern by making an external call before updating internal state.
Impact: A malicious charity contract could exploit this to perform a reentrancy attack, potentially causing multiple unintended token mints or disrupting the donation process.
donate Function Code:
Issue: External call to charity.call occurs before _mint.
Consequence: If charity is a malicious contract, it could re-enter the donate function.
Reorder Operations Following CEI Pattern:
Use Reentrancy Guards:
Implement OpenZeppelin's ReentrancyGuard:
Validate the charity Address:
Ensure charity is not a contract with fallback functions that could exploit reentrancy.
Impact: High, one charity can reenter the donate function with the same ETH provided and mint several NFT. Likelyhood: Low, any malicious charity can do it but Admin is trusted and should verify the charity contract before "verifying" it.
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.