Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

Cross-Contract Reentrancy

1 min read
Pronunciation
[kraws-kon-traakt ree-en-tran-see]
Analogy
Like an office clerk handing a form to another department, which then sneaks back and changes the original form before the clerk finishes processing.
Definition
A vulnerability where a smart contract calls an external contract which then re‑enters the original contract before the first invocation completes, potentially manipulating state in unexpected ways.
Key Points Intro
Cross‑contract reentrancy exploits inconsistent state updates across contract calls.
Key Points

Reentrant call: External call invokes original function again.

State inconsistency: Original contract’s variables not yet updated.

Attack vector: Drain funds or corrupt data.

Mitigation: Use checks‑effects‑interactions pattern and reentrancy guards.

Example
A malicious ERC‑777 token contract reenters a vulnerable DeFi lending contract’s `withdraw()` before balance is decremented, allowing multiple withdrawals.
Technical Deep Dive
Vulnerability arises when `external.call()` is used before updating internal balances. Reentrancy guard (`mutex`) or `transfer()` (2300 gas stipend) can prevent nested calls. Static analysis tools detect `call` patterns lacking guards.
Security Warning
Unpatched reentrancy bugs have led to multi‑million dollar losses; always audit and include guard modifiers.
Caveat
Gas stipend mitigations are brittle; prefer explicit locks over gas‑based defenses.

Cross-Contract Reentrancy - Related Articles

No related articles for this term.