Here are three common DeFi smart contract vulnerabilities, along with specific detection methods and techniques.
1. Reentrancy Attack
Description:
An attacker calls a function in a smart contract that sends Ether to an external address. Before the state of the first call is updated (e.g., before the user’s balance is decreased), the external call triggers a fallback function at the attacker’s address, which re-enters the same vulnerable function. This allows the attacker to drain funds multiple times before the contract’s state is properly updated.
How to Detect:
-
Static Analysis Tools:
-
Slither: Use the
reentrancy-ethandreentrancy-no-ethdetectors. Example:
slither . --detect reentrancy-
Mythril: Run
mythril explore --function-name withdraw --address <contract_address>. Mythril uses symbolic execution
-
Slither: Use the
Top comments (0)