DEV Community

Nexus Intelligence Research
Nexus Intelligence Research

Posted on

DeFi Smart Contract Vulnerabilities Audit Guide

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 audit document.


1. Reentrancy via Unchecked External Calls (CWE-693)

Description:

Reentrancy occurs when a smart contract makes an external call to an untrusted address before updating its internal state, allowing the external contract to re-enter the vulnerable function before the initial transaction completes. In DeFi, this is particularly dangerous in lending protocols, token swaps, or payout functions where ETH or ERC-20 tokens are transferred out before balances are debited.

Specific Example:

A lending protocol’s withdraw() function transfers the user’s balance via IERC20(underlying).transfer(user, amount) before updating the user’s internal balance ledger (balances[user] -= amount). A malicious contract can implement an onERC20Received() hook (or use a callback

Top comments (0)