arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.11072cs.CRcs.AI
收藏

映射你的模型:评估对抗性攻击对基于LLM的编程助手的影响

MaPPing Your Model: Assessing the Impact of Adversarial Attacks on LLM-based Programming Assistants

University of Oregon(俄勒冈大学)

John Heibel, Daniel Lowd

AI总结:

提出MaPP攻击,通过向编程提示添加少量文本使LLM生成含漏洞代码,在多个模型上有效,表明仅扩展模型规模无法防御此类攻击。

摘要:

基于LLM的编程助手提供了更快编程的前景,但也带来了引入更多安全漏洞的风险。先前的工作已经研究了LLM如何被恶意微调以更频繁地建议漏洞。随着智能体LLM的兴起,这些LLM可能使用来自不可信第三方的结果,针对模型提示的攻击风险日益增加。我们引入了恶意编程提示(MaPP)攻击,在这种攻击中,攻击者向编程任务的提示中添加少量文本(少于500字节)。我们表明,我们的提示策略可以导致LLM添加漏洞,同时继续编写其他方面正确的代码。我们在七个常见的LLM上评估了三种提示,从基础模型到最先进的商业模型。使用HumanEval基准,我们发现我们的提示广泛有效,无需针对不同LLM进行定制。此外,在HumanEval上表现最好的LLM也最擅长遵循我们的恶意指令,这表明仅仅扩展语言模型的规模并不能阻止MaPP攻击。使用包含16个场景中八个CWE的数据集,我们发现MaPP攻击也能在一系列模型上有效实现特定和有针对性的漏洞。我们的工作强调了保护LLM提示免受操纵以及严格审计在LLM帮助下生成的代码的必要性。

英文摘要:

LLM-based programming assistants offer the promise of programming faster but with the risk of introducing more security vulnerabilities. Prior work has studied how LLMs could be maliciously fine-tuned to suggest vulnerabilities more often. With the rise of agentic LLMs, which may use results from an untrusted third party, there is a growing risk of attacks on the model's prompt. We introduce the Malicious Programming Prompt (MaPP) attack, in which an attacker adds a small amount of text to a prompt for a programming task (under 500 bytes). We show that our prompt strategy can cause an LLM to add vulnerabilities while continuing to write otherwise correct code. We evaluate three prompts on seven common LLMs, from basic to state-of-the-art commercial models. Using the HumanEval benchmark, we find that our prompts are broadly effective, with no customization required for different LLMs. Furthermore, the LLMs that are best at HumanEval are also best at following our malicious instructions, suggesting that simply scaling language models will not prevent MaPP attacks. Using a dataset of eight CWEs in 16 scenarios, we find that MaPP attacks are also effective at implementing specific and targeted vulnerabilities across a range of models. Our work highlights the need to secure LLM prompts against manipulation as well as rigorously auditing code generated with the help of LLMs.

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

↑