Reentrancy Exploit
A reentrancy exploit is a specific type of smart contract vulnerability where an attacker repeatedly calls a function before the previous execution has finished, allowing them to withdraw funds or alter state multiple times. This occurs when a contract sends funds to an external address before updating its internal balance or state.
The external address can trigger a fallback function that calls the original contract again, tricking it into believing the previous withdrawal never happened. This loop continues until the contract's balance is drained.
Reentrancy has been responsible for some of the largest losses in DeFi history. Modern development practices mitigate this risk by using mutexes or state-changing patterns that ensure all internal updates are completed before any external calls are made.
However, as protocols become more complex and cross-chain interactions increase, the potential for new, more subtle forms of reentrancy remains a constant threat that developers must actively monitor and defend against.