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

  • Merkle Tree

    Merkle Tree: Efficient Data Verification Merkle trees enable efficient verification of large datasets without downloading everything. They’re like having a fingerprint for an entire library that proves any book belongs. A Merkle tree is a binary tree structure where each leaf represents a data element and each branch contains cryptographic hashes of its children. The…

  • Transaction

    Transaction: Moving Value on the BlockchainA cryptocurrency transaction transfers value from one address to another on a blockchain network. It's like writing a check, but with mathematical guarantees instead of trust.A transaction is a digitally signed transfer of cryptocurrency from one wallet address to another, recorded permanently on the blockchain. Every transaction includes sender information, recipient…

  • Rollups

    Rollups: Scaling Through Bundling Rollups process hundreds of transactions off-chain then bundle the results into single on-chain transactions. It’s like carpooling for blockchain transactions – everyone shares the gas costs. Rollups are Layer 2 scaling solutions that execute transactions off the main blockchain but post transaction data on-chain for security. They inherit the security of…

  • Gas Fees

    Gas Fees: The Cost of Using Ethereum Gas fees are the tolls you pay to use Ethereum. Sometimes they’re pennies, sometimes they’re hundreds of dollars. Welcome to decentralized computing. Gas fees are transaction costs paid to miners or validators for processing transactions on blockchain networks. Think of gas as the fuel needed to power your…

  • Account Abstraction

    Account Abstraction: Smart Contract Wallets Account abstraction turns wallets into programmable smart contracts with custom logic for transaction validation. It’s like upgrading from a basic calculator to a full computer. Account abstraction allows user accounts to be controlled by smart contract code rather than simple private key signatures. This enables programmable wallets with custom authentication,…

  • Transaction Fees

    Transaction Fees: Network Processing CostsTransaction fees are payments made to network validators for processing and confirming cryptocurrency transactions. They're like postage stamps that you need to attach to letters, except the cost varies depending on how quickly you want your mail delivered.Transaction fees refer to payments made to miners, validators, or network operators who process…