诱导LLM编码助手生成含漏洞代码
Inducing Vulnerable Code Generation in LLM Coding Assistants
AI总结:
本文提出HACKODE攻击,利用外部信息诱导LLM编码助手生成含漏洞代码,在通用及代码LLM上实现84.29%成功率,并在真实应用中达75.92%ASR,揭示新安全风险。
摘要:
由于领域知识不足,LLM编码助手经常参考互联网上的相关解决方案来解决编程问题。然而,将外部信息纳入LLM的代码生成过程引入了新的安全风险。在本文中,我们揭示了一种现实世界的威胁,名为HACKODE,攻击者利用被引用的外部信息嵌入攻击序列,导致LLM生成包含缓冲区溢出和不完整验证等漏洞的代码。我们设计了一个攻击原型,该原型能够针对各种用户查询和提示模板的潜在多样化输入生成有效的攻击序列。通过对两个通用LLM和两个代码LLM的评估,我们证明了该攻击的有效性,实现了84.29%的成功率。此外,在现实世界的应用程序上,HACKODE达到了75.92%的攻击成功率(ASR),展示了其现实世界的影响。
英文摘要:
Due to insufficient domain knowledge, LLM coding assistants often reference related solutions from the Internet to address programming problems. However, incorporating external information into LLMs' code generation process introduces new security risks. In this paper, we reveal a real-world threat, named HACKODE, where attackers exploit referenced external information to embed attack sequences, causing LLMs to produce code with vulnerabilities such as buffer overflows and incomplete validations. We designed a prototype of the attack, which generates effective attack sequences for potential diverse inputs with various user queries and prompt templates. Through the evaluation on two general LLMs and two code LLMs, we demonstrate that the attack is effective, achieving an 84.29% success rate. Additionally, on a real-world application, HACKODE achieves 75.92% ASR, demonstrating its real-world impact.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。