# Combining Graph Neural Networks with Expert Knowledge for Smart Contract Vulnerability Detection

arXiv: https://arxiv.org/abs/2107.11598 · HTML: https://mlsanity.com/paper/2107.11598/

## Key facts

- Cited by 34 papers in the map (data through 14 Oct 2026).
- Builds on 24 of its 64 references that are in the map.
- First posted on arXiv 24 Jul 2021.

## Builds on (most cited first, 24 of 24)

- [Semi-Supervised Classification with Graph Convolutional Networks](https://mlsanity.com/paper/1609.02907/) (2016)
- [Graph Attention Networks](https://mlsanity.com/paper/1710.10903/) (2017)
- [Neural Message Passing for Quantum Chemistry](https://mlsanity.com/paper/1704.01212/) (2017)
- [Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling](https://mlsanity.com/paper/1412.3555/) (2014)
- [Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering](https://mlsanity.com/paper/1606.09375/) (2016)
- [Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networks](https://mlsanity.com/paper/1909.03496/) (2019)
- [A Comprehensive Survey of Graph Embedding: Problems, Techniques and Applications](https://mlsanity.com/paper/1709.07604/) (2017)
- [Learning to Represent Programs with Graphs](https://mlsanity.com/paper/1711.00740/) (2017)
- [GaAN: Gated Attention Networks for Learning on Large and Spatiotemporal Graphs](https://mlsanity.com/paper/1803.07294/) (2018)
- [Adaptive Graph Convolutional Neural Networks](https://mlsanity.com/paper/1801.03226/) (2018)
- [Slither: A Static Analysis Framework For Smart Contracts](https://mlsanity.com/paper/1908.09878/) (2019)
- [Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detection](https://mlsanity.com/paper/1708.06525/) (2017)
- [Securify: Practical Security Analysis of Smart Contracts](https://mlsanity.com/paper/1806.01143/) (2018)
- [ContractFuzzer: Fuzzing Smart Contracts for Vulnerability Detection](https://mlsanity.com/paper/1807.03932/) (2018)
- [Finding The Greedy, Prodigal, and Suicidal Contracts at Scale](https://mlsanity.com/paper/1802.06038/) (2018)
- [Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attacks](https://mlsanity.com/paper/1812.05934/) (2018)
- [A Semantic Framework for the Security Analysis of Ethereum smart contracts](https://mlsanity.com/paper/1802.08660/) (2018)
- [Blockchain Technology Overview](https://mlsanity.com/paper/1906.11078/) (2019)
- [Learning to map source code to software vulnerability using code-as-a-graph](https://mlsanity.com/paper/2006.08614/) (2020)
- [Untangling Blockchain: A Data Processing View of Blockchain Systems](https://mlsanity.com/paper/1708.05665/) (2017)
- [Convolutional Neural Networks over Control Flow Graphs for Software Defect Prediction](https://mlsanity.com/paper/1802.04986/) (2018)
- [BLOCKBENCH: A Framework for Analyzing Private Blockchains](https://mlsanity.com/paper/1703.04057/) (2017)
- [Towards Safer Smart Contracts: A Sequence Learning Approach to Detecting Security Threats](https://mlsanity.com/paper/1811.06632/) (2018)
- [PD-ML-Lite: Private Distributed Machine Learning from Lighweight Cryptography](https://mlsanity.com/paper/1901.07986/) (2019)

## Built on by (most cited first, 30 of 34)

- [Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectives](https://mlsanity.com/paper/2310.01152/) (2023)
- [Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit](https://mlsanity.com/paper/2401.00288/) (2023)
- [2D Human Pose Estimation: A Survey](https://mlsanity.com/paper/2204.07370/) (2022)
- [FedRecAttack: Model Poisoning Attack to Federated Recommendation](https://mlsanity.com/paper/2204.01499/) (2022)
- [Causal Incremental Graph Convolution for Recommender System Retraining](https://mlsanity.com/paper/2108.06889/) (2021)
- [Uncertainty-Aware Graph Neural Networks: A Multi-Hop Evidence Fusion Approach](https://mlsanity.com/paper/2506.13083/) (2025)
- [Poison Attack and Defense on Deep Source Code Processing Models](https://mlsanity.com/paper/2210.17029/) (2022)
- [Link-Backdoor: Backdoor Attack on Link Prediction via Node Injection](https://mlsanity.com/paper/2208.06776/) (2022)
- [Use of Graph Neural Networks in Aiding Defensive Cyber Operations](https://mlsanity.com/paper/2401.05680/) (2024)
- [Graph Mining for Cybersecurity: A Survey](https://mlsanity.com/paper/2304.00485/) (2023)
- [A Survey of Source Code Representations for Machine Learning-Based Cybersecurity Tasks](https://mlsanity.com/paper/2403.10646/) (2024)
- [A Survey of Deep Learning Models for Structural Code Understanding](https://mlsanity.com/paper/2205.01293/) (2022)
- [MANDO: Multi-Level Heterogeneous Graph Embeddings for Fine-Grained Detection of Smart Contract Vulnerabilities](https://mlsanity.com/paper/2208.13252/) (2022)
- [Knowledge-guided Causal Intervention for Weakly-supervised Object Localization](https://mlsanity.com/paper/2301.01060/) (2023)
- [VulnSense: Efficient Vulnerability Detection in Ethereum Smart Contracts by Multimodal Learning with Graph Neural Network and Language Model](https://mlsanity.com/paper/2309.08474/) (2023)
- [The Role of Transformer Models in Advancing Blockchain Technology: A Systematic Survey](https://mlsanity.com/paper/2409.02139/) (2024)
- [Demystifying Bitcoin Address Behavior via Graph Neural Networks](https://mlsanity.com/paper/2211.14582/) (2022)
- [Machine Learning for Blockchain Data Analysis: Progress and Opportunities](https://mlsanity.com/paper/2404.18251/) (2024)
- [Vulnerability Detection in Ethereum Smart Contracts via Machine Learning: A Qualitative Analysis](https://mlsanity.com/paper/2407.18639/) (2024)
- [Detection Made Easy: Potentials of Large Language Models for Solidity Vulnerabilities](https://mlsanity.com/paper/2409.10574/) (2024)
- [Deep Smart Contract Intent Detection](https://mlsanity.com/paper/2211.10724/) (2022)
- [FastPacket: Towards Pre-trained Packets Embedding based on FastText for next-generation NIDS](https://mlsanity.com/paper/2209.14727/) (2022)
- [Who is Gambling? Finding Cryptocurrency Gamblers Using Multi-modal Retrieval Methods](https://mlsanity.com/paper/2211.14779/) (2022)
- [An experimental study in Real-time Facial Emotion Recognition on new 3RL dataset](https://mlsanity.com/paper/2304.03064/) (2023)
- [Vulnerability Detection Using Two-Stage Deep Learning Models](https://mlsanity.com/paper/2305.09673/) (2023)
- [Sequential Graph Neural Networks for Source Code Vulnerability Identification](https://mlsanity.com/paper/2306.05375/) (2023)
- [CONCORD: Towards a DSL for Configurable Graph Code Representation](https://mlsanity.com/paper/2401.17967/) (2024)
- [Vulnerability Detection in Smart Contracts: A Comprehensive Survey](https://mlsanity.com/paper/2407.07922/) (2024)
- [JANUS: A Difference-Oriented Analyzer For Financial Centralization Risks in Smart Contracts](https://mlsanity.com/paper/2412.03938/) (2024)
- [Knowledge Migration Framework for Smart Contract Vulnerability Detection](https://mlsanity.com/paper/2412.11175/) (2024)

## Abstract (arXiv)

Smart contract vulnerability detection draws extensive attention in recent years due to the substantial losses caused by hacker attacks. Existing efforts for contract security analysis heavily rely on rigid rules defined by experts, which are labor-intensive and non-scalable. More importantly, expert-defined rules tend to be error-prone and suffer the inherent risk of being cheated by crafty attackers. Recent researches focus on the symbolic execution and formal analysis of smart contracts for vulnerability detection, yet to achieve a precise and scalable solution. Although several methods have been proposed to detect vulnerabilities in smart contracts, there is still a lack of effort that considers combining expert-defined security patterns with deep neural networks. In this paper, we explore using graph neural networks and expert knowledge for smart contract vulnerability detection. Specifically, we cast the rich control- and data- flow semantics of the source code into a contract graph. To highlight the critical nodes in the graph, we further design a node elimination phase to normalize the graph. Then, we propose a novel temporal message propagation network to extract the graph feature from the normalized graph, and combine the graph feature with designed expert patterns to yield a final detection system. Extensive experiments are conducted on all the smart contracts that have source code in Ethereum and VNT Chain platforms. Empirical results show significant accuracy improvements over the state-of-the-art methods on three types of vulnerabilities, where the detection accuracy of our method reaches 89.15%, 89.02%, and 83.21% for reentrancy, timestamp dependence, and infinite loop vulnerabilities, respectively.
