[Paper Review] Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models
This paper introduces BIPIA, the first benchmark for indirect prompt injection attacks on LLMs, shows more capable models are more vulnerable, and proposes black-box and white-box defenses, with the white-box approach nearly neutralizing 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.
Motivation & Objective
- Introduce BIPIA, a comprehensive benchmark for indirect prompt injection attacks across text and code tasks.
- Assess how LLM capabilities relate to vulnerability to indirect prompt injections.
- Propose and evaluate black-box and white-box defenses to reduce attack success rates while preserving general task performance.
- Demonstrate that white-box adversarial training can nearly eliminate ASR with little cost to normal tasks.
Proposed method
- Design BIPIA with training and test sets across email/web/table QA, summarization, and code QA tasks.
- Create 30 text attacks and 30 code attacks, categorized as task-irrelevant, task-relevant, and targeted for text, plus passive/active for code.
- Evaluate 25 accessible LLMs using a fixed conversation format and zero temperature, reporting ASR.
- Propose four black-box defense methods based on prompt learning to separate external content from instructions.
- Propose a white-box defense via special tokens and adversarial fine-tuning on BIPIA-generated data.
- Use attack verification methods (rule-based, LLM-as-judge, language detection) to compute ASR.
Experimental results
Research questions
- RQ1What is the relationship between LLM capability and vulnerability to indirect prompt injection attacks?
- RQ2Can black-box defenses reduce ASR without harming normal task performance?
- RQ3Can a white-box defense based on prompting boundaries and adversarial training nearly nullify ASR?
- RQ4How do attack types and content positions affect attack success rates across tasks?
Key findings
- More capable LLMs exhibit higher ASR across text tasks, indicating greater vulnerability to indirect prompt injection attacks.
- Summarization tasks show higher ASR than other text tasks, and code attacks have distinct patterns from text tasks.
- Four black-box defenses reduce ASR but do not eliminate it; white-box defense reduces ASR to nearly zero with minimal impact on general tasks.
- White-box adversarial training on Vicuna-7B and Vicuna-13B significantly improves robustness against indirect prompt injection attacks.
- There is a positive correlation between Elo-based model capability and ASR for text tasks (Pearson r ~0.52) and overall (r ~0.52).
- The ASR for code attacks is non-negligible, highlighting security needs in code-related generation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.