arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.18607cs.SEcs.AIcs.CR
收藏

神经网络修复安全漏洞的效果如何

How Effective Are Neural Networks for Fixing Security Vulnerabilities

Purdue University(普渡大学);University of Waterloo(滑铁卢大学);York University(约克大学);University of Alberta(阿尔伯塔大学);J.P. Morgan AI Research(摩根大通AI研究院)

Yi Wu, Nan Jiang, Hung Viet Pham, Thibaud Lutellier, Jordan Davis, Lin Tan, Petr Babkin, Sameena Shah

AI总结:

本文首次系统比较了LLMs与基于深度学习的APR模型在Java漏洞修复上的能力,提出新基准VJBench及变换版本,并发现现有方法修复率低、Codex表现相对最好,呼吁通过更大训练数据、微调和代码简化变换来提升自动修复效果。

摘要:

安全漏洞修复是一项困难的任务,亟需自动化。两类技术已展现出前景:(1)在源代码上针对代码补全等任务进行预训练的大型代码语言模型(LLMs),以及(2)使用深度学习(DL)模型自动修复软件缺陷的自动程序修复(APR)技术。本文首次研究并比较了LLMs与基于DL的APR模型的Java漏洞修复能力。贡献包括:(1)在两个真实世界Java漏洞基准(Vul4J和VJBench)上应用并评估了五个LLMs(Codex、CodeGen、CodeT5、PLBART和InCoder)、四个微调LLMs以及四种基于DL的APR技术;(2)设计了代码变换以应对Codex面临的训练与测试数据重叠威胁;(3)创建了新的Java漏洞修复基准VJBench及其变换版本VJBench-trans;(4)在VJBench-trans中的变换漏洞上评估了LLMs和APR技术。我们的发现包括:(1)现有LLMs和APR模型修复的Java漏洞非常少。Codex修复了10.2个(20.4%),数量最多。(2)使用通用APR数据进行微调可提升LLMs的漏洞修复能力。(3)我们新的VJBench揭示,LLMs和APR模型无法修复许多通用弱点枚举(CWE)类型,例如CWE-325缺少密码学步骤和CWE-444 HTTP请求走私。(4)Codex仍修复了8.3个变换漏洞,在变换漏洞上优于所有其他LLMs和APR模型。这些结果呼吁进行创新以增强自动化Java漏洞修复,例如创建更大规模的漏洞修复训练数据、使用此类数据微调LLMs,以及应用代码简化变换以促进漏洞修复。

英文摘要:

Security vulnerability repair is a difficult task that is in dire need of automation. Two groups of techniques have shown promise: (1) large code language models (LLMs) that have been pre-trained on source code for tasks such as code completion, and (2) automated program repair (APR) techniques that use deep learning (DL) models to automatically fix software bugs. This paper is the first to study and compare Java vulnerability repair capabilities of LLMs and DL-based APR models. The contributions include that we (1) apply and evaluate five LLMs (Codex, CodeGen, CodeT5, PLBART and InCoder), four fine-tuned LLMs, and four DL-based APR techniques on two real-world Java vulnerability benchmarks (Vul4J and VJBench), (2) design code transformations to address the training and test data overlapping threat to Codex, (3) create a new Java vulnerability repair benchmark VJBench, and its transformed version VJBench-trans and (4) evaluate LLMs and APR techniques on the transformed vulnerabilities in VJBench-trans. Our findings include that (1) existing LLMs and APR models fix very few Java vulnerabilities. Codex fixes 10.2 (20.4%), the most number of vulnerabilities. (2) Fine-tuning with general APR data improves LLMs' vulnerability-fixing capabilities. (3) Our new VJBench reveals that LLMs and APR models fail to fix many Common Weakness Enumeration (CWE) types, such as CWE-325 Missing cryptographic step and CWE-444 HTTP request smuggling. (4) Codex still fixes 8.3 transformed vulnerabilities, outperforming all the other LLMs and APR models on transformed vulnerabilities. The results call for innovations to enhance automated Java vulnerability repair such as creating larger vulnerability repair training data, tuning LLMs with such data, and applying code simplification transformation to facilitate vulnerability repair.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑