The normal behavior when transferring NFTs to contract addresses should be to ensure the recipient contract can properly handle ERC721 tokens by implementing the onERC721Received function, which is typically done using safeTransferFrom instead of transferFrom.
The specific issue in the BidBeastsNFTMarket contract is that it uses transferFrom instead of safeTransferFrom when transferring NFTs to bidders or back to sellers, without verifying if the recipient is a contract that can handle NFTs.
Likelihood: Medium
This will occur whenever an NFT is transferred to a contract address that does not implement the ERC721Receiver interface.
Smart contracts are frequently used as escrow services, multi-sig wallets, or other NFT management tools, making transfers to contracts common.
Impact: High
NFTs transferred to non-compliant contracts will be permanently locked with no recovery mechanism.
This could result in valuable assets being irretrievably lost when the auction completes or when sellers unlist their NFTs.
The marketplace has no emergency recovery mechanism for such scenarios.
Consider the following scenario:
This vulnerability occurs because:
Missing Safety Check: Using transferFrom instead of safeTransferFrom bypasses the crucial check that verifies if the recipient contract can handle ERC721 tokens.
Transfer vs. Safe Transfer: While transferFrom will successfully transfer the token to the contract address, the recipient contract needs to implement onERC721Received to properly manage the token.
No Recovery Mechanism: Once the NFT is transferred to a non-compliant contract, there is no way to recover it, resulting in permanent loss.
The mitigation replaces all instances of transferFrom with safeTransferFrom, which provides the following benefits:
Recipient Validation: safeTransferFrom checks if the recipient is a contract, and if so, verifies it implements the onERC721Received interface.
Prevents Locked Tokens: If the recipient contract does not implement this interface, the transfer fails, preventing tokens from being locked.
Industry Standard: Using safeTransferFrom is considered best practice in the industry specifically to prevent this type of token locking.
User Protection: This change protects users who may not understand the technical distinction between accounts and contracts.
This simple change significantly enhances the safety of the platform and protects valuable NFT assets from being permanently lost due to transfer to incompatible contracts.
Non-safe transferFrom calls can send NFTs to non-compliant contracts, potentially locking them permanently.
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.