GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Unsafe NFT Minting with "_mint" for donors who do not support ERC721Receiver

Summary

In GivingThanks:donate, the _mint function mints and transfers tokens to recipients regardless of whether they implement ERC721Receiver.

Vulnerability Details

Within the GivingThanks:donate, the function _mint is called which transfers tokens to recipients regardless of wether they support ERC721Receiver, that if the donor do not handle ERC721 tokens, they will be completely loss.

function donate(address charity) public payable {
require(registry.isVerified(charity), "Charity not verified");
(bool sent,) = charity.call{ value: msg.value }("");
require(sent, "Failed to send Ether");
@> _mint(msg.sender, tokenCounter);
string memory uri = _createTokenURI(msg.sender, block.timestamp, msg.value);
_setTokenURI(tokenCounter, uri);
tokenCounter += 1;
}

Impact

Permanent loss of tokens with the donors if they do not implement ERC721Receiver

Tools Used

Recommendations

  • use _safeMint instead of _mint.

Updates

Lead Judging Commences

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.