Trick or Treat

First Flight #27
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Valid

Use of `_mint` Instead of `_safeMint` for NFT Minting, causing loss of funds and NFT for users which cannot receive ERC721's

summary

The protocol mints the NFT's via _mint instead of safeMint function. The _mint function does not check weather or not the recipient can actually receive ERC721 token.

vulnerability detail

In the mintTreat function, the contract uses _mint to create and assign ownership of NFTs without checking the compatibility of the recipient. This lack of validation could result in NFTs being sent to contracts that are not ERC721-compatible, causing them to be locked and inaccessible.

  • Found in src/TrickOrTreat.sol Line: 81

    _mint(address(this), tokenId);
  • Found in src/TrickOrTreat.sol Line: 110

    _mint(recipient, tokenId);

impact

Using _mint instead of _safeMint could impact the user's experience, if users mistakenly use an incompatible contract, then they will not have access to the NFT, leading to user dissatisfaction, or users with a limited knowledge about nft's might event think this project is a scam.

tools used

slither & aderyn

Recommendations

Use _safeMint Instead of _mint:

- _mint(recipient, tokenId);
+ _safeMint(recipient,tokenId);
Updates

Appeal created

bube Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Use of `_mint` instead of `safeMint`

Support

FAQs

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