作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程

• •    

结合多视角图表示与边类型信息的源代码漏洞检测方法

  • 发布日期:2026-03-24

A Source Code Vulnerability Detection Method Based on Multi-View Graph Representations and Edge-Type Information

  • Published:2026-03-24

摘要: 开源生态系统的快速发展加速了软件漏洞的传播,对信息安全构成了重大威胁,基于序列的深度学习方法在建模源代码的结构特征方面存在不足,而现有基于图神经网络的漏洞检测方法存在难以充分融合拓扑结构以及节点特征的问题。为应对这一挑战及解决现有基于深度学习方法的局限性,提出了一种结合多视角图表示与边类型信息的源代码漏洞检测方法(MVGE-Net)。在该方法中,源代码首先被转换为图表示,之后根据图中节点包含语义程度的不同,使用不同的预训练模型获取图嵌入,并从不同视角构建拓扑图、特征图和共享图以捕获互补信息,同时将边类型信息整合到节点特征中以增强模型表示能力。最后,通过轻量级门控机制融合提取的特征,并生成最终的漏洞预测结果。在两个基准数据集上的实验表明,MVGE-Net在准确率、精确率、召回率和F1值上均优于基线模型,其中,在FFMPeg+Qemu数据集上,MVGE-Net比经典基线方法(Devign)提升了9.14、9.13、1.75和5.74个百分点,定性与定量分析均验证了所提方法的有效性。总体而言,MVGE-Net有效克服了现有基于图神经网络方法的局限性,为漏洞检测任务提供了一种更为鲁棒且高效的解决方案。

Abstract: The rapid growth of the open-source ecosystem has accelerated the spread of software vulnerabilities, posing significant threats to information security. Sequence-based deep learning methods struggle to capture the structural characteristics of source code, while existing graph neural network–based approaches struggle to sufficiently integrate topological structures with node features. To address these challenges and overcome the limitations of current deep learning–based techniques, we propose MVGE-Net, a source code vulnerability detection method that integrates multi-view graph representations with edge-type information.In MVGE-Net, source code is first transformed into a graph representation. Then, depending on the semantic richness of the nodes, different pretrained models are utilized to obtain node embeddings. Subsequently, topology graphs, feature graphs, and shared graphs are constructed from multiple perspectives to capture complementary information. Meanwhile, edge-type information is incorporated into node features to enhance representational capability. Finally, a lightweight gating mechanism fuses the extracted features to generate the final vulnerability prediction.Experiments conducted on two benchmark datasets show that our method achieves improvements of 9.14, 9.13, 1.75, and 5.74 percentage points in Accuracy, Precision, Recall, and F1 score, respectively, compared with the baseline method Devign.Both qualitative and quantitative analyses confirm the effectiveness of the proposed approach. Overall, MVGE-Net successfully addresses the limitations of existing GNN-based methods and provides a more robust and efficient solution for vulnerability detection.