Eggstravaganza

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

Use of transferFrom() Instead of safeTransferFrom()

Summary

The withdrawEgg() function uses transferFrom() to return NFTs, which may result in tokens being stuck in recipient contracts.

Vulnerability Details

In the withdrawEgg(uint256 tokenId) function, eggNFT.transferFrom(address(this), msg.sender, tokenId) is used. If msg.sender is a smart contract without ERC721 support, the NFT will be sent but stuck.

function withdrawEgg(uint256 tokenId) public {
require(storedEggs[tokenId], "Egg not in vault");
require(eggDepositors[tokenId] == msg.sender, "Not the original depositor");
storedEggs[tokenId] = false;
delete eggDepositors[tokenId];
eggNFT.transferFrom(address(this), msg.sender, tokenId);
emit EggWithdrawn(msg.sender, tokenId);
}

Impact

Users could lose access to their NFTs if they withdraw to a smart contract that doesn't support ERC721 receiving.

Tools Used

  • Manual code review

Updates

Lead Judging Commences

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

Unsafe ERC721 Transfer

NFTs are transferred to contracts without onERC721Received implementation.

Support

FAQs

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

Give us feedback!