Smart Contract Reentrancy Attacks

Mechanism

Reentrancy occurs when an external contract call interrupts the execution flow before a function finishes updating its state. By leveraging a fallback function, an attacker forces the original contract to recursively execute a withdrawal or transfer sequence multiple times. This process depletes the contract balance before the underlying state variables accurately reflect the outflows.