Meta-Path Based Attentional Graph Learning Model for Vulnerability Detection

Xin-Cheng Wen, Cuiyun Gao, Jiaxin Ye, Yichen Li, Zhihong Tian +2 more
12/29/2022
cs.SE
gnn

Official code: Xin-Cheng-Wen/MAGNET (15 stars, Python, MIT, last commit 2022-12-19).

Abstract

In recent years, deep learning (DL)-based methods have been widely used in code vulnerability detection. The DL-based methods typically extract structural information from source code, e.g., code structure graph, and adopt neural networks such as Graph Neural Networks (GNNs) to learn the graph representations.

Show full abstract

However, these methods fail to consider the heterogeneous relations in the code structure graph, i.e., the heterogeneous relations mean that the different types of edges connect different types of nodes in the graph, which may obstruct the graph representation learning. Besides, these methods are limited in capturing long-range dependencies due to the deep levels in the code structure graph. In this paper, we propose a Meta-path based Attentional Graph learning model for code vulNErability deTection, called MAGNET. MAGNET constructs a multi-granularity meta-path graph for each code snippet, in which the heterogeneous relations are denoted as meta-paths to represent the structural information. A meta-path based hierarchical attentional graph neural network is also proposed to capture the relations between distant nodes in the graph. We evaluate MAGNET on three public datasets and the results show that MAGNET outperforms the best baseline method in terms of F1 score by 6.32%, 21.50%, and 25.40%, respectively. MAGNET also achieves the best performance among all the baseline methods in detecting Top-25 most dangerous Common Weakness Enumerations (CWEs), further demonstrating its effectiveness in vulnerability detection.

View on arXivView PDF

Code Implementations(1)

MIT

Meta-Path Based Attentional Graph Learning Model for Vulnerability Detection

152PythonDec 19, 20223 years agoMIT

Similar Papers

Cite this paper

@article{wen2022metapath,
  title  = {Meta-Path Based Attentional Graph Learning Model for Vulnerability Detection},
  author = {Xin-Cheng Wen and Cuiyun Gao and Jiaxin Ye and Yichen Li and Zhihong Tian and Yan Jia and Xuan Wang},
  year   = {2022},
  eprint = {2212.14274},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2212.14274}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2212.14274.svg)](https://codeofpaper.com/paper/2212.14274)

Discussion