[论文解读] Devign: Effective Vulnerability Identification by Learning Comprehensive Program Semantics via Graph Neural Networks
Devign 使用一个图神经网络,结合代码的综合表示(AST、CFG、DFG,以及顺序边)来在真实的 C 项目中检测易受攻击的函数,超越基线并展示对 CVEs 的适用性。
Vulnerability identification is crucial to protect the software systems from attacks for cyber security. It is especially important to localize the vulnerable functions among the source code to facilitate the fix. However, it is a challenging and tedious process, and also requires specialized security expertise. Inspired by the work on manually-defined patterns of vulnerabilities from various code representation graphs and the recent advance on graph neural networks, we propose Devign, a general graph neural network based model for graph-level classification through learning on a rich set of code semantic representations. It includes a novel Conv module to efficiently extract useful features in the learned rich node representations for graph-level classification. The model is trained over manually labeled datasets built on 4 diversified large-scale open-source C projects that incorporate high complexity and variety of real source code instead of synthesis code used in previous works. The results of the extensive evaluation on the datasets demonstrate that Devign outperforms the state of the arts significantly with an average of 10.51% higher accuracy and 8.68\% F1 score, increases averagely 4.66% accuracy and 6.37% F1 by the Conv module.
研究动机与目标
- 通过学习超越扁平代码表示的全面程序语义,推动自动漏洞检测。
- 提出一个基于图的模型,将多种代码表示融合以捕捉多样的漏洞模式。
- 证明一个带门控的图递归网络(GGRN)结合卷积模块在真实数据集上相对于基线具有更高的准确率和 F1。
- 分享来自四个大型 C 库的人工标注数据集,以评估漏洞识别模型。
提出的方法
- 将一个函数编码为联合图 g(V, X, A),集成 AST、CFG、DFG(简化为 DFG_R/DFG_W/DFG_C)以及自然代码序列边。
- 使用一个门控图递归网络在多类型边上传播并编码节点特征,随时间步 T,得到最终节点嵌入 H^(T)。
- 应用一个 Conv 模块,采用连续的一维卷积和最大池化,从 [H^(T), X] 和最终节点特征中提取图级特征,随后接一个 MLP,并与另一个 MLP 做逐元素乘积,最后得到 Sigmoid 图级预测。
- 通过将词向量 code embedding 与类型编码拼接,表示初始节点特征;端到端训练,使用交叉熵损失并结合正则化。
- 构建来自 AST、CFG、DFG(简化为 LastRead/LastWrite/ComputedFrom)以及 Natural Code Sequence 的综合代码图,以捕捉多样的漏洞线索。
- 在 Linux Kernel、QEMU、Wireshark、FFmpeg 的人工标注数据上训练 Devign,并对比基线方法包括 XGBoost、BiLSTM 变体、CNN,以及 Gated Graph Recurrent Network (GGRN)。
实验结果
研究问题
- RQ1Devign 相对于在真实开源项目上最先进的学习型漏洞识别方法的表现如何?
- RQ2Conv 模块是否在仅使用聚合节点特征的 plain GGRN 上提升图级分类?
- RQ3综合图(多表示)是否在漏洞检测中优于单边表示?
- RQ4在不平衡数据和对最近 CVEs 的表现上,Devign 相比静态分析工具如何?
- RQ5使用综合代码语义进行跨项目漏洞识别的影响如何?
主要发现
- Devign(Composite)在四个数据集上的平均准确率比基线方法高出 10.51%,F1 提高 8.68%。
- Conv 模块在平均准确率上比简单节点聚合的 GGRN 提升 4.66%,F1 提升 6.37%。
- 使用综合图通常提升图级预测,相较单边图,平均 F1 增益约为 2.69%,在某些边类型上获得更高增益。
- 在不平衡数据上,Devign 相对于静态分析工具(Cppcheck、Flawfinder,以及一个隐藏的商业工具)在 F1 分数上的提升显著(文本中给出为高出 27.99)。
- 当在 40 个最新 CVEs 上测试时,Devign 的平均准确率达到 74.11%,显示对零日漏洞检测的实际适用性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。