Eggstravaganza

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

Unsafe NFT minting allows permanent token lockup

Description:

The EggstravaganzaNFT contract uses the unsafe _mint() function instead of _safeMint() when creating new NFT tokens. The _mint() function lacks the necessary checks to verify that contract recipients are capable of handling ERC721 tokens. This creates a significant vulnerability where NFT tokens can be permanently locked if minted to a contract address that doesn't implement the onERC721Received() interface.

Attack path:

  • A user participates in the egg hunt game and successfully finds an egg

  • The user's address happens to be a smart contract that doesn't implement the onERC721Received() interface

  • The EggHuntGame contract calls eggNFT.mintEgg(msg.sender, eggCounter)

  • The mintEgg function uses _mint() to create the token and assign it to the contract address

  • The transaction succeeds, but the token is now permanently locked in the recipient contract with no way to access or transfer it

Impact:

  • Permanent loss of NFT assets for users who are smart contracts without ERC721 receiving capability

  • Inconsistent game state as tokens are counted as "minted" but are effectively inaccessible

Recommended Mitigation:

Replace _mint() with _safeMint() in the mintEgg() function to ensure proper verification of the recipient:

Updates

Lead Judging Commences

m3dython Lead Judge 4 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.