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

  • Slashing Conditions

    Slashing Conditions: Validator Penalty Rules Slashing conditions define specific behaviors that result in validators losing staked funds as punishment for malicious or negligent actions. They’re the rules of engagement for network security. Slashing conditions are predetermined criteria that trigger automatic penalties for validators who violate network consensus rules or behave maliciously. These penalties involve destroying…

  • Total Value Locked (TVL)

    Total Value Locked (TVL): DeFi’s Scorecard TVL measures how much money is deposited in DeFi protocols. It’s like measuring the size of a bank by its total deposits – bigger usually means more trust and activity. Total Value Locked (TVL) is the aggregate value of all assets deposited in a DeFi protocol or across the…

  • Premium

    Premium: Price Above Fair ValuePremium refers to the amount by which an asset's price exceeds its underlying value or reference price. It's like paying extra for convenience or brand name compared to the basic product cost.Premium is the additional amount paid above an asset's fair value, net asset value, or reference price. In cryptocurrency markets, premiums…

  • Seed Phrase

    Seed Phrase: Your Crypto Recovery Backup Your seed phrase is your crypto’s ultimate backup. More important than passwords, more valuable than the device itself. A seed phrase is a list of 12-24 words that can restore access to all your cryptocurrency wallets and funds. It’s your master key – lose it and your crypto is…

  • Light Client

    Light Client: Lightweight Blockchain AccessA light client provides blockchain access without downloading the entire blockchain history. It's like having a summary instead of reading the entire encyclopedia.A light client is a blockchain node that maintains network connectivity and basic functionality without storing the complete blockchain history or state. This enables resource-constrained devices to participate in blockchain…

  • DAO (Decentralized Autonomous Organization)

    DAO (Decentralized Autonomous Organization): Democracy Meets Code DAOs are how crypto communities govern themselves without traditional corporate structures. They’re experiments in digital democracy where token holders vote on everything. A Decentralized Autonomous Organization (DAO) is a community-governed entity where decisions are made collectively by token holders through blockchain-based voting. Smart contracts execute the community’s decisions…