The smart contract exposes a vulnerability by using the _mint
function directly instead of the safeMint
function in the mintEgg
method. This issue can result in unsafe minting, potentially causing problems such as tokens being minted to invalid addresses or incompatible contracts.
The mintEgg
function allows only the approved game contract to mint NFTs. However, it uses the _mint
function directly, which does not check for the safety of minting tokens to arbitrary addresses or addresses that may not be able to handle the NFT. The proper function to use in this context is safeMint
, which ensures that tokens are minted safely to addresses that can accept them.
Token Loss: If an NFT is minted to a contract address that cannot handle the token (e.g., a contract that does not implement the IERC721Receiver interface), the minted token may be lost.
Security Risks: The direct use of _mint exposes the contract to potential issues with minting to malicious or invalid addresses, which could have unforeseen consequences.
Reduced Interoperability: The absence of safe checks limits the contract's compatibility with other applications or contracts that expect NFTs to be safely transferable.
Foundry.
Manual Review.
Always use safeMint.
Protocol doesn't check if recipient contracts can handle ERC721 tokens
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.