Abstract
Front-running has become a pervasive threat in the Ethereum ecosystem, yet the lack of a comprehensive, localized benchmark has hindered the development and evaluation of vulnerability detection tools. This paper presents a high-precision algorithm for mining real-world front-running attacks and a dynamic taint analysis method for pinpointing vulnerable code. By analyzing 800,000 Ethereum blocks, we constructed $B^A$, a benchmark of 513 real-world attacks. Our evaluation of seven state-of-the-art detectors reveals a significant performance gap, with the best tool achieving only 6.04% recall, primarily due to limitations in inter-contract analysis and token-based profit detection.
Introduction
In the "Dark Forest" of the Ethereum blockchain, front-running is a predatory practice where attackers observe pending transactions in the mempool and "jump the line" by paying higher gas fees. By executing their transactions first, they manipulate the state of smart contracts to steal profits intended for the original users. While numerous tools have been developed to detect these vulnerabilities, their effectiveness has remained largely unquantified due to the absence of a ground-truth benchmark that provides both real-world examples and precise code localization.
Methodology
To address this gap, we introduced two novel technical components:
1. Generic Attack Mining
Unlike previous studies that relied on specific templates (e.g., Uniswap swaps), our algorithm uses a generic state-comparison model. It compares an Attack Scenario (the actual transaction order) against a simulated Attack-Free Scenario (the state if the attacker had not intervened). If the attacker gained assets and the victim lost assets in the first scenario compared to the second, the sequence is flagged as an attack. This method identified 24.42x more attacks than previous heuristic-based approaches.
2. Vulnerability Localization via Dynamic Taint Analysis
To identify the specific "buggy" code, we utilize dynamic taint analysis. Data modified by the attacker but subsequently read by the victim is treated as a taint source. We track the flow of this data through the victim's transaction to the taint sink—the point where the victim’s profit is calculated or transferred. The instructions along this influence trace are labeled as the vulnerability, reducing the amount of code marked as "vulnerable" by 99.66% compared to naive methods.
Dataset and Benchmark Construction
We analyzed 800,000 blocks on the Ethereum mainnet (blocks 13M to 13.8M). The mining process identified a massive scale of activity, which we categorized into three primary types: Displacement, Insertion, and Suppression.
From the 188,700 attacks mined, we constructed $B^A$, a refined benchmark consisting of 513 real-world attacks involving 235 distinct smart contracts with verified source code on Etherscan. This benchmark serves as the first large-scale, localized dataset for evaluating front-running detectors.
Key Insights and Evaluation
We tested seven state-of-the-art tools, including Oyente, Mythril, and Securify, against the $B^A$ benchmark. The results highlight several critical deficiencies in current detection technology:
- The Recall Gap: Most tools achieved 0% recall, and the top performer, Securify, reached only 6.04%. This indicates that current tools miss over 94% of real-world bugs.
- Token Blindness: Many detectors only monitor Ether transfers. However, a significant portion of front-running involves ERC20 tokens. Tools that do not support token-based profit analysis are inherently limited.
- Inter-Contract Blind Spots: Vulnerabilities often arise from complex interactions between multiple contracts. Most current tools analyze contracts in isolation, failing to capture these cross-contract dependencies.
Conclusion and Future Work
Our findings demonstrate that existing vulnerability detectors are largely ineffective against real-world front-running attacks. The high precision of our mining algorithm (98.69%) and the localization capabilities of our taint analysis provide a path forward for developing more robust tools. Future work should focus on incorporating "Attacker Gain/Victim Loss" properties as detection oracles and optimizing mining algorithms for real-time blockchain monitoring.
Summary updated