Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Callback
Cyber Security

Callback

← Back to Glossary
By NHI Mgmt Group Updated October 31, 2026 Domain: Cyber Security

A callback is a function invoked automatically during an operation, often when a token is sent or received. In smart contracts, callbacks can create reentry opportunities because they hand control to another contract before the original transaction has fully completed.

How callbacks work

A callback is a function that is invoked by another component as part of a larger operation. In many systems that means handing control to user-supplied logic at a specific event, which makes callbacks a powerful extension point but also a place where execution flow becomes less predictable.

In event-driven software, callbacks are the mechanism that turns a passive operation into a reactive one. They let code respond when data arrives, when a request completes, or when a state transition occurs, without continuously polling for change.

Callbacks in smart contracts

In smart contracts, callbacks are especially sensitive because the external call can transfer control before the original transaction has finished. That interruption can create reentry conditions if the contract updates state only after the callback returns, rather than before it hands control away.

This is why callbacks in blockchain code are not just a programming convenience. They alter the trust boundary during execution, so the contract must assume the callee may behave unexpectedly, recursively invoke functions, or try to observe inconsistent intermediate state.

Why callbacks are useful

Callbacks make asynchronous and modular systems possible. They support notification handlers, response processing, plugin-style extensibility, and integration points where a framework or runtime needs custom logic without hard-coding that logic into the core operation.

That flexibility is valuable in application code, libraries, user interface frameworks, message brokers, and smart-contract interactions. The trade-off is that the caller gives up some direct control over timing and execution order, which can make reasoning about state and side effects harder.

Security implications of callback-driven flow

Security concerns arise when callback timing influences authorization, state integrity, or external interactions. A callback may execute with more context than expected, observe partially updated data, or reach code paths that were not intended to be reentrant, which is why defensive ordering matters in callback-heavy designs.

When a callback can call back into the originating system, the failure is usually not the callback itself but the assumption that the original operation remains isolated until completion. That assumption breaks down in systems that expose mutable state, shared balances, or other sensitive transitions before the operation is fully settled.

Risk and Threat Considerations

Callbacks create risk when control is yielded to external or untrusted code before a transaction, state change, or security decision has fully completed. In smart contracts and other event-driven systems, that can expose inconsistent state and open a path for repeated invocation, logic abuse, or unauthorized side effects.

Failure mechanism: The caller invokes external logic too early, allowing the callee to re-enter, chain additional actions, or exploit intermediate state before the original operation finalises.

Impact: This can lead to double execution, incorrect balances, broken invariants, privilege or logic abuse, and broader compromise of transaction integrity.

Standards & Framework Alignment

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

MITRE ATT&CK and OWASP API Security Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
MITRE ATT&CKT1203 — Exploitation for Client ExecutionCallbacks can trigger attacker-controlled execution flow during an operation.
Recommendation — Audit callback entry points and constrain any user-controlled execution path that can be abused for malicious code flow.
NIST SP 800-53 Rev 5SC-4 — Information in Shared System ResourcesCallbacks can expose intermediate state through shared runtime resources and shared execution context.
Recommendation — Protect shared execution state so callback handlers cannot observe or corrupt in-progress sensitive operations.
OWASP ASVSV15 — Secure Coding and ArchitectureCallback-driven control flow is an architectural security concern, especially around reentrancy and state handling.
Recommendation — Design callback logic so state is made consistent before control transfers to external or user-supplied code.
OWASP API Security Top 10API6 — Unrestricted Access to Sensitive Business FlowsCallbacks can alter the sequence of sensitive flows when external code is invoked mid-operation.
API5 — Broken Function Level AuthorizationCallback paths may reach privileged functions if control is handed to the wrong handler or object.
Recommendation — Constrain sensitive flows so callback-driven transitions cannot bypass intended business-process sequencing. Enforce function-level checks around callback entry points before any privileged action executes.

Practitioner Guidance

Why practitioners should care: If a callback crosses a trust boundary, treat it as a control transfer rather than a simple function call. The practical question is whether the receiving code can observe or influence state before the caller has made that state safe.

What to watch for: Review callback paths where external logic is invoked during a sensitive lifecycle step, especially when the code later performs state updates, accounting, authorization checks, or settlement. Those are the places where execution order matters most.

Practitioner takeaway: The safest callback design is one that assumes the callee may be hostile, recursive, or slow, and that the caller must leave its state consistent before yielding control.

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 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org