Join our Newsletter — 33% off our NHI Course
Home› Glossary› Foundations & NHI Taxonomy› OnERC721Received
Foundations & NHI Taxonomy

OnERC721Received

← Back to Glossary
By NHI Mgmt Group Updated October 29, 2026 Domain: Foundations & NHI Taxonomy

OnERC721Received is the callback function an application can implement to accept a safe transfer of an ERC-721 non-fungible token. The sending contract calls it on the recipient contract, which returns a specific value to confirm it can handle the token and avoid accidental token lock-up.

How OnERC721Received works

OnERC721Received is the receiver-side callback that makes a “safe” ERC-721 transfer actually safe in practice. The token contract does not merely send the asset and assume success, it asks the recipient contract to prove it can accept and account for the token before finalising the transfer.

That handshake matters because smart contracts can receive assets without having a built-in user interface, inventory system, or token handling logic. If the recipient cannot recognise the callback, the transfer is rejected and the token is not stranded inside a contract that cannot manage it.

Why the callback exists in ERC-721 transfers

ERC-721 tokens are often sent to contracts, not only to externally owned accounts. A direct transfer to a contract that is unaware of NFTs can create permanent lock-up if the recipient has no code path to expose, move, or otherwise manage the token.

The callback gives the sender a compatibility check. The recipient contract returns a specific magic value to signal acceptance, which creates a simple but important form of interface-level assurance. Without that explicit acknowledgement, the token standard treats the transfer as unsafe.

Security and failure modes to understand

The main security value is not confidentiality or secrecy, but safe custody and correct handling of digital assets. The callback helps prevent accidental loss caused by sending an NFT into a contract that cannot process it, but it also means recipient logic becomes part of the transfer path and must behave predictably.

Because the recipient contract executes code during the transfer, mistakes in its implementation can turn a routine asset movement into a failed transaction, a reentrancy surface, or a denial of service for deposit flows. The function therefore sits at the boundary between token transfer logic and application-specific handling.

Practical interpretation for builders and integrators

For application builders, the key question is whether the receiving contract should actively accept ERC-721 assets at all. If it should, the contract needs a correct callback implementation and a clear internal rule for what to do with received tokens. If it should not, transfer rejection is safer than silent acceptance.

For integrators and wallets, “safe transfer” should be read as a compatibility check, not as a guarantee that the destination application will preserve value or expose it usefully. The transfer may succeed only when the recipient declares support, so operational testing against the exact receiving contract matters more than assuming standard compliance.

Risk and Threat Considerations

Misuse of safe transfer flows can still create asset-loss exposure when organisations assume every contract can receive NFTs correctly. The danger is usually operational, but it becomes security-relevant when an attacker or faulty integration exploits that assumption to trap assets, disrupt custody workflows, or force fallback handling in unexpected ways.

Failure mechanism: The recipient contract either omits the required callback, returns the wrong value, or contains buggy transfer-time logic that causes the asset to be rejected, locked, or handled in an unintended state.

Impact: NFTs can become inaccessible, transfer processes can fail at scale, and downstream applications may misreport ownership or custody status after an apparently successful handoff attempt.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5, NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-9 — Identification and Authentication (Non-Organizational Users)Covers authentication between systems that must prove support before accepting a transfer.
AC-6 — Least PrivilegeLimits contract permissions so receipt logic cannot overreach beyond asset handling.
Recommendation — Require recipient contracts to authenticate their acceptance path before relying on safe asset transfer. Constrain token-handling functions to the minimum permissions needed for receipt and custody.
OWASP API Security Top 10API5 — Broken Function Level AuthorizationApplies when transfer-time entry points can invoke privileged receive logic without proper authorization checks.
Recommendation — Verify that only intended callers can invoke token-receipt and follow-on actions.
NIST CSF 2.0PR.AA-05 — Identity and Access ManagementSupports controlled acceptance of contract-to-contract asset transfers and handling rights.
Recommendation — Define and enforce which contracts are allowed to receive and process NFTs.
CIS Controls v8CIS-5 — Account ManagementSupports governance over which receiving endpoints are permitted and maintained for asset handling.
Recommendation — Maintain an approved inventory of receiving contracts and remove unused or unsafe destinations.

Practitioner Guidance

Why practitioners should care: This callback is the control point that separates a deliberate NFT handoff from an accidental lock-up event. Teams that build contracts or marketplaces should treat acceptance logic as part of asset custody design, not as a minor interface detail.

What to watch for: Contract-to-contract transfers that are expected to work but fail in testing, or recipient logic that accepts tokens without a clear post-receipt handling path, usually indicate a design gap rather than a token-standard problem.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org