Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Use of _mint Instead of _safeMint in mintEgg::EggstravaganazaNFT

Summary

The contract uses _mint for NFT creation, which doesn't verify recipient's ability to handle ERC721 tokens, risking permanent NFT locks.

Vulnerability Details

  • When minting to contract addresses, _mint doesn't check for ERC721 compatibilit.

  • _safeMint should be used as it calls onERC721Received on the recipient

Attack Scenario:

  • User uses a non-ERC721 compliant contract address to interact with the eggHuntGame

  • NFT gets minted but becomes permanently locked

Impact

  • Permanent loss of NFTs minted to incompatible addresses

Tools Used

Manual code review

Recommendation

function mintEgg(address to, uint256 tokenId) external returns (bool) {
require(msg.sender == gameContract, "Unauthorized minter");
_safeMint(to, tokenId); // Replace _mint with _safeMint
totalSupply += 1;
return true;
}
Updates

Lead Judging Commences

m3dython Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Unsafe ERC721 Minting

Protocol doesn't check if recipient contracts can handle ERC721 tokens

Support

FAQs

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