[论文解读] Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models
本文介绍 BIPIA,这是对大语言模型间接提示注入攻击的第一个基准测试,显示更强的模型更易受攻击,并提出黑盒和白盒防御,白盒方法几乎可中和 ASR。
The integration of large language models with external content has enabled applications such as Microsoft Copilot but also introduced vulnerabilities to indirect prompt injection attacks. In these attacks, malicious instructions embedded within external content can manipulate LLM outputs, causing deviations from user expectations. To address this critical yet under-explored issue, we introduce the first benchmark for indirect prompt injection attacks, named BIPIA, to assess the risk of such vulnerabilities. Using BIPIA, we evaluate existing LLMs and find them universally vulnerable. Our analysis identifies two key factors contributing to their success: LLMs' inability to distinguish between informational context and actionable instructions, and their lack of awareness in avoiding the execution of instructions within external content. Based on these findings, we propose two novel defense mechanisms-boundary awareness and explicit reminder-to address these vulnerabilities in both black-box and white-box settings. Extensive experiments demonstrate that our black-box defense provides substantial mitigation, while our white-box defense reduces the attack success rate to near-zero levels, all while preserving the output quality of LLMs. We hope this work inspires further research into securing LLM applications and fostering their safe and reliable use.
研究动机与目标
- 介绍 BIPIA,一个覆盖文本和代码任务的间接提示注入攻击的综合基准测试。
- 评估 LLM 能力与对间接提示注入漏洞之间的关系。
- 提出并评估黑盒和白盒防御,在降低攻击成功率的同时保持通用任务性能。
- 证明白盒对抗性训练几乎可以消除 ASR,并对常规任务几乎无代价。
提出的方法
- 设计 BIPIA,覆盖电子邮件/网页/表格问答、摘要以及代码问答任务的训练与测试集。
- 产生 30 个文本攻击和 30 个代码攻击,文本分为任务无关、任务相关和有针对性;代码分为被动/主动。
- 使用固定对话格式和零温度评估 25 款可用的 LLM,报告 ASR。
- 提出基于提示学习的四种黑盒防御方法,以将外部内容与指令分离。
- 提出一种白盒防御,通过特殊标记和在 BIPIA 生成数据上的对抗性微调实现。
- 使用攻击验证方法(基于规则、LLM 作为 judge、语言检测)来计算 ASR。
实验结果
研究问题
- RQ1LLM 能力与对间接提示注入攻击的脆弱性之间的关系是什么?
- RQ2黑盒防御是否能在不损害普通任务性能的情况下降低 ASR?
- RQ3基于提示边界和对抗性训练的白盒防御是否能几乎使 ASR 为零?
- RQ4攻击类型和内容位置如何影响各任务中的攻击成功率?
主要发现
- 更强的 LLM 在文本任务中表现出更高的 ASR,表明对间接提示注入攻击的脆弱性更大。
- 摘录任务的 ASR 高于其他文本任务,且代码攻击表现出与文本任务不同的模式。
- 四种黑盒防御降低 ASR 但未能消除;白盒防御将 ASR 降至几乎为零,对一般任务影响最小。
- 在 Vicuna-7B 与 Vicuna-13B 上的白盒对抗性训练显著提升对间接提示注入攻击的鲁棒性。
- 基于 Elo 的模型能力与文本任务的 ASR 存在正相关(Pearson r ~0.52),总体 r ~0.52。
- 代码攻击的 ASR 也不可忽略,凸显了代码相关生成中的安全需求。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。