Here are three specific DeFi smart contract vulnerabilities suitable for inclusion in a professional audit report. Each entry follows a standard vulnerability reporting structure: Title, Description, Impact, and Recommended Mitigation.
1. Reentrancy in Callback Functions (CWE-201)
Description:
The withdraw() function in the LiquidityPool contract allows users to claim their liquidity shares. The function performs the following sequence:
- Calculates the user’s balance.
- Sends ETH to the user via
call{value: amount}(_user). - Updates the user’s balance in the internal state variable
balances[_user] = 0.
Because the external call to _user occurs before the state update, a malicious contract can re-enter the withdraw() function during the execution of the receive() or fallback() function. If the external contract calls withdraw() again before
Top comments (0)