arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2204.04741cs.SEcs.CR
收藏

GitHub 的 Copilot 在代码中引入漏洞方面是否和人类一样糟糕?

Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?

Owura Asare, Meiyappan Nagappan, N. Asokan

AI总结:

本文从安全性角度对 Copilot 生成的代码进行实证分析,发现其引入漏洞的比例约为 33%,且行为因漏洞类型和时间而异,总体上不如人类开发者那样容易引入漏洞。

摘要:

深度学习的多项进展已成功应用于软件开发过程。近期备受关注的是使用神经语言模型来构建诸如 Copilot 等辅助编写代码的工具。本文从安全性角度对 Copilot 生成的代码进行了比较性实证分析。本研究旨在确定 Copilot 是否和人类开发者一样糟糕。我们调查了 Copilot 是否同样可能引入与人类开发者相同的软件漏洞。使用一个 C/C++ 漏洞数据集,我们提示 Copilot 在曾导致人类开发者引入漏洞的场景中生成建议。这些建议通过一个两阶段流程进行检查和分类,依据是是否重新引入了原始漏洞或修复。我们发现 Copilot 大约有 33% 的时间复制了原始易受攻击代码,而复制修复后代码的比例为 25%。然而,这种行为并不一致:Copilot 引入某些类型漏洞的可能性高于其他类型,并且在响应对应于较旧漏洞的提示时也更有可能生成易受攻击的代码。总体而言,鉴于在大量案例中它并未复制人类开发者先前引入的漏洞,我们得出结论:尽管 Copilot 在各种漏洞类型上的表现有所不同,但它在代码中引入漏洞方面并不像人类开发者那样糟糕。

英文摘要:

Several advances in deep learning have been successfully applied to the software development process. Of recent interest is the use of neural language models to build tools, such as Copilot, that assist in writing code. In this paper we perform a comparative empirical analysis of Copilot-generated code from a security perspective. The aim of this study is to determine if Copilot is as bad as human developers. We investigate whether Copilot is just as likely to introduce the same software vulnerabilities as human developers. Using a dataset of C/C++ vulnerabilities, we prompt Copilot to generate suggestions in scenarios that led to the introduction of vulnerabilities by human developers. The suggestions are inspected and categorized in a 2-stage process based on whether the original vulnerability or fix is reintroduced. We find that Copilot replicates the original vulnerable code about 33% of the time while replicating the fixed code at a 25% rate. However this behaviour is not consistent: Copilot is more likely to introduce some types of vulnerabilities than others and is also more likely to generate vulnerable code in response to prompts that correspond to older vulnerabilities. Overall, given that in a significant number of cases it did not replicate the vulnerabilities previously introduced by human developers, we conclude that Copilot, despite performing differently across various vulnerability types, is not as bad as human developers at introducing vulnerabilities in code.

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

↑