Defending Against Indirect Prompt Injection Attacks With Spotlighting

📄 arXiv: 2403.14720v1 📥 PDF

作者: Keegan Hines, Gary Lopez, Matthew Hall, Federico Zarfati, Yonatan Zunger, Emre Kiciman

分类: cs.CR, cs.CL, cs.LG

发布日期: 2024-03-20


💡 一句话要点

提出Spotlighting技术以防御间接提示注入攻击

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 提示注入攻击 安全防护 输入来源识别 自然语言处理 对抗性指令 提示工程技术

📋 核心要点

  1. 现有大型语言模型在处理多个输入时无法有效区分不同来源,导致间接提示注入攻击的安全隐患。
  2. 本文提出Spotlighting技术,通过对输入进行变换,提供可靠的来源信号,从而增强模型对多源输入的区分能力。
  3. 实验结果显示,Spotlighting将攻击成功率从50%以上降低至2%以下,同时对任务效果影响极小。

📝 摘要(中文)

大型语言模型(LLMs)在处理单一文本输入时表现出色,但在常见应用中,多个输入常通过拼接成单一文本流进行处理。这使得LLMs无法区分不同输入源的提示内容,间接提示注入攻击正是利用这一漏洞,将对抗性指令嵌入到不可信数据中,导致安全隐患。本文提出了Spotlighting,一种提示工程技术,旨在提升LLMs区分多源输入的能力。通过对输入的变换,提供可靠的来源信号。实验表明,Spotlighting能将攻击成功率从50%以上降低到2%以下,对自然语言处理任务的影响微乎其微。

🔬 方法详解

问题定义:本文解决的是大型语言模型在处理多个输入时无法区分不同来源的问题,现有方法在面对间接提示注入攻击时存在显著的安全漏洞。

核心思路:Spotlighting技术的核心思路是通过对输入进行变换,提供一个持续且可靠的来源信号,从而帮助模型更好地识别输入的来源,避免误将对抗性指令视为用户命令。

技术框架:整体架构包括输入变换模块、信号生成模块和模型处理模块。输入变换模块负责对原始输入进行多种形式的变换,信号生成模块则提取并标记输入的来源信息,最后模型处理模块利用这些信息进行安全的输入处理。

关键创新:最重要的创新点在于引入了对输入的变换机制,使得模型能够在处理多个输入时保持对来源的敏感性,这与传统方法的单一输入处理方式有本质区别。

关键设计:在设计中,Spotlighting技术采用了多种输入变换方式,并通过特定的损失函数优化模型对来源信号的识别能力,确保在防御攻击的同时不影响模型的任务执行效果。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,使用Spotlighting技术后,间接提示注入攻击的成功率从50%以上降低至2%以下,表明该方法在防御能力上具有显著提升。同时,对自然语言处理任务的影响微乎其微,证明了其在实际应用中的有效性。

🎯 应用场景

该研究的潜在应用领域包括安全敏感的自然语言处理系统,如聊天机器人、自动回复系统和信息检索系统。通过提升模型对输入来源的识别能力,可以有效防止间接提示注入攻击,增强系统的安全性和可靠性。未来,该技术有望推广至更广泛的AI应用场景,提升整体安全防护水平。

📄 摘要(原文)

Large Language Models (LLMs), while powerful, are built and trained to process a single text input. In common applications, multiple inputs can be processed by concatenating them together into a single stream of text. However, the LLM is unable to distinguish which sections of prompt belong to various input sources. Indirect prompt injection attacks take advantage of this vulnerability by embedding adversarial instructions into untrusted data being processed alongside user commands. Often, the LLM will mistake the adversarial instructions as user commands to be followed, creating a security vulnerability in the larger system. We introduce spotlighting, a family of prompt engineering techniques that can be used to improve LLMs' ability to distinguish among multiple sources of input. The key insight is to utilize transformations of an input to provide a reliable and continuous signal of its provenance. We evaluate spotlighting as a defense against indirect prompt injection attacks, and find that it is a robust defense that has minimal detrimental impact to underlying NLP tasks. Using GPT-family models, we find that spotlighting reduces the attack success rate from greater than {50}\% to below {2}\% in our experiments with minimal impact on task efficacy.