Skip to main content
QUICK REVIEW

[论文解读] Pre-trained Model-based Automated Software Vulnerability Repair: How Far are We?

Quanjun Zhang, Chunrong Fang|arXiv (Cornell University)|Aug 24, 2023
Software Engineering Research被引用 7
一句话总结

本文研究了用于自动化软件漏洞修复的预训练模型,表明其在修复准确率方面平均比当前最先进的VRepair方法高出16.16%。通过系统评估数据预处理、模型训练和推理阶段,研究发现,从错误修复任务中进行简单迁移学习可进一步将性能提升9.40%,为该领域未来的研究提供了实用指导。

ABSTRACT

Various approaches are proposed to help under-resourced security researchers to detect and analyze software vulnerabilities. It is still incredibly time-consuming and labor-intensive for security researchers to fix vulnerabilities. The time lag between reporting and fixing a vulnerability causes software systems to suffer from significant exposure to possible attacks. Recently, some techniques have proposed applying pre-trained models to fix security vulnerabilities and have proved their success in improving repair accuracy. However, the effectiveness of existing pre-trained models has not been systematically analyzed, and little is known about their advantages and disadvantages. To bridge this gap, we perform the first extensive study on applying various pre-trained models to vulnerability repair. The results show that studied pre-trained models consistently outperform the state-of-the-art technique VRepair with a prediction accuracy of 32.94%~44.96%. We also investigate the impact of major phases in the vulnerability repair workflow. Surprisingly, a simplistic approach adopting transfer learning improves the prediction accuracy of pre-trained models by 9.40% on average. Besides, we provide additional discussion to illustrate the capacity and limitations of pre-trained models. Finally, we further pinpoint various practical guidelines for advancing pre-trained model-based vulnerability repair. Our study highlights the promising future of adopting pre-trained models to patch real-world vulnerabilities.

研究动机与目标

  • 系统评估预训练模型在自动化软件漏洞修复中的有效性。
  • 识别现有预训练模型在修复真实世界安全漏洞时的优势与局限性。
  • 研究工作流中的关键阶段——数据预处理、模型训练和修复推理——对修复性能的影响。
  • 探索是否可通过从错误修复任务中简化迁移学习的方法进一步提升漏洞修复的准确性。
  • 为基于预训练模型的漏洞修复系统未来开发提供实用且可操作的指导。

提出的方法

  • 本研究在两个公开的漏洞数据集上评估了多种预训练模型,重点关注代码修复任务。
  • 采用系统化流程,包括数据预处理、在漏洞修复数据上进行微调,以及生成补丁的推理阶段。
  • 通过使用来自错误修复语料库的预训练权重初始化模型,应用迁移学习策略,以利用通用代码修复知识。
  • 修复过程采用序列到序列建模,使用T5和CodeBERT等模型,并在标注的漏洞-修复配对数据上进行微调。
  • 比较不同预训练架构的性能,并分析数据表示和微调策略的影响。
  • 在完整修复流程中开展消融实验,以隔离各阶段对最终准确率的影响。

实验结果

研究问题

  • RQ1RQ1:与现有技术(如VRepair)相比,最先进的预训练模型在自动化漏洞修复中的有效性如何?
  • RQ2RQ2:不同的数据预处理策略如何影响预训练模型在漏洞修复中的性能?
  • RQ3RQ3:模型训练超参数和微调策略对修复准确率的影响是什么?
  • RQ4RQ4:修复推理阶段如何影响生成补丁的质量和正确性?
  • RQ5RQ5:从错误修复任务中采用简化迁移学习方法是否能进一步提升预训练模型在漏洞修复中的性能?

主要发现

  • 所有研究的预训练模型均优于VRepair,在两个漏洞数据集上的预测准确率介于32.94%至44.96%之间。
  • 平均而言,预训练模型相比VRepair将修复准确率提升了16.16%,显示出显著的性能提升。
  • 一种从错误修复语料库中迁移知识的简化方法,平均使预训练模型性能提升9.40%。
  • 数据预处理和微调策略对模型有效性有显著影响,最优配置可进一步提升准确率。
  • 研究发现,代码表示方式和模型初始化在决定修复成功率方面起着关键作用。
  • 已提炼出实用指导,包括微调策略的重要性,以及利用ChatGPT等模型实现零样本或少样本适配的潜力。

更好的研究,从现在开始

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

无需绑定信用卡

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