Here are three specific DeFi smart contract vulnerabilities commonly identified in professional security audits, described with technical precision suitable for an audit report.
1. Reentrancy Attack via Unprotected State Mutation (CEI Pattern Violation)
Description:
This vulnerability occurs when a contract function modifies its internal state (e.g., updating balances or mapping data) after making an external call to an untrusted address. An attacker can exploit this by deploying a malicious contract that, upon receiving the external call, re-enters the vulnerable function before the state update is completed.
Technical Specifics:
- Vulnerable Code Pattern:
solidity
function withdraw(uint256 amount) external {
// 1. External Call: Sends ETH to user
(bool success, ) = msg.sender.call{value: amount}("");
require(success, "Transfer failed");
// 2. State Change: Updates balance *
Top comments (0)