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

  • Cold Storage

    Cold Storage: Maximum Security for Crypto Assets Cold storage keeps cryptocurrency private keys completely offline, away from any internet connection. It’s the digital equivalent of storing gold bars in a bank vault rather than your wallet. Cold storage refers to keeping cryptocurrency private keys on devices or media that have never been connected to the…

  • Scalability

    Scalability: Handling Growing Network DemandScalability refers to a blockchain network's ability to handle increasing transaction volumes without degrading performance or significantly increasing costs. It's like building highways that don't get congested as more cars use them.Scalability describes how well blockchain networks can accommodate growing user bases and transaction volumes while maintaining reasonable fees and confirmation…

  • Smart Contract Analysis

    Smart Contract Analysis: Code Security EvaluationSmart contract analysis involves examining blockchain code for vulnerabilities, bugs, and security issues before deployment. It's like having a building inspector check the foundation before construction begins.Smart contract analysis refers to the systematic examination of smart contract code to identify security vulnerabilities, logic errors, and potential attack vectors. This process helps…

  • Session Keys

    Session Keys: Temporary Wallet Permissions Session keys provide temporary, limited permissions for applications to perform specific actions without exposing main wallet private keys. It’s like giving valet keys instead of your full car keys. Session keys are temporary cryptographic keys that grant limited permissions to applications for specific time periods or transaction types. They enable…

  • Self-Sovereign Identity

    Self-Sovereign Identity: You Own Your Digital SelfSelf-sovereign identity puts you in complete control of your personal data and digital credentials. It's like having a passport that you issue and manage yourself, without needing government approval.Self-sovereign identity (SSI) is a digital identity model where individuals have complete control over their personal data, credentials, and identity verification…

  • L2 Sequencer

    L2 Sequencer: Transaction Ordering Engine L2 sequencers determine transaction order on Layer 2 networks, controlling which transactions get included and how they’re arranged. They’re like traffic controllers for blockchain highways. An L2 sequencer is a specialized node that collects, orders, and batches transactions for Layer 2 networks before submitting them to the main blockchain. Sequencers…