EFEVD: Enhanced Feature Extraction for Smart Contract Vulnerability Detection

Chi Jiang, Xihan Liu, Shenao Wang, Jinzhuo Liu, Yin ZhangIJCAI 2024

Introduction

Smart contracts are the foundational components of decentralized finance (DeFi), yet they present a unique security challenge: immutability. Once deployed to a blockchain, their code cannot be altered. Vulnerabilities, such as the infamous DAO reentrancy bug, can lead to catastrophic and irreversible financial losses.

Existing detection methodologies generally fall into two categories. Traditional analysis tools (static and dynamic) often suffer from high false-positive rates and struggle with complex runtime logic. Conversely, current deep learning (DL) models frequently analyze contracts in isolation or rely on manual "expert patterns" that fail to generalize. These models often overlook the broader context of similar contract behaviors and fail to bridge the gap between high-level classification ("is it broken?") and low-level localization ("where is it broken?").

Methodology

EFEVD (Enhanced Feature Extraction for Smart Contract Vulnerability Detection) introduces a sophisticated multi-stage pipeline designed to capture both local syntax and global semantic structures.

The EFEVD framework pipeline, illustrating the multi-stage process from input contracts to vulnerability classification and localization.

Hybrid Function Embedding

To process individual functions, EFEVD employs a hybrid architecture. It utilizes TextCNN to capture local, short-term syntactic patterns (like specific keywords) and Transformers to model long-distance dependencies and complex semantic relationships within the code.

Contract Graph and Community Features

The framework represents smart contracts as graphs where functions serve as nodes and inter-function calls represent edges, capturing the program's structural flow. A core innovation of EFEVD is Community Feature Extraction. By grouping contracts into "communities" based on semantic and syntactic similarity (derived from Abstract Syntax Trees), the model gains ecosystem-wide context. This allows the model to identify patterns that lead to bugs across similar code structures.

Multitask Learning (MTL)

EFEVD utilizes a shared architecture to perform two tasks simultaneously: Vulnerability Classification at the graph level and Vulnerability Localization at the node level. This multitask approach enables the model to learn shared features that benefit both tasks, creating a synergy where knowing the location of a bug informs the overall classification and vice versa.

Experimental Evaluation

The researchers evaluated EFEVD using a real-world dataset of 9,742 Ethereum smart contracts. The dataset includes four categories: Reentrancy, Timestamp dependency, Integer Overflow, and Secure (no vulnerability). Ground truth labels were established using the Slither tool and subsequently verified by human experts. The data was split using a standard 7:3 ratio for training and testing.

Results

EFEVD was benchmarked against traditional tools (SmartCheck, Oyente, Mythril) and advanced deep learning models (DR-GCN, AME, SMS).

Performance comparison of EFEVD against traditional analysis tools and state-of-the-art deep learning models across key metrics.

As shown in the results, EFEVD achieved a superior Accuracy of 89.53% and an F1-score of 91.18%. Most notably, the model achieved a Recall of 92.82%, representing a 10.12% relative boost over the previous state-of-the-art (SMS). In a security context, high recall is critical as it minimizes the number of undetected vulnerabilities. Ablation studies further confirmed that both the community features and the multitask framework are essential components of the model's high performance.

Conclusion

EFEVD demonstrates that incorporating "neighborhood" context and multitask learning significantly enhances the detection of smart contract vulnerabilities. While currently focused on four major vulnerability types, future work may expand the framework to address emerging attack vectors in the DeFi space and optimize the pipeline for real-time scanning of transaction mempools.

Summary updated

BibTeX
@inproceedings{jiang2024efevd,
  author = {Chi Jiang and Xihan Liu and Shenao Wang and Jinzhuo Liu and Yin Zhang},
  title = {{EFEVD: Enhanced Feature Extraction for Smart Contract Vulnerability Detection}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2024},
}
Figure