Robustness via Referencing: Defending against Prompt Injection Attacks by Referencing the Executed Instruction
On the map: LLM safety and security → Prompt injection and agent security
Abstract (arXiv)
Large language models (LLMs) have demonstrated impressive performance and have come to dominate the field of natural language processing (NLP) across various tasks. However, due to their strong instruction-following capabilities and inability to distinguish between instructions and data content, LLMs are vulnerable to prompt injection attacks. These attacks manipulate LLMs into deviating from the original input instructions and executing maliciously injected instructions within data content, such as web documents retrieved from search engines. Existing defense methods, including prompt-engineering and fine-tuning approaches, typically instruct models to follow the original input instructions while suppressing their tendencies to execute injected instructions. However, our experiments reveal that suppressing instruction-following tendencies is challenging. Through analyzing failure cases, we observe that although LLMs tend to respond to any recognized instructions, they are aware of which specific instructions they are executing and can correctly reference them within the original prompt. Motivated by these findings, we propose a novel defense method that leverages, rather than suppresses, the instruction-following abilities of LLMs. Our approach prompts LLMs to generate responses that include both answers and their corresponding instruction references. Based on these references, we filter out answers not associated with the original input instructions. Comprehensive experiments demonstrate that our method outperforms prompt-engineering baselines and achieves performance comparable to fine-tuning methods, reducing the attack success rate (ASR) to 0 percent in some scenarios. Moreover, our approach has minimal impact on overall utility.
Key facts. Cited by 16 papers in the map (data through 14 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. Builds on 42 of its 62 references that are in the map. First posted on arXiv 29 Apr 2025.
Builds on
42 of 62 references.
Closest ancestors · 19
Same direction, newest first
- 2025Adaptive Attacks Break Defenses Against Indirect Prompt Injection Attacks on LLM Agents27 Feb
- 2025Can Indirect Prompt Injection Attacks Be Detected and Removed?23 Feb
- 2025RTBAS: Defending LLM Agents Against Prompt Injection and Privacy Leakage13 Feb
- 2024Universal and Context-Independent Triggers for Precise Control of LLM Outputs22 Nov
- 2024Defense Against Prompt Injection Attack by Leveraging Attack Techniques1 Nov
- 2024FATH: Authentication-based Test-time Defense against Indirect Prompt Injection Attacks28 Oct
- 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions19 Apr
- 2024Optimization-based Prompt Injection Attack to LLM-as-a-Judge26 Mar
- 2024Defending Against Indirect Prompt Injection Attacks With Spotlighting20 Mar
- 2024Automatic and Universal Prompt Injection Attacks against Large Language Models7 Mar
- 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar
- 2024StruQ: Defending Against Prompt Injection with Structured Queries9 Feb
7 more
- 2024Signed-Prompt: A New Approach to Prevent Prompt Injection Attacks Against LLM-Integrated Applications15 Jan
- 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuning29 Dec
- 2023Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Models21 Dec
- 2023Formalizing and Benchmarking Prompt Injection Attacks and Defenses19 Oct
- 2023Evaluating the Instruction-Following Robustness of Large Language Models to Prompt Injection17 Aug
- 2023Prompt Injection attack against LLM-integrated Applications8 Jun
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection23 Feb
Other references · 23
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,415
- 2024GPT-4o System Cardcited by 4,588
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
- 2017TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehensioncited by 2,955
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,407
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 832
- 2023AlpacaFarm: A Simulation Framework for Methods that Learn from Human Feedbackcited by 748
11 more
- 2022A Survey on In-context Learningcited by 721
- 2023StructGPT: A General Framework for Large Language Model to Reason over Structured Datacited by 343
- 2023On the Exploitability of Instruction Tuningcited by 116
- 2023AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Modelscited by 111
- 2024Machine Against the RAG: Jamming Retrieval-Augmented Generation with Blocker Documentscited by 102
- 2025GuardReasoner: Towards Reasoning-based LLM Safeguardscited by 100
- 2024UniGraph: Learning a Unified Cross-Domain Foundation Model for Text-Attributed Graphscited by 66
- 2025Safety in Large Reasoning Models: A Surveycited by 64
- 2023Towards Reasoning in Large Language Models via Multi-Agent Peer Review Collaborationcited by 51
- 2025Evaluating the Paperclip Maximizer: Are RL-Based Language Models More Likely to Pursue Instrumental Goals?cited by 33
- 2024Can Knowledge Graphs Make Large Language Models More Trustworthy? An Empirical Study Over Open-ended Question Answeringcited by 24
Built on by
Citing papers per year: 2025: 8; 2026: 8.
16 papers.
Sort:
By area:
- 2025PromptArmor: Simple yet Effective Prompt Injection Defensescited by 108
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injectionscited by 48
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injectioncited by 46
- 2025EvoTest: Evolutionary Test-Time Learning for Self-Improving Agentic Systemscited by 37
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 30
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challengescited by 28
- 2026Prompt Injection as Role Confusioncited by 17
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidancecited by 14
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metricscited by 12
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detectioncited by 12
- 2026EvoClinician: A Self-Evolving Agent for Multi-Turn Medical Diagnosis via Test-Time Evolutionary Learningcited by 8
- 2025Soft Instruction De-escalation Defensecited by 3
4 more
- 2026RedVisor: Reasoning-Aware Prompt Injection Defense via Zero-Copy KV Cache Reusecited by 2
- 2026LLM-enabled Applications Require System-Level Threat Monitoringcited by 2
- 2026VideoSTF: Stress-Testing Output Repetition in Video Large Language Modelscited by 1
- 2026TRACER: Trace-Regularized Training Against Indirect Prompt Injectioncited by 0
- 2026TRACER: Trace-Regularized Training Against Indirect Prompt Injection13 Oct 2026
- 2026LLM-enabled Applications Require System-Level Threat Monitoring23 Feb 2026
- 2026Prompt Injection as Role Confusion22 Feb 2026
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injections17 Feb 2026
- 2026VideoSTF: Stress-Testing Output Repetition in Video Large Language Models11 Feb 2026
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysis11 Feb 2026
- 2026RedVisor: Reasoning-Aware Prompt Injection Defense via Zero-Copy KV Cache Reuse2 Feb 2026
- 2026EvoClinician: A Self-Evolving Agent for Multi-Turn Medical Diagnosis via Test-Time Evolutionary Learning30 Jan 2026
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challenges27 Oct 2025
- 2025Soft Instruction De-escalation Defense24 Oct 2025
- 2025EvoTest: Evolutionary Test-Time Learning for Self-Improving Agentic Systems15 Oct 2025
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detection13 Oct 2025
4 more
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug 2025
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidance23 Jul 2025
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul 2025
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metrics24 May 2025
- 2025PromptArmor: Simple yet Effective Prompt Injection Defensescited by 108
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injectionscited by 48
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injectioncited by 46
- 2025EvoTest: Evolutionary Test-Time Learning for Self-Improving Agentic Systemscited by 37
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 30
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challengescited by 28
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidancecited by 14
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detectioncited by 12
- 2025Soft Instruction De-escalation Defensecited by 3
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injections17 Feb 2026
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysis11 Feb 2026
- 2025Agentic AI Security: Threats, Defenses, Evaluation, and Open Challenges27 Oct 2025
- 2025Soft Instruction De-escalation Defense24 Oct 2025
- 2025EvoTest: Evolutionary Test-Time Learning for Self-Improving Agentic Systems15 Oct 2025
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detection13 Oct 2025
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug 2025
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidance23 Jul 2025
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul 2025
- 2026Prompt Injection as Role Confusioncited by 17
- 2026TRACER: Trace-Regularized Training Against Indirect Prompt Injectioncited by 0
- 2026TRACER: Trace-Regularized Training Against Indirect Prompt Injection13 Oct 2026
- 2026Prompt Injection as Role Confusion22 Feb 2026
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metricscited by 12
- 2026EvoClinician: A Self-Evolving Agent for Multi-Turn Medical Diagnosis via Test-Time Evolutionary Learningcited by 8
- 2026LLM-enabled Applications Require System-Level Threat Monitoringcited by 2
- 2026VideoSTF: Stress-Testing Output Repetition in Video Large Language Modelscited by 1
- 2026LLM-enabled Applications Require System-Level Threat Monitoring23 Feb 2026
- 2026VideoSTF: Stress-Testing Output Repetition in Video Large Language Models11 Feb 2026
- 2026EvoClinician: A Self-Evolving Agent for Multi-Turn Medical Diagnosis via Test-Time Evolutionary Learning30 Jan 2026
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metrics24 May 2025
Similar, not cited
Close in wording, no citation either way
- 2025Prompt Injection as an Emerging Threat: Evaluating the Resilience of Large Language Models
- 2025Backdoor-Powered Prompt Injection Attacks Nullify Defense Methods
- 2025System Prompt Poisoning: Persistent Attacks on Large Language Models Beyond User Injection
- 2025LLMail-Inject: A Dataset from a Realistic Adaptive Prompt Injection Challenge
- 2025A Critical Evaluation of Defenses against Prompt Injection Attacks
- 2026AttackEval: A Systematic Empirical Study of Prompt Injection Attack Effectiveness Against Large Language Models
- 2026Merging Triggers, Breaking Backdoors: Defensive Poisoning for Instruction-Tuned Language Models
- 2026Know Thy Enemy: Securing LLMs Against Prompt Injection via Diverse Data Synthesis and Instruction-Level Chain-of-Thought Learning