Skip to content
medium Token Standards No SWC entry CWE-393

NFT Receiver / onERC721Received Missing Validation

SAFE-0091 Token Standards Checked automatically by the scanner
1

What goes wrong

A contract meant to custody NFTs does not implement IERC721Receiver, so safeTransferFrom into it reverts (locking flows) or, if it implements it incautiously, opens a reentrancy/acceptance hole.

2

How to fix it

the pattern that is safe
function onERC721Received(address,address,uint256,bytes calldata)
    external pure returns (bytes4){ return IERC721Receiver.onERC721Received.selector; }
Implement and validate the receiver hook.
Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0091 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs