Reentrancy Attack
Pronunciation: ree-EN-trun-see uh-TAK
Definition
Reentrancy Attack is an attack or weakness pattern that exploits external calls that re-enter vulnerable code before its previous execution has safely completed state updates. Defenses against Reentrancy Attack combine secure design, least privilege, validation, monitoring, rate or value limits, and tested containment and recovery procedures.
Overview
Meaning and scope
Reentrancy Attack is an attack or weakness pattern that exploits external calls that re-enter vulnerable code before its previous execution has safely completed state updates. Defenses against Reentrancy Attack combine secure design, least privilege, validation, monitoring, rate or value limits, and tested containment and recovery procedures.
Mechanism and operation
Reentrancy occurs when a contract or program transfers control to external code and that code calls back before the original operation finishes. The repeated entry may observe or modify an intermediate state that designers assumed was unavailable. Read-only reentrancy can also expose inconsistent values to dependent protocols without directly changing the vulnerable state. Mitigations include checks-effects-interactions, reentrancy guards, pull-based transfers, minimal external calls, invariant testing, and careful callback design. Developers must analyze all reachable entry points and integrations because local protection on one function may be insufficient. Reentrancy exploits unsafe intermediate state across control transfers, so defenses must cover all callbacks, functions, contracts, and dependent reads.
Practical payment example
A contract sends value through an external call before safely updating internal balances; a malicious callback re-enters the vulnerable function and withdraws again.
Operational checks
Assessment of Reentrancy Attack should trace an attack or weakness pattern that exploits external calls that re-enter vulnerable code before its previous execution has safely completed state updates from prerequisite and entry point through observable impact on the affected service. Prevention, detection, containment, and recovery for the Reentrancy attack path should be tested against the architecture associated with attack.
Distinctions and limits
Attacks can affect one function, multiple functions, contracts, tokens, or callbacks, and do not always involve a simple withdrawal loop. A theoretical weakness or scanner result involving attack should not be reported as exploitation without corroborating logs, transactions, or configuration evidence.
Related reading
Related definitions: withdrawal.
Example
A contract sends value through an external call before safely updating internal balances; a malicious callback re-enters the vulnerable function and withdraws again.
Comparison
Attacks can affect one function, multiple functions, contracts, tokens, or callbacks, and do not always involve a simple withdrawal loop. A theoretical weakness or scanner result involving attack should not be reported as exploitation without corroborating logs, transactions, or configuration evidence.
Key Takeaway
Reentrancy exploits unsafe intermediate state across control transfers, so defenses must cover all callbacks, functions, contracts, and dependent reads.
Sources
- OxaPay Documentation: Webhook — OxaPay (2026-07-30)
- Stripe Documentation: Webhooks — Stripe (2026-07-30)