Reentrancy Attack

Reentrancy Attack: Exploiting Function Recursion

Reentrancy attacks exploit smart contracts by repeatedly calling functions before previous executions complete. It’s like withdrawing money from an ATM that forgets to update your balance between transactions.

A reentrancy attack is a smart contract exploit where malicious contracts repeatedly call vulnerable functions before state changes are finalized, potentially draining funds or manipulating contract behavior. These attacks exploit the order of operations in smart contract execution.

How Reentrancy Attacks Work

Recursive calling involves malicious contracts that call back into vulnerable functions during the execution of those same functions, before state updates complete.

State manipulation occurs when contracts check balances or conditions that haven’t been updated yet, allowing attackers to perform actions multiple times.

Fund drainage happens when withdrawal functions can be called repeatedly before balance updates, enabling attackers to withdraw more than their actual holdings.

Reentrancy attack flow showing initial call, recursive callback, state inconsistency, and exploit completion

Real-World Examples

  • The DAO hack in 2016 used reentrancy to drain $60 million, leading to Ethereum’s hard fork
  • Various DeFi exploits have used reentrancy to steal millions from poorly secured protocols
  • Cream Finance lost $37 million to a reentrancy attack combined with other vulnerabilities

Why Beginners Should Care

Smart contract risk understanding helps evaluate protocol security and the importance of professional audits before using new platforms.

Prevention awareness shows why established protocols with battle-tested code tend to be safer than new, unaudited projects.

Recovery impossibility since blockchain transactions can’t be reversed, making prevention the only protection against reentrancy exploits.

Related Terms: Smart Contract, Smart Contract Audit, DeFi Security, Exploit

Back to Crypto Glossary

Similar Posts

  • Decentralized Computing

    Decentralized Computing: Distributed Processing PowerDecentralized computing distributes computational tasks across networks of independent computers rather than relying on centralized data centers. It's like having a supercomputer made of everyone's spare processing power.Decentralized computing refers to distributed systems where computational tasks are processed across multiple independent nodes rather than centralized servers or data centers. This creates more…

  • Bonding Curve

    Bonding Curve: Algorithmic Token Pricing Bonding curves use mathematical formulas to automatically price tokens based on supply. As more tokens get bought, prices increase predictably according to the curve’s formula. A bonding curve is an algorithmic pricing mechanism that determines token price based on token supply through a mathematical function. Prices increase as supply grows…

  • Dust

    Dust: Tiny Amounts That Clog Networks Dust refers to cryptocurrency amounts so small they’re not economically viable to spend due to transaction fees exceeding their value. It’s like having pennies that cost dollars to use. Dust consists of very small amounts of cryptocurrency that cost more in transaction fees to send than their actual value….

  • Atomic Swap

    Atomic Swap: Trustless Cross-Chain Trading Atomic swaps enable direct trading between different cryptocurrencies without exchanges or intermediaries. Either both trades complete successfully, or neither happens – no middle ground. An atomic swap is a smart contract technology that enables the exchange of cryptocurrencies from different blockchains without requiring a trusted third party. The swap either…

  • DEX Aggregator

    DEX Aggregator: Optimal Trading Route FinderDEX aggregators find the best prices across multiple decentralized exchanges for cryptocurrency trades. They're like price comparison websites that automatically execute trades at the best available rates.A DEX aggregator is a service that compares prices and liquidity across multiple decentralized exchanges to find optimal trading routes for cryptocurrency swaps. These platforms…

  • Blockchain

    Blockchain: The Unchangeable Digital Ledger Forget the hype – blockchain is simply a better way to keep records. It’s like a ledger book that everyone can see, but no one can cheat. Blockchain is a chain of digital records (blocks) that are linked together and secured using cryptography. Once information goes into a block, changing…