Core Concepts
Reentrancy vulnerabilities in smart contracts have led to significant financial losses, but current detection tools suffer from high false positive rates and limited capability in finding truly exploitable vulnerabilities. This paper proposes BlockWatchdog, a tool that focuses on detecting reentrancy vulnerabilities by identifying attacker contracts that automatically exploit vulnerable contracts.
Abstract
The paper presents an empirical study that analyzes 281 attack incident reports to identify the characteristics of attacker contracts involved in reentrancy attacks. The study reveals three main types of reentrancy attacks: those exploiting the fallback function, those exploiting poor designs when using ERC tokens, and those exploiting user-defined interfaces.
Based on the insights from the empirical study, the authors propose BlockWatchdog, a tool that uses cross-contract static dataflow analysis to detect attacker contracts and the vulnerable contracts they target. BlockWatchdog first decompiles the contract bytecode to extract flow and external call information, then constructs the cross-contract control flow graph (xCFG) and cross-contract call graph (xCG) to perform taint analysis and identify attacker contracts.
The evaluation of BlockWatchdog on a ground-truth dataset of 18 attacker contracts shows a recall of 83.3%. When applied to a large-scale dataset of 421,889 Ethereum contracts, BlockWatchdog identified 113 true positive attacker contracts that targeted 159 victim contracts, leading to the theft of Ether and tokens valued at approximately 908.6 million USD. Only 18 of the 159 victim contracts could be detected by current reentrancy vulnerability detection tools.
Stats
The total financial loss caused by the true positive attacks identified by BlockWatchdog was 908.4 million USD, comprising approximately 840 Ethers (about 1.7 million USD) and tokens worth 906.9 million USD.
BlockWatchdog identified 40 zero-day attacker contracts and a total of 159 victim contracts targeted by the attacker contracts to perform reentrancy attacks.
Quotes
"Reentrancy, a notorious vulnerability in smart contracts, has led to millions of dollars in financial loss."
"Only 2.68% of contracts with reentrancy vulnerabilities can truly be exploited by hackers, and only 0.4% of the Ethers at stake could be exploited."
"Exploiting reentrancy vulnerabilities requires deploying malicious contracts that initiate callbacks to the victim contract."