Skip to content

ERC721 onERC721Received() Reentrancy

Description

The onERC721Received() function is vulnerable to reentrancy attacks, which can lead to unintended behavior and potential security risks.

Examples

Insecure Code

solidity
function onERC721Received(...) { _checkOnERC721Received(...); }

Secure Code

solidity
function onERC721Received(...) { /* state changes */; _checkOnERC721Received(...); }

Remediation

Use the Checks-Effects-Interactions pattern to prevent reentrancy attacks. Ensure that all state changes are made before making external calls.

Rule Details

FieldValue
IDCODE-0217
CategoryCrypto
SeverityHIGH
CWECWE-841
ConfidenceHIGH
ImpactHIGH
LikelihoodLOW
ExploitabilityMODERATE
Tagsreentrancy, erc721
OWASPN/A

References