Abstract
As one of the representative blockchain platforms, Ethereum has attracted lots of attacks. Due to the existed financial loss, there is a pressing need to perform timely investigation and detect more attack instances. Though multiple systems have been proposed, they suffer from the scalability issue due to the following reasons. First, the tight coupling between malicious contract detection and blockchain data importing makes them infeasible to repeatedly detect different attacks. Second, the coarse-grained archive data makes them inefficient to replay transactions. Third, the separation between malicious contract detection and runtime state recovery consumes lots of storage. In this paper, we present the design of a scalable attack detection framework on Ethereum. It overcomes the scalability issue by saving the Ethereum state into a database and providing an efficient way to locate suspicious transactions. The saved state is fine-grained to support the replay of arbitrary transactions. The state is well-designed to avoid saving unnecessary state to optimize the storage consumption. We implement a prototype named EthScope and solve three technical challenges, i.e., incomplete Ethereum state, scalability, and extensibility. The performance evaluation shows that our system can solve the scalability issue, i.e., efficiently performing a large-scale analysis on billions of transactions, and a speedup of around 2,300x when replaying transactions. It also has lower storage consumption compared with existing systems. The result with three different types of information as inputs shows that our system can help an analyst understand attack behaviors and further detect more attacks. To engage the community, we will release our system and the dataset of detected attacks.
Introduction
Ethereum’s transparent nature makes it a prime target for smart contract exploits, leading to billions in financial losses. When a new attack is discovered, security researchers need to "time-travel"—looking back through years of blockchain history to find other instances of the same attack or understand how a specific exploit unfolded. However, existing tools face significant bottlenecks: tight coupling between data import and detection, coarse data granularity that slows down transaction replaying, and massive storage requirements for full archive states.
To address these challenges, we propose a two-step investigation workflow. Step I involves understanding the attack by locating suspicious transactions and analyzing their behaviors. Step II leverages this knowledge to detect more attack instances across the blockchain's history.
The EthScope Framework
We introduce EthScope, a highly scalable framework designed to decouple data ingestion from analysis. EthScope breaks the traditional bottlenecks through three core components:
- Data Aggregator: Instead of storing raw blocks, it extracts and saves a "fine-grained" state into an Elasticsearch database. It optimizes storage by only saving specific global variables touched by transactions.
- Replay Engine: This component pulls historical states from the database to re-execute transactions in isolation. By supporting parallel execution across multiple CPU cores, it achieves massive throughput.
- Instrumentation Framework: This allows analysts to write custom detection scripts (e.g., in JavaScript). To maintain performance, EthScope uses "on-demand" invocation, switching from the Ethereum Virtual Machine (EVM) to the script only at specific instrumentation points.
Key Insights and Methodology
EthScope’s efficiency stems from several architectural choices:
- Decoupling: Separating the ingest phase from analysis allows researchers to iterate on detection rules in seconds rather than days.
- Selective State Storage: By storing only "touched" variables, the system achieves higher information density and lower storage overhead compared to standard archive nodes.
- Dynamic Taint Analysis: The framework includes a built-in engine to track how sensitive data, such as block timestamps, influences contract control flow, aiding in the detection of complex vulnerabilities like bad randomness.
Evaluation and Results
We evaluated EthScope using the entire Ethereum blockchain from the Genesis block to block 10,400,000 (July 2020).
- Performance: EthScope replayed 100 transactions in approximately 1 second, compared to over 47 minutes for standard tools like JSTracer—a 2,300x speedup.
- Storage Efficiency: EthScope required only 1,844 GB to store the state for 10.5 million blocks. In contrast, previous state-of-the-art systems like TXSPECTOR required nearly 3,000 GB for a tiny fraction (0.2 million blocks) of that data.
- Real-World Impact: Our system successfully identified 272 malicious contracts exploiting bad randomness across 95 DApps and 2,347 true positive re-entrancy attack transactions with high accuracy.
Conclusion
EthScope demonstrates that decoupling analysis from blockchain data management is essential for scalable security auditing. While currently reliant on analyst-provided heuristics, future work will explore integrating machine learning for automated pattern flagging and symbolic execution to identify potential vulnerabilities before they are exploited. To support the community, we are releasing the EthScope system and our dataset of detected attacks.
Summary updated