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 in Callback Functions (CWE-252)
Vulnerability Description:
This vulnerability occurs when a contract makes an external call to an untrusted address (e.g., msg.sender) before updating its internal state variables. If the external contract is malicious, it can re-enter the vulnerable function before the state update is complete, allowing an attacker to repeatedly execute the logic with the same initial state.
Specific Scenario:
In a lending protocol, the withdraw() function allows users to claim accrued interest. The vulnerable implementation:
- Calculates the user’s interest balance.
- Sends the ETH via
address(user).call{value: amount}(""). - Only after the external call does it update
userInterest[user] = 0.
Top comments (0)