The donate function in GivingThanks.sol lacks a minimum donation check. Anyone can call donate() and mint NFT by donating 0 ETH. This could lead to a situation where a donor mint NFT without making any contributions to a charity.
In the donate function, there is no requirement for a minimum amount of ETH to be sent along with the transaction. This allows any caller to donate 0 ETH and still successfully mint an NFT, as shown in the code snippet:
The function successfully completes without any check to enforce that msg.value is greater than zero. As a result, users can call donate() with msg.value = 0 and still receive an NFT.
The absence of a minimum ETH amount check allows the function to be executed with 0 ETH, minting an NFT.
Users can mint unlimited NFTs without making any actual donations to verified charities.
Manual code review.
Add a Minimum Donation Check:
Modify the donate function to enforce a minimum ETH donation amount by adding a requirement statement:
Likelyhood: Low, anyone can mint an NFT with 0 amount. No reason to do it. Impact: Informational/Very Low, NFT are minted to a false donator. An NFT with 0 in the amount section would be useless. Since that's a bad design and not expected, I'll consider it Low but in a real contest, it could be informational because there is no real impact.
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.