Dual-view Aware Smart Contract Vulnerability Detection for Ethereum

Jiacheng Yao, Maolin Wang, Wanqi Chen, Chengxiang Jin, Jiajun Zhou, Shanqing Yu, Qi XuanarXiv 2024 · DOI

Smart contracts are the backbone of decentralized finance (DeFi), yet their immutability makes them high-stakes targets for attackers. A single vulnerability can lead to irreversible financial losses, as seen in the DAO hack or the Poly Network exploit. To address this, researchers have developed DVDet, a novel "dual-view" framework that detects vulnerabilities by analyzing both high-level source code and low-level bytecode.

The Challenge of Smart Contract Security

Existing detection methods typically fall into two categories, each with significant drawbacks:

  1. Traditional Tools: Static analysis, symbolic execution, and fuzzing are often slow and prone to "path explosion," leading to high false-positive rates.
  2. Deep Learning Models: While fast, these models usually focus on a single perspective. Models analyzing only source code miss the actual execution logic, while those analyzing only bytecode lose the developer's semantic intent and variable names.

DVDet overcomes these limitations by fusing both perspectives into a single, intelligent detector.

The DVDet Framework

DVDet operates through two parallel channels that capture the "intent" of the developer and the "reality" of the Ethereum Virtual Machine (EVM).

The overall architecture of DVDet, showing the parallel processing of Solidity source code and EVM bytecode.

1. Source-code Aware Channel

This channel converts Solidity code into an Abstract Syntax Tree (AST). Unlike standard models that treat all code nodes equally, DVDet introduces a weighted approach. Nodes are categorized into "Core" (e.g., call.value()), "Sub-core" (e.g., msg.sender), "Auxiliary," and "Peripheral."

Node categorization within the source code to identify critical logic structures like core nodes and sub-core nodes.

By building a weighted graph where edges between critical nodes are strengthened, the model uses an Edge-aware Graph Attention Network (E-GAT) to capture complex logical relationships.

2. Bytecode Aware Channel

Simultaneously, the bytecode is decompiled into opcodes and organized into a Control Flow Graph (CFG). Paths are extracted using a depth-first search and fed into HyperAGRU, a modified Gated Recurrent Unit with an attention mechanism. This allows the model to prioritize critical instructions in long execution sequences without being overwhelmed by "noise."

3. Feature Fusion

The features from both channels are concatenated and processed by a Multi-Layer Perceptron (MLP) to classify the contract as "Normal" or identify specific vulnerabilities such as Reentrancy, Low-level Calls, or Broken Access Control.

Experimental Results

The researchers trained DVDet on a dataset of 35,000 contracts, using a consensus voting mechanism from five established tools (Slither, Mythril, Oyente, Osiris, and Securify) to ensure high-quality labels.

  • Accuracy: DVDet achieved 84.5% accuracy in identifying specific vulnerability types and 90.74% in general detection, significantly outperforming traditional symbolic execution tools like Conkas (61.9%).
  • Efficiency: DVDet is designed for real-time scanning. It analyzes a contract in just 0.14 seconds, making it over 200 times faster than Mythril, which averaged 31.64 seconds per contract.

Conclusion

By combining the semantic richness of source code with the execution logic of bytecode, DVDet provides a more comprehensive and efficient solution for blockchain security. While the model currently relies on labels from existing tools, its speed and accuracy represent a significant step forward in the automated protection of the Ethereum ecosystem.

Summary updated

BibTeX
@misc{yao2024dual,
  author = {Jiacheng Yao and Maolin Wang and Wanqi Chen and Chengxiang Jin and Jiajun Zhou and Shanqing Yu and Qi Xuan},
  title = {{Dual-view Aware Smart Contract Vulnerability Detection for Ethereum}},
  year = {2024},
  eprint = {2407.00336},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.00336},
}
Figure