Skip to main content
QUICK REVIEW

[论文解读] SPI: Automated Identification of Security Patches via Commits

Yaqin Zhou, Jing Kai Siow|arXiv (Cornell University)|May 30, 2021
Software Engineering Research参考文献 53被引用 18
一句话总结

该论文提出SPI,一种深度学习系统,通过分析提交信息和代码变更,自动识别开源软件中的安全补丁。采用提交信息与代码变更双重神经网络架构,SPI在经人工验证的38,291个提交数据集上实现了87.93%的F1分数,展现出在工业规模场景下的高精度与良好泛化能力。

ABSTRACT

Security patches in open-source software, providing security fixes to identified vulnerabilities, are crucial in protecting against cyberattacks. Despite the National Vulnerability Database (NVD) publishes identified vulnerabilities, a vast majority of vulnerabilities and their corresponding security patches remain beyond public exposure, e.g., in the open-source libraries that are heavily relied on by developers. An extensive security patches dataset could help end-users such as security companies, e.g., building a security knowledge base, or researchers, e.g., aiding in vulnerability research. To curate security patches including undisclosed patches at a large scale and low cost, we propose a deep neural-network-based approach built upon commits of open-source repositories. We build security patch datasets that include 38,291 security-related commits and 1,045 CVE patches from four C libraries. We manually verify each commit, among the 38,291 security-related commits, to determine if they are security-related. We devise a deep learning-based security patch identification system that consists of two neural networks: one commit-message neural network that utilizes pretrained word representations learned from our commits dataset; and one code-revision neural network that takes code before and after revision and learns the distinction on the statement level. Our evaluation results show that our system outperforms SVM and K-fold stacking algorithm, achieving as high as 87.93% F1-score and precision of 86.24%. We deployed our pipeline and learned model in an industrial production environment to evaluate the generalization ability of our approach. The industrial dataset consists of 298,917 commits from 410 new libraries that range from a wide functionality. Our experiment results and observation proved that our approach identifies security patches effectively among open-sourced projects.

研究动机与目标

  • 为解决开源软件中未公开的安全补丁识别难题,这些补丁虽已被修复但往往仍处于隐藏状态。
  • 构建一个大规模、经人工验证的安全相关提交数据集,以支持自动化补丁识别系统的训练与评估。
  • 开发一种基于深度学习的系统,结合提交信息与代码变更,以超越传统机器学习方法提升检测准确率。
  • 在初始训练数据之外的真实工业规模代码库中,评估系统在实际场景下的泛化能力。

提出的方法

  • 从四个C语言开源库中构建一个包含38,291个提交和1,045个CVE映射补丁的安全补丁数据集,并经人工验证其安全相关性。
  • 设计一种双流神经网络架构:一个用于提交信息,使用来自提交数据集的预训练词嵌入;另一个用于代码变更,通过在语句级别比较修改前后的代码。
  • 使用上下文嵌入训练提交信息网络,以捕捉安全相关提交描述的语义意图。
  • 训练代码变更网络,以检测即使变化微小或语法上不显著,也能指示安全修复的细微代码变化。
  • 采用加权融合策略结合两个网络的预测结果,以提升整体分类性能。
  • 将训练好的模型部署于工业环境,在410个新开源库的298,917个提交上进行真实世界泛化能力评估。

实验结果

研究问题

  • RQ1仅使用提交级别的信息(包括提交消息和代码变更),深度学习模型能否有效识别开源代码库中的安全补丁?
  • RQ2结合提交消息与代码变更的双流网络模型,在性能上是否显著优于SVM和K折堆叠等传统机器学习基线方法?
  • RQ3该模型在训练数据集之外的新、未见过的开源项目中,其泛化能力达到何种程度?
  • RQ4当提交消息模糊或缺失时,微小或隐含的代码变更在多大程度上影响模型检测安全补丁的能力?
  • RQ5该模型能否检测到未公开披露或未列在NVD等漏洞数据库中的安全补丁?

主要发现

  • 所提出的SPI系统在综合数据集上实现了87.93%的F1分数和86.24%的精确率,显著优于SVM和K折堆叠基线方法。
  • 提交信息网络的性能优于代码变更网络,因为提交信息中包含更多具有区分性和可解释性的安全意图信号。
  • 代码变更网络在低相似度变更(如<10%的标记重叠)情况下表现不佳,表明其在检测代码中细微或语义层面变化方面存在局限。
  • 该模型在工业规模数据上泛化良好,成功识别出410个新开源库中298,917个提交中的安全补丁。
  • 误检(假阴性)更可能源于隐含或表述不清的提交信息,但代码变更网络通过在消息模糊时仍能检测到代码变化,有效缓解了这一问题。
  • 本研究证实,训练数据偏差(尤其是缺少隐含补丁)会影响模型性能,提示需要更多样化且高质量的标注数据。

更好的研究,从现在开始

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

无需绑定信用卡

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