arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2212.14274cs.SE
收藏

用于漏洞检测的基于元路径的注意力图学习模型

Meta-Path Based Attentional Graph Learning Model for Vulnerability Detection

Xin-Cheng Wen, Cuiyun Gao, Jiaxin Ye, Yichen Li, Zhihong Tian, Yan Jia, Xuan Wang

AI总结:

针对代码结构图异构关系和长程依赖建模不足的问题,本文提出MAGNET,利用多粒度元路径图与分层注意力GNN提升漏洞检测性能。

摘要:

近年来,基于深度学习(DL)的方法已被广泛应用于代码漏洞检测。基于DL的方法通常从源代码中提取结构信息,例如代码结构图,并采用诸如图神经网络(GNNs)之类的神经网络来学习图表示。然而,这些方法未能考虑代码结构图中的异构关系,即异构关系意味着图中不同类型的边连接不同类型的节点,这可能会阻碍图表示学习。此外,由于代码结构图中的层级较深,这些方法在捕获长程依赖方面存在局限。在本文中,我们提出了一种用于代码漏洞检测的基于元路径的注意力图学习模型,称为MAGNET。MAGNET为每个代码片段构建多粒度元路径图,其中异构关系被表示为元路径,以表示结构信息。我们还提出了一种基于元路径的分层注意力图神经网络,用于捕获图中远距离节点之间的关系。我们在三个公共数据集上评估了MAGNET,结果表明,MAGNET在F1分数方面分别比最佳基线方法高出6.32%、21.50%和25.40%。MAGNET在检测Top-25最危险的通用弱点枚举(CWEs)方面也取得了所有基线方法中的最佳性能,进一步证明了其在漏洞检测中的有效性。

英文摘要:

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 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑