DeFi Smart Contract Vulnerabilities Audit Guide
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 Vulnerability (CWE
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 Vulnerability (CWE-207)
Description:
Reentrancy occurs when an external smart contract call is made before the internal state changes associated with that call are complete. If the called contract is malicious, it can re-enter the original contract and execute the vulnerable function again before the state update, leading to duplicate withdrawals or state corruption.
Specific Example:
A withdraw() function transfers ETH to the user via address(user).call{value: amount}("") before updating the userβs balance in the contractβs storage mapping (balances[user] -= amount). A malicious user can deploy a contract that, upon receiving ETH, calls withdraw() again. Since the balance hasnβt been decremented yet, the second call also sees the full balance and succeeds, draining the contract.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.