Skip to main content

How Does a Reentrancy Attack Specifically Exploit Smart Contract Logic?

A reentrancy attack occurs when an external call from Contract A to Contract B is made, and Contract B then calls back into Contract A before A has finished updating its state, specifically the balance. This allows the attacker to recursively withdraw funds multiple times from the victim contract before the initial withdrawal transaction completes and the balance is properly reduced.

The classic defense involves using the Checks-Effects-Interactions pattern to update the state before making external calls.

Provide an Example of How Two Functions Might Share a State That Could Be Exploited
How Does a Reentrancy Attack Relate to the DAO Hack?
What Role Does the CALL Opcode Play in Enabling Reentrancy?
What Are the Differences between Single-Function and Cross-Function Reentrancy Attacks?