Here are three specific DeFi smart contract vulnerabilities commonly identified in professional audit reports, described with technical precision suitable for inclusion in a formal security assessment.
1. Reentrancy Vulnerability in External Calls
Description:
A reentrancy vulnerability occurs when a smart contract makes an external call to another contract (e.g., transferring tokens to a user) before updating its internal state variables. If the external contract is malicious, it can re-enter the original contract through the same function during the execution of the external call, potentially bypassing checks that rely on the outdated state.
Specific Example:
Consider a withdraw() function in a lending protocol:
solidity
function withdraw(uint256 amount) public {
require(balances[msg.sender] >= amount, "Insufficient balance");
// VULNERABILITY: External call before state update
(bool success, ) = msg.sender.call{value: amount}("");
Top comments (0)