Skip to main content
QUICK REVIEW

[论文解读] Formalizing and Benchmarking Prompt Injection Attacks and Defenses

Yupei Liu, Yuqi Jia|arXiv (Cornell University)|Oct 19, 2023
Security and Verification in ComputingComputer Science被引用 10
一句话总结

本文形式化了面向LLM-集成应用的提示注入攻击与防御,提出了一个通用的攻击与防御框架,并系统性地在10个LLMs和7个任务上评估了5种攻击和10种防御。

ABSTRACT

A prompt injection attack aims to inject malicious instruction/data into the input of an LLM-Integrated Application such that it produces results as an attacker desires. Existing works are limited to case studies. As a result, the literature lacks a systematic understanding of prompt injection attacks and their defenses. We aim to bridge the gap in this work. In particular, we propose a framework to formalize prompt injection attacks. Existing attacks are special cases in our framework. Moreover, based on our framework, we design a new attack by combining existing ones. Using our framework, we conduct a systematic evaluation on 5 prompt injection attacks and 10 defenses with 10 LLMs and 7 tasks. Our work provides a common benchmark for quantitatively evaluating future prompt injection attacks and defenses. To facilitate research on this topic, we make our platform public at https://github.com/liu00222/Open-Prompt-Injection.

研究动机与目标

  • 为LLM-集成应用开发提示注入攻击的形式化定义(目标任务与注入任务)。
  • 创建一个通用攻击框架,通过组合现有策略可以产生新的提示注入攻击。
  • 提出一个防御框架,在纵深防御中结合预防与检测。
  • 系统地在多种LLM和任务上对多种攻击与防御进行评估,以量化有效性和威胁水平。

提出的方法

  • 定义带有相关指令和数据提示的目标任务与注入任务。
  • 提出一个攻击函数 x̃ = A(x^t, s^e, x^e) 用于构造被破坏的数据提示。
  • 将现有攻击(Naive、Escape Characters、Context Ignoring、Fake Completion)正式化为框架内的特例。
  • 引入一个综合攻击,将多种攻击策略融合以获得更强的效果。
  • 概述一个防防御-检测框架,包括改写、重新分词、数据提示隔离、指令与三明治防御,以及检测方法(基于PPL、基于LLM、基于响应、主动防御)。
  • 提供理论分析,证明在秘密数据随机性下,主动检测对自适应攻击的鲁棒性。

实验结果

研究问题

  • RQ1哪些正式定义最能捕捉在LLM-集成应用中的提示注入攻击?
  • RQ2我们如何在通用框架中系统性地设计与组合攻击?
  • RQ3在多样化的LLM和任务上,单独或结合使用时,预防与检测防御对提示注入攻击的有效性如何?
  • RQ4在自适应攻击策略下,主动检测的影响是什么?
  • RQ5在10个LLMs和7个任务中,5种攻击相对于10种防御的表现如何?

主要发现

  • 受框架启发的综合攻击在目标任务和注入任务上始终表现良好,并且优于现有攻击。
  • 基于预防的防御在攻击未发生时往往会带来效用损失或无效。
  • 主动检测在攻击未发生时也能有效检测攻击,同时保持目标任务的效用。
  • 一个理论结果表明,在知道检测指令的情况下,自适应攻击者可以规避主动检测,强调对秘密数据进行随机化的必要性。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。