Skip to main content
QUICK REVIEW

[论文解读] An Empirical Study of Deep Learning Models for Vulnerability Detection

Benjamin Steenhoek, Md. Mahbubur Rahman|arXiv (Cornell University)|Dec 15, 2022
Software Engineering Research被引用 7
一句话总结

本文对 Devign 和 MSR 数据集上 9 种最先进的深度学习模型在漏洞检测中的表现进行了全面的实证研究。研究考察了模型一致性、训练数据的影响以及可解释性,发现模型间的一致性较低(仅 7% 的共识),运行间变异性较高(34.9% 的不一致),且针对特定漏洞类型的模型优于通用模型,性能在约 1,000 个漏洞样本后趋于稳定。本研究提供了可复现的代码、数据集和见解,有助于提升软件安全领域模型的鲁棒性和可解释性。

ABSTRACT

Deep learning (DL) models of code have recently reported great progress for vulnerability detection. In some cases, DL-based models have outperformed static analysis tools. Although many great models have been proposed, we do not yet have a good understanding of these models. This limits the further advancement of model robustness, debugging, and deployment for the vulnerability detection. In this paper, we surveyed and reproduced 9 state-of-the-art (SOTA) deep learning models on 2 widely used vulnerability detection datasets: Devign and MSR. We investigated 6 research questions in three areas, namely model capabilities, training data, and model interpretation. We experimentally demonstrated the variability between different runs of a model and the low agreement among different models' outputs. We investigated models trained for specific types of vulnerabilities compared to a model that is trained on all the vulnerabilities at once. We explored the types of programs DL may consider "hard" to handle. We investigated the relations of training data sizes and training data composition with model performance. Finally, we studied model interpretations and analyzed important features that the models used to make predictions. We believe that our findings can help better understand model results, provide guidance on preparing training data, and improve the robustness of the models. All of our datasets, code, and results are available at https://doi.org/10.6084/m9.figshare.20791240.

研究动机与目标

  • 为了理解深度学习模型在漏洞检测中的可靠性与一致性,特别是跨不同运行和不同模型之间的表现。
  • 评估针对每种漏洞类型单独训练模型是否比使用单一统一模型表现更优。
  • 识别哪些代码特征会使程序难以被模型正确预测。
  • 考察训练数据集规模和构成对模型性能的影响。
  • 利用最先进的解释工具分析模型在预测中使用的代码特征。

提出的方法

  • 在 Devign 和 MSR 数据集上复现了 11 种最先进的深度学习模型,包括图神经网络(GNN)、循环神经网络(RNN)、长短期记忆网络(LSTM)、卷积神经网络(CNN)和 Transformer 架构。
  • 采用五折交叉验证以减少因训练数据中项目组成带来的偏差。
  • 使用多个随机种子评估运行间变异性,并排除所有预测结果为全 0 或全 1 的不稳定模型。
  • 应用最先进的模型解释工具(如 LIME、Grad-CAM)提取并比较不同模型中的关键代码特征。
  • 构建逻辑回归模型,基于代码特征预测哪些程序难以分类。
  • 分析每项预测的前 10 个关键代码行,量化特征重叠程度与常见模式。

实验结果

研究问题

  • RQ1RQ1:模型在漏洞检测结果上是否达成一致?不同运行之间以及不同模型之间是否存在变异性?
  • RQ2RQ2:某些类型的漏洞是否更容易被检测?应针对每种漏洞类型单独训练模型,还是使用统一模型?
  • RQ3RQ3:具有特定代码特征的程序是否更难被正确预测?如果是,这些特征是什么?
  • RQ4RQ4:增加训练数据集规模是否能提升模型性能?
  • RQ5RQ5:训练数据中项目构成如何影响模型性能?
  • RQ6RQ6:模型在预测中使用了哪些源代码特征?它们在关键特征上是否达成共识?

主要发现

  • 平均而言,34.9% 的测试样本在相同模型的不同运行中预测结果不一致,表明运行间变异性较高。
  • 仅有 7% 的测试预测被全部 9 个模型一致认可,揭示了当前 SOTA 模型之间共识度较低。
  • 针对特定漏洞类型训练的模型显著优于将所有漏洞合并后统一训练的模型。
  • 模型性能在约 1,000 个漏洞样本后趋于稳定,表明在此阈值之后收益递减。
  • 基于代码特征训练的逻辑回归模型能够预测哪些程序难以分类,表明模型失败存在可识别的模式。
  • 解释工具显示,模型使用的代码特征存在重叠,每项预测的前 10 个关键代码行中,平均有 3.38 至 6.88 行是共同的。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。