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

  • Collateral

    Collateral: Security for Borrowed FundsCollateral is an asset pledged as security for a loan that can be seized if the borrower fails to repay. In crypto, it's typically cryptocurrency deposited to secure borrowing positions.Collateral refers to assets deposited as security for loans, with the understanding that lenders can seize these assets if borrowers default on…

  • Restaking

    Restaking: Double-Duty for Staked Assets Restaking allows already-staked cryptocurrency to secure additional networks and earn extra rewards. It’s like getting paid twice for the same job, but with twice the risk. Restaking is a mechanism that allows staked cryptocurrency to simultaneously secure multiple networks or protocols, earning additional rewards beyond the base staking yield. Validators…

  • 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…

  • 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…

  • Supply Schedule

    Supply Schedule: Token Issuance TimelineA supply schedule defines when and how many new tokens will be created over time. It's like a release calendar that shows exactly when new cryptocurrency will enter circulation.A supply schedule is a predetermined plan that specifies the timing and quantity of new token issuance over time. This schedule provides transparency about…

  • Collection

    Collection: Grouped NFT SeriesA collection is a group of related NFTs that share common themes, artwork, or attributes. It's like a series of trading cards or stamps that belong to the same set.A collection refers to a group of related NFTs that share common characteristics, themes, or attributes, typically created by the same artist or…