The donate function in the GivingThanks contract allows a verified charity address to receive Ether and mints an NFT for the donor. However, a malicious charity could exploit this setup by sending donations to itself, minting multiple NFTs without actually contributing funds from an external source.
The vulnerability lies in the donate function:
Since any address listed in the CharityRegistry can receive donations and trigger NFT minting, a malicious charity could make a self-donation to mint NFTs without real external contributions. This could result in the issuance of multiple NFTs without genuine donations, as the donate function does not verify if the donor address is distinct from the charity address.
An attacker can exploit this vulnerability to mint multiple NFTs for themselves by simply sending Ether to the contract and marking it as a “donation.” This undermines the protocol’s intent of recognizing true charitable donations and could lead to an inflation of NFTs, which would devalue genuine donations and harm the protocol’s reputation.
Manual Review
To prevent this issue, add a check to ensure that the msg.sender (donor) and the charity address are distinct. This will ensure that a charity cannot donate to itself to mint NFTs fraudulently:
This check will block any self-donations by a charity, preserving the integrity of the donation process and NFT issuance.
Likelyhood: Informational/Very low, admin will verified the contract. Impact: High, NFT with real value for free. I accept this one has a Low due to its High 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.