Reentrancy Attack Analysis
Reentrancy attack analysis focuses on identifying a specific vulnerability where a function makes an external call to an untrusted contract before updating its own internal state. This allows the untrusted contract to recursively call back into the original function, repeatedly executing code and draining funds before the initial transaction completes.
This is a classic vulnerability in Ethereum-based protocols that has led to significant historical losses. Auditors use tools and manual review to ensure that state changes, such as balance updates, occur before any external interactions.
Implementing checks-effects-interactions patterns and using reentrancy guards are standard defenses. Understanding this attack vector is foundational for anyone building or auditing smart contracts that handle user deposits or transfers.