The advances of deep learning (DL) have paved the way for automatic software vulnerability repair approaches, which effectively learn the mapping from the vulnerable code to the fixed code. Nevertheless, existing DL-based vulnerability repair methods face notable limitations: 1) they struggle to handle lengthy vulnerable code, 2) they treat code as natural language texts, neglecting its inherent structure, and 3) they do not tap into the valuable expert knowledge present in the expert system. To address this, we propose VulMaster, a Transformer-based neural network model that excels at generating vulnerability repairs through data-centric innovation. Specifically, VulMaster introduces the utilization and combination of various types of input data, including complete vulnerable code of any size, vulnerable code structures, and expert knowledge from the CWE system. Additionally, VulMaster leverages the collaboration between two Large Language Models (LLMs), CodeT5 and ChatGPT: CodeT5 acts as the customizable backbone LLM, fine-tuned with the training data, while ChatGPT supplements by providing missing relevant inputs to CodeT5. We evaluated VulMaster on a real-world C/C++ vulnerability repair dataset comprising 1,754 projects with 5,800 vulnerable functions. The experimental results demonstrated that VulMaster exhibits substantial improvements compared to the learning-based state-of-the-art vulnerability repair approach. Specifically, VulMaster improves the EM, BLEU, and CodeBLEU scores from 10.2\% to 20.0\%, 21.3\% to 29.3\%, and 32.5\% to 40.9\%, respectively.
翻译:深度学习(DL)的进展为自动化软件漏洞修复方法铺平了道路,这些方法能有效学习从脆弱代码到修复代码的映射。然而,现有基于深度学习的漏洞修复方法存在显著局限性:1)难以处理冗长的脆弱代码,2)将代码视为自然语言文本而忽略其内在结构,3)未能利用专家系统中宝贵的专家知识。为解决这些问题,我们提出VulMaster,一种基于Transformer的神经网络模型,通过数据驱动创新出色地生成漏洞修复。具体而言,VulMaster引入了多种输入数据的利用和组合,包括任意大小的完整脆弱代码、脆弱代码结构以及来自CWE系统的专家知识。此外,VulMaster利用了两种大型语言模型(LLM)——CodeT5和ChatGPT之间的协作:CodeT5作为可定制的骨干LLM,使用训练数据微调,而ChatGPT通过向CodeT5补充缺失的相关输入来提供辅助。我们在一个包含1754个项目、5800个脆弱函数的真实C/C++漏洞修复数据集上评估了VulMaster。实验结果表明,与基于学习的最先进漏洞修复方法相比,VulMaster展现出显著改进。具体而言,VulMaster将EM、BLEU和CodeBLEU得分分别从10.2%提升至20.0%,从21.3%提升至29.3%,以及从32.5%提升至40.9%。