Defense Against Prompt Injection Attack by Leveraging Attack Techniques
On the map: LLM safety and security → Prompt injection and agent security
Abstract (arXiv)
With the advancement of technology, large language models (LLMs) have achieved remarkable performance across various natural language processing (NLP) tasks, powering LLM-integrated applications like Microsoft Copilot. However, as LLMs continue to evolve, new vulnerabilities, especially prompt injection attacks arise. These attacks trick LLMs into deviating from the original input instructions and executing the attacker's instructions injected in data content, such as retrieved results. Recent attack methods leverage LLMs' instruction-following abilities and their inabilities to distinguish instructions injected in the data content, and achieve a high attack success rate (ASR). When comparing the attack and defense methods, we interestingly find that they share similar design goals, of inducing the model to ignore unwanted instructions and instead to execute wanted instructions. Therefore, we raise an intuitive question: Could these attack techniques be utilized for defensive purposes? In this paper, we invert the intention of prompt injection methods to develop novel defense methods based on previous training-free attack methods, by repeating the attack process but with the original input instruction rather than the injected instruction. Our comprehensive experiments demonstrate that our defense techniques outperform existing training-free defense approaches, achieving state-of-the-art results.
Key facts. Cited by 31 papers in the map (data through 7 Oct 2026). Placed in Prompt injection and agent security, one of 12 directions in LLM safety and security. First posted on arXiv 1 Nov 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 13; 2026: 18.
31 papers.
Sort:
By area:
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systemscited by 125
- 2025A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deploymentcited by 110
- 2025Safety in Large Reasoning Models: A Surveycited by 58
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injectionscited by 44
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injectioncited by 39
- 2025Red Teaming the Mind of the Machine: A Systematic Evaluation of Prompt Injection and Jailbreak Vulnerabilities in LLMscited by 34
- 2026SkillJect: Effectively Automating Skill-Based Prompt Injection for Skill-Enabled Agentscited by 20
- 2025To Protect the LLM Agent Against the Prompt Injection Attack with Polymorphic Promptcited by 14
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detectioncited by 11
- 2026AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Managementcited by 10
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsingcited by 8
- 2026The Promptware Kill Chain: How Prompt Injections Gradually Evolved Into a Multistep Malware Delivery Mechanismcited by 7
19 more
- 2025JavelinGuard: Low-Cost Transformer Architectures for LLM Securitycited by 4
- 2025ContextLeak: Auditing Leakage in Private In-Context Learning Methodscited by 4
- 2026Visual Inception: Compromising Long-term Planning in Agentic Recommenders via Multimodal Memory Poisoningcited by 4
- 2026SafeReview: Defending LLM-based Review Systems Against Adversarial Hidden Promptscited by 4
- 2026Turning Bias into Bugs: Bandit-Guided Style Manipulation Attacks on LLM Judgescited by 3
- 2025QueryIPI: Query-agnostic Indirect Prompt Injection on Coding Agentscited by 2
- 2025EAGER: Edge-Aligned LLM Defense for Robust, Efficient, and Accurate Cybersecurity Question Answeringcited by 2
- 2026LLM-enabled Applications Require System-Level Threat Monitoringcited by 2
- 2026WebTrap: Stealthy Mid-Task Hijacking of Browser Agents During Navigationcited by 2
- 2026Large Language Models for Agentic NetOps and AIOps: Architectures, Evaluation, and Safetycited by 2
- 2025OET: Optimization-based prompt injection Evaluation Toolkitcited by 1
- 2026Are GUI Agents Focused Enough? Automated Distraction via Semantic-level UI Element Injectioncited by 1
- 2026Needle-in-RAG: Prompt-Conditioned Character-Level Traceback of Poisoned Spans in Retrieved Evidencecited by 1
- 2026AutoRAS: Learning Robust Agentic Systems with Primitive Representationscited by 1
- 2025From Craft to Constitution: A Governance-First Paradigm for Principled Agent Engineeringcited by 0
- 2026ReIn: Conversational Error Recovery with Reasoning Inceptioncited by 0
- 2026ContextLens: Modeling Imperfect Privacy and Safety Context for Legal Compliancecited by 0
- 2026Data Leakage Prevention in Agentic Applications via Preemptive Hardeningcited by 0
- 2026PASTABench: Proactive Assessment of Sequential Trajectories for Agent Safetycited by 0
- 2026PASTABench: Proactive Assessment of Sequential Trajectories for Agent Safety23 Sep 2026
- 2026Data Leakage Prevention in Agentic Applications via Preemptive Hardening21 Jul 2026
- 2026AutoRAS: Learning Robust Agentic Systems with Primitive Representations19 Jun 2026
- 2026Turning Bias into Bugs: Bandit-Guided Style Manipulation Attacks on LLM Judges24 May 2026
- 2026Large Language Models for Agentic NetOps and AIOps: Architectures, Evaluation, and Safety12 May 2026
- 2026WebTrap: Stealthy Mid-Task Hijacking of Browser Agents During Navigation8 May 2026
- 2026Needle-in-RAG: Prompt-Conditioned Character-Level Traceback of Poisoned Spans in Retrieved Evidence3 May 2026
- 2026SafeReview: Defending LLM-based Review Systems Against Adversarial Hidden Prompts29 Apr 2026
- 2026Visual Inception: Compromising Long-term Planning in Agentic Recommenders via Multimodal Memory Poisoning18 Apr 2026
- 2026ContextLens: Modeling Imperfect Privacy and Safety Context for Legal Compliance14 Apr 2026
- 2026Are GUI Agents Focused Enough? Automated Distraction via Semantic-level UI Element Injection9 Apr 2026
- 2026LLM-enabled Applications Require System-Level Threat Monitoring23 Feb 2026
19 more
- 2026ReIn: Conversational Error Recovery with Reasoning Inception19 Feb 2026
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injections17 Feb 2026
- 2026SkillJect: Effectively Automating Skill-Based Prompt Injection for Skill-Enabled Agents15 Feb 2026
- 2026AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Management7 Feb 2026
- 2026The Promptware Kill Chain: How Prompt Injections Gradually Evolved Into a Multistep Malware Delivery Mechanism14 Jan 2026
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsing8 Jan 2026
- 2025ContextLeak: Auditing Leakage in Private In-Context Learning Methods18 Dec 2025
- 2025EAGER: Edge-Aligned LLM Defense for Robust, Efficient, and Accurate Cybersecurity Question Answering24 Nov 2025
- 2025QueryIPI: Query-agnostic Indirect Prompt Injection on Coding Agents27 Oct 2025
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detection13 Oct 2025
- 2025From Craft to Constitution: A Governance-First Paradigm for Principled Agent Engineering12 Oct 2025
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injection2 Aug 2025
- 2025JavelinGuard: Low-Cost Transformer Architectures for LLM Security9 Jun 2025
- 2025To Protect the LLM Agent Against the Prompt Injection Attack with Polymorphic Prompt6 Jun 2025
- 2025Red Teaming the Mind of the Machine: A Systematic Evaluation of Prompt Injection and Jailbreak Vulnerabilities in LLMs7 May 2025
- 2025OET: Optimization-based prompt injection Evaluation Toolkit1 May 2025
- 2025Safety in Large Reasoning Models: A Survey24 Apr 2025
- 2025A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deployment22 Apr 2025
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systems31 Mar 2025
- 2025Advances and Challenges in Foundation Agents: From Brain-Inspired Intelligence to Evolutionary, Collaborative, and Safe Systemscited by 125
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injectionscited by 44
- 2025AgentArmor: Enforcing Program Analysis on Agent Runtime Trace to Defend Against Prompt Injectioncited by 39
- 2026SkillJect: Effectively Automating Skill-Based Prompt Injection for Skill-Enabled Agentscited by 20
- 2025To Protect the LLM Agent Against the Prompt Injection Attack with Polymorphic Promptcited by 14
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detectioncited by 11
- 2026AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Managementcited by 10
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsingcited by 8
- 2026Visual Inception: Compromising Long-term Planning in Agentic Recommenders via Multimodal Memory Poisoningcited by 4
- 2025QueryIPI: Query-agnostic Indirect Prompt Injection on Coding Agentscited by 2
- 2026Large Language Models for Agentic NetOps and AIOps: Architectures, Evaluation, and Safetycited by 2
- 2026Are GUI Agents Focused Enough? Automated Distraction via Semantic-level UI Element Injectioncited by 1
12 most cited of 15 All 15 (JSON)
- 2026PASTABench: Proactive Assessment of Sequential Trajectories for Agent Safety23 Sep 2026
- 2026Data Leakage Prevention in Agentic Applications via Preemptive Hardening21 Jul 2026
- 2026Large Language Models for Agentic NetOps and AIOps: Architectures, Evaluation, and Safety12 May 2026
- 2026Visual Inception: Compromising Long-term Planning in Agentic Recommenders via Multimodal Memory Poisoning18 Apr 2026
- 2026Are GUI Agents Focused Enough? Automated Distraction via Semantic-level UI Element Injection9 Apr 2026
- 2026Zombie Agents: Persistent Control of Self-Evolving LLM Agents via Self-Reinforcing Injections17 Feb 2026
- 2026SkillJect: Effectively Automating Skill-Based Prompt Injection for Skill-Enabled Agents15 Feb 2026
- 2026AgentSys: Secure and Dynamic LLM Agents Through Explicit Hierarchical Memory Management7 Feb 2026
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsing8 Jan 2026
- 2025QueryIPI: Query-agnostic Indirect Prompt Injection on Coding Agents27 Oct 2025
- 2025TraceAegis: Securing LLM-Based Agents via Hierarchical and Behavioral Anomaly Detection13 Oct 2025
- 2025From Craft to Constitution: A Governance-First Paradigm for Principled Agent Engineering12 Oct 2025
12 newest of 15 All 15 (JSON)
- 2025A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deploymentcited by 110
- 2025Safety in Large Reasoning Models: A Surveycited by 58
- 2026AutoRAS: Learning Robust Agentic Systems with Primitive Representationscited by 1
- 2026ReIn: Conversational Error Recovery with Reasoning Inceptioncited by 0
- 2026AutoRAS: Learning Robust Agentic Systems with Primitive Representations19 Jun 2026
- 2026ReIn: Conversational Error Recovery with Reasoning Inception19 Feb 2026
- 2025Safety in Large Reasoning Models: A Survey24 Apr 2025
- 2025A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deployment22 Apr 2025
- 2025Red Teaming the Mind of the Machine: A Systematic Evaluation of Prompt Injection and Jailbreak Vulnerabilities in LLMscited by 34
- 2026The Promptware Kill Chain: How Prompt Injections Gradually Evolved Into a Multistep Malware Delivery Mechanismcited by 7
- 2026SafeReview: Defending LLM-based Review Systems Against Adversarial Hidden Promptscited by 4
- 2025OET: Optimization-based prompt injection Evaluation Toolkitcited by 1
- 2026SafeReview: Defending LLM-based Review Systems Against Adversarial Hidden Prompts29 Apr 2026
- 2026The Promptware Kill Chain: How Prompt Injections Gradually Evolved Into a Multistep Malware Delivery Mechanism14 Jan 2026
- 2025Red Teaming the Mind of the Machine: A Systematic Evaluation of Prompt Injection and Jailbreak Vulnerabilities in LLMs7 May 2025
- 2025OET: Optimization-based prompt injection Evaluation Toolkit1 May 2025
- 2025JavelinGuard: Low-Cost Transformer Architectures for LLM Securitycited by 4
- 2025ContextLeak: Auditing Leakage in Private In-Context Learning Methodscited by 4
- 2026Turning Bias into Bugs: Bandit-Guided Style Manipulation Attacks on LLM Judgescited by 3
- 2026LLM-enabled Applications Require System-Level Threat Monitoringcited by 2
- 2026WebTrap: Stealthy Mid-Task Hijacking of Browser Agents During Navigationcited by 2
- 2026ContextLens: Modeling Imperfect Privacy and Safety Context for Legal Compliancecited by 0
- 2026Turning Bias into Bugs: Bandit-Guided Style Manipulation Attacks on LLM Judges24 May 2026
- 2026WebTrap: Stealthy Mid-Task Hijacking of Browser Agents During Navigation8 May 2026
- 2026ContextLens: Modeling Imperfect Privacy and Safety Context for Legal Compliance14 Apr 2026
- 2026LLM-enabled Applications Require System-Level Threat Monitoring23 Feb 2026
- 2025ContextLeak: Auditing Leakage in Private In-Context Learning Methods18 Dec 2025
- 2025JavelinGuard: Low-Cost Transformer Architectures for LLM Security9 Jun 2025