Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models

Jingwei Yi, Yueqi Xie, Bin Zhu, Emre Kiciman, Guangzhong Sun +2 more
12/21/2023
459 citations
cs.CLcs.AI
benchmark-dataset

Official code: microsoft/BIPIA (162 stars, Python, last commit 2024-04-15).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

microsoft/BIPIAOfficial100%

A benchmark for evaluating the robustness of LLMs and defenses to indirect prompt injection attacks.

16227Python, Jupyter NotebookJan 4, 20242 years agoNOASSERTION
llm-security

Similar Papers

Cite this paper

@article{yi2023benchmarking,
  title  = {Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models},
  author = {Jingwei Yi and Yueqi Xie and Bin Zhu and Emre Kiciman and Guangzhong Sun and Xing Xie and Fangzhao Wu},
  year   = {2023},
  eprint = {2312.14197},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2312.14197v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2312.14197.svg)](https://codeofpaper.com/paper/2312.14197)

Discussion