Skip to main content
QUICK REVIEW

[Paper Review] Smart Contract Vulnerability Detection: From Pure Neural Network to Interpretable Graph Feature and Expert Pattern Fusion

Zhenguang Liu, Peng Qian|arXiv (Cornell University)|Jun 17, 2021
Blockchain Technology Applications and SecurityComputer Science20 references8 citations
TL;DR

This paper proposes a novel, explainable smart contract vulnerability detection system that fuses interpretable expert patterns with deep graph neural network features. By automatically extracting vulnerability-specific patterns and constructing a semantic code graph, the method uses an attentive multi-encoder network to jointly learn and interpret global and local features, achieving state-of-the-art accuracy (up to 90%) and providing fine-grained, human-readable explanations for predictions.

ABSTRACT

Smart contracts hold digital coins worth billions of dollars, their security issues have drawn extensive attention in the past years. Towards smart contract vulnerability detection, conventional methods heavily rely on fixed expert rules, leading to low accuracy and poor scalability. Recent deep learning approaches alleviate this issue but fail to encode useful expert knowledge. In this paper, we explore combining deep learning with expert patterns in an explainable fashion. Specifically, we develop automatic tools to extract expert patterns from the source code. We then cast the code into a semantic graph to extract deep graph features. Thereafter, the global graph feature and local expert patterns are fused to cooperate and approach the final prediction, while yielding their interpretable weights. Experiments are conducted on all available smart contracts with source code in two platforms, Ethereum and VNT Chain. Empirically, our system significantly outperforms state-of-the-art methods. Our code is released.

Motivation & Objective

  • To address the limitations of pure deep learning models in smart contract vulnerability detection, which lack interpretability and fail to incorporate expert knowledge.
  • To overcome the rigidity and low scalability of rule-based methods that rely on manually defined patterns.
  • To develop a hybrid approach that combines the expressive power of graph neural networks with the precision of expert-defined patterns in a unified, interpretable framework.
  • To enable model interpretability by assigning weighted contributions to both global graph features and local expert patterns for each prediction.
  • To set a new state-of-the-art in vulnerability detection accuracy while providing actionable insights into detection reasoning.

Proposed method

  • Automatically extract vulnerability-specific expert patterns from smart contract source code using custom analysis tools.
  • Transform each function’s control-flow and data-flow semantics into a semantic graph representation to capture rich program structure.
  • Apply a graph neural network (GNN) to learn deep, global representations from the semantic graph.
  • Design an attentive multi-encoder network that fuses the global GNN feature with local expert pattern features using learnable attention weights.
  • Train the end-to-end model to jointly optimize for detection accuracy and feature interpretability, producing weighted contributions for each input feature.
  • Use attention weights to explain predictions by highlighting which patterns or graph structures most influenced the final vulnerability classification.

Experimental results

Research questions

  • RQ1Can combining expert patterns with deep graph features improve the accuracy of smart contract vulnerability detection beyond pure neural networks?
  • RQ2How do the contributions of global graph features and local expert patterns compare in terms of predictive importance?
  • RQ3Can the model provide interpretable, human-readable explanations for its predictions by assigning meaningful weights to different features?
  • RQ4Does the fusion of expert knowledge and deep learning lead to better generalization and robustness against evasion attacks?
  • RQ5How does the model’s performance vary when key components (graph or patterns) are removed?

Key findings

  • The proposed method achieves state-of-the-art accuracy, improving from 84% to 90% on reentrancy vulnerabilities, from 83% to 87% on timestamp dependence, and from 75% to 80% on integer overflow.
  • The model’s attention mechanism assigns interpretable weights to both global graph features and local expert patterns, enabling clear explanation of detection decisions.
  • Removing the graph feature leads to a larger performance drop than removing expert patterns, indicating that global semantic structure is more critical than isolated patterns.
  • The model consistently outperforms its variants (AME-RG and AME-RP) across all epochs, confirming the necessity of combining both components.
  • The system successfully identifies the reentrancy vulnerability in The DAO-like contract by highlighting key patterns such as 'enoughBalance', 'callValueInvocation', and 'balanceDeduction' with high attention weights (0.23–0.26).
  • The method provides both fine-grained pattern-level explanations and a global overview of feature importance, offering practical insights for developers and auditors.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.