What Is a Reentrancy Attack in Smart Contracts?
A reentrancy attack occurs when an external call from a smart contract to an untrusted contract "re-enters" the original contract before the first execution is complete. This typically happens in withdrawal functions where the balance is updated after the external call to send Ether.
The malicious contract can call the withdrawal function again and again, draining the contract's funds. It is a critical vulnerability in blockchain security.