基于大语言模型的代码补全工具的安全攻击
Security Attacks on LLM-based Code Completion Tools
AI总结:
本文针对基于大语言模型的代码补全工具(LCCTs)的独特工作流程,提出越狱和训练数据提取两类定向攻击方法,在GitHub Copilot和Amazon Q上验证了严重漏洞,并证明该方法对GPT系列等通用大语言模型同样有效,揭示了现代大语言模型在代码处理中的广泛安全风险。
摘要:
大语言模型(LLMs)的快速发展显著提升了代码补全能力,催生了新一代基于大语言模型的代码补全工具(LCCTs)。与通用大语言模型不同,这些工具具有独特的工作流程,它们整合多个信息源作为输入,并优先提供代码建议而非自然语言交互,这带来了独特的安全挑战。此外,LCCTs通常依赖专有代码数据集进行训练,引发了关于敏感数据潜在泄露的担忧。本文利用LCCTs的这些独特特性,针对两个关键安全风险开发了定向攻击方法:越狱攻击和训练数据提取攻击。我们的实验结果揭示了LCCTs内部的重大漏洞,包括对GitHub Copilot的越狱攻击成功率达到99.4%,对Amazon Q的成功率达到46.3%。此外,我们成功从GitHub Copilot中提取了敏感用户数据,包括54个真实电子邮件地址和314个与GitHub用户名相关联的物理地址。我们的研究还表明,这些基于代码的攻击方法对通用大语言模型(如GPT系列)同样有效,凸显了现代大语言模型在处理代码时存在更广泛的安全错位问题。这些发现强调了与LCCTs相关的关键安全挑战,并为加强其安全框架指明了重要方向。我们研究中的示例代码和攻击样本可在https://github.com/Sensente/Security-Attacks-on-LCCTs获取。
英文摘要:
The rapid development of large language models (LLMs) has significantly advanced code completion capabilities, giving rise to a new generation of LLM-based Code Completion Tools (LCCTs). Unlike general-purpose LLMs, these tools possess unique workflows, integrating multiple information sources as input and prioritizing code suggestions over natural language interaction, which introduces distinct security challenges. Additionally, LCCTs often rely on proprietary code datasets for training, raising concerns about the potential exposure of sensitive data. This paper exploits these distinct characteristics of LCCTs to develop targeted attack methodologies on two critical security risks: jailbreaking and training data extraction attacks. Our experimental results expose significant vulnerabilities within LCCTs, including a 99.4% success rate in jailbreaking attacks on GitHub Copilot and a 46.3% success rate on Amazon Q. Furthermore, We successfully extracted sensitive user data from GitHub Copilot, including 54 real email addresses and 314 physical addresses associated with GitHub usernames. Our study also demonstrates that these code-based attack methods are effective against general-purpose LLMs, such as the GPT series, highlighting a broader security misalignment in the handling of code by modern LLMs. These findings underscore critical security challenges associated with LCCTs and suggest essential directions for strengthening their security frameworks. The example code and attack samples from our research are provided at https://github.com/Sensente/Security-Attacks-on-LCCTs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。