Meta-Path Based Attentional Graph Learning Model for Vulnerability Detection

by   Xin-Cheng Wen, et al.

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. However, these methods do not consider the heterogeneous relations in the code structure graph, i.e., different types of nodes and edges, 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 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.


page 1

page 2

page 3

page 4


Vulnerability Detection with Graph Simplification and Enhanced Graph Representation Learning

Prior studies have demonstrated the effectiveness of Deep Learning (DL) ...

Meta-path Free Semi-supervised Learning for Heterogeneous Networks

Graph neural networks (GNNs) have been widely used in representation lea...

An Attention-based Graph Neural Network for Heterogeneous Structural Learning

In this paper, we focus on graph representation learning of heterogeneou...

Learning to map source code to software vulnerability using code-as-a-graph

We explore the applicability of Graph Neural Networks in learning the nu...

Motif Enhanced Recommendation over Heterogeneous Information Network

Heterogeneous Information Networks (HIN) has been widely used in recomme...

R-GSN: The Relation-based Graph Similar Network for Heterogeneous Graph

Heterogeneous graph is a kind of data structure widely existing in real ...

Learning to Represent Programs with Code Hierarchies

Graph neural networks have been shown to produce impressive results for ...

Please sign up or login with your details

Forgot password? Click here to reset