The donate() function in GivingThanks contract is vulnerable to reentrancy attacks, allowing malicious contracts to mint multiple NFTs while only paying once.
The vulnerability exists because the contract:
Sends ETH via low-level call
Performs state changes after the external call
Has no reentrancy protection
High severity:
Attacker can mint multiple NFTs for the price of one
Contract state can be manipulated
Donation accounting becomes incorrect
Possible DOS if token limit exists
Manual code review
Foundry testing framework
Custom reentrancy attack contract
Test showing successful exploitation
Implement Checks-Effects-Interactions pattern:
Alternative: Use OpenZeppelin's ReentrancyGuard:
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.