arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.16540cs.CRcs.AIcs.SE
收藏

使用边感知图注意力网络的 C/C++ 可解释漏洞检测

Explainable Vulnerability Detection in C/C++ Using Edge-Aware Graph Attention Networks

School of Computing, Ulster University, United Kingdom(计算学院,乌斯特大学,英国)

Radowanul Haque, Aftab Ali, Sally McClean, Naveed Khan

AI总结:

提出 ExplainVulD 图神经网络框架,利用 Code Property Graph、双通道嵌入与边感知注意力检测 C/C++ 漏洞,并通过类别加权损失缓解不平衡,在 ReVeal 上显著提升性能且提供代码级解释。

摘要:

源代码中的安全漏洞检测仍然具有挑战性,尤其是由于真实世界数据集中存在类别不平衡,脆弱函数的代表性不足。现有的基于学习的方法通常针对召回率进行优化,导致较高的误报率并降低其在开发工作流中的可用性。此外,许多方法缺乏可解释性,限制了它们与安全工作流的集成。本文提出 ExplainVulD,这是一个用于 C/C++ 代码漏洞检测的基于图的框架。该方法构建 Code Property Graphs,并使用同时捕获语义和结构信息的双通道嵌入来表示节点。这些表示由边感知注意力机制处理,该机制结合边类型嵌入以区分不同的程序关系。为解决类别不平衡问题,模型使用类别加权交叉熵损失进行训练。在 ReVeal 数据集上进行的 30 次独立运行中,ExplainVulD 取得了 88.25% 的平均准确率和 48.23% 的 F1 分数。与先前的基于学习的方法 ReVeal 模型相比,这些结果意味着准确率相对提升 4.6%,F1 分数相对提升 16.9%。该框架还优于静态分析工具,准确率相对提升 14.0% 至 14.1%,F1 分数相对提升 132.2% 至 201.2%。除了改进的检测性能之外,ExplainVulD 还通过识别每个函数中最具影响力的代码区域来产生可解释输出,从而支持安全分类中的透明度和信任。

英文摘要:

Detecting security vulnerabilities in source code remains challenging, particularly due to class imbalance in real-world datasets where vulnerable functions are under-represented. Existing learning-based methods often optimise for recall, leading to high false positive rates and reduced usability in development workflows. Furthermore, many approaches lack explainability, limiting their integration into security workflows. This paper presents ExplainVulD, a graph-based framework for vulnerability detection in C/C++ code. The method constructs Code Property Graphs and represents nodes using dual-channel embeddings that capture both semantic and structural information. These are processed by an edge-aware attention mechanism that incorporates edge-type embeddings to distinguish among program relations. To address class imbalance, the model is trained using class-weighted cross-entropy loss. ExplainVulD achieves a mean accuracy of 88.25 percent and an F1 score of 48.23 percent across 30 independent runs on the ReVeal dataset. These results represent relative improvements of 4.6 percent in accuracy and 16.9 percent in F1 score compared to the ReVeal model, a prior learning-based method. The framework also outperforms static analysis tools, with relative gains of 14.0 to 14.1 percent in accuracy and 132.2 to 201.2 percent in F1 score. Beyond improved detection performance, ExplainVulD produces explainable outputs by identifying the most influential code regions within each function, supporting transparency and trust in security triage.

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

↑