GivingThanks
contract utilizes the _mint()
function to mint NFTs directly to the user. This approach does not verify whether the recipient can receive ERC721 tokens, which can lead to NFTs being sent to addresses that do not support ERC721. To avoid this issue, it is recommended to use _safeMint()
instead, which ensures the recipient address can properly handle ERC721 tokens.donate
function currently uses _mint()
:Problem: The _mint()
function directly assigns the NFT to the specified address without checking if the recipient can accept ERC721 tokens. If the recipient is a smart contract that does not implement the IERC721Receiver
interface, the NFT will be permanently locked in that contract, making it irretrievable.
Permanent Loss of NFTs: NFTs sent to non-compliant smart contracts may be permanently lost and irretrievable, causing asset loss for users.
User Frustration and Financial Loss: Users could lose valuable NFTs if the recipient address is not compatible with ERC721 tokens.
Potential Exploitation: Malicious actors could exploit this by intentionally providing addresses of contracts that do not support ERC721 tokens to lock up NFTs.
A user donates, and the donate()
function is called with _mint()
.
The NFT is minted to a contract address that does not implement IERC721Receiver
.
The NFT is permanently locked in the recipient contract and cannot be transferred or recovered.
Manual Code Review
_mint()
with _safeMint()
in GivingThanks.sol
to ensure that the recipient address can handle ERC721 tokens properly.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.