mlsanityData to 14 Oct 2026

ChatInject: Abusing Chat Templates for Prompt Injection in LLM Agents

arXiv 2509.22830 ↗First posted 26 Sep 2025cs.CLcited by 31

On the map: LLM agents and tool use → Agent threats, guardrails and governance

also in 1 more
Abstract (arXiv)

The growing deployment of large language model (LLM) based agents that interact with external environments has created new attack surfaces for adversarial manipulation. One major threat is indirect prompt injection, where attackers embed malicious instructions in external environment output, causing agents to interpret and execute them as if they were legitimate prompts. While previous research has focused primarily on plain-text injection attacks, we find a significant yet underexplored vulnerability: LLMs' dependence on structured chat templates and their susceptibility to contextual manipulation through persuasive multi-turn dialogues. To this end, we introduce ChatInject, an attack that formats malicious payloads to mimic native chat templates, thereby exploiting the model's inherent instruction-following tendencies. Building on this foundation, we develop a persuasion-driven Multi-turn variant that primes the agent across conversational turns to accept and execute otherwise suspicious actions. Through comprehensive experiments across frontier LLMs, we demonstrate three critical findings: (1) ChatInject achieves significantly higher average attack success rates than traditional prompt injection methods, improving from 5.18% to 32.05% on AgentDojo and from 15.13% to 45.90% on InjecAgent, with multi-turn dialogues showing particularly strong performance at average 52.33% success rate on InjecAgent, (2) chat-template-based payloads demonstrate strong transferability across models and remain effective even against closed-source LLMs, despite their unknown template structures, and (3) existing prompt-based defenses are largely ineffective against this attack approach, especially against Multi-turn variants. These findings highlight vulnerabilities in current agent systems.

Key facts. Cited by 31 papers in the map (data through 14 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 25 of its 37 references that are in the map. First posted on arXiv 26 Sep 2025.

Builds on

25 of 37 references.

Closest ancestors · 5

Same direction, newest first

  1. 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul
  2. 2025X-Teaming: Multi-Turn Jailbreaks and Defenses with Adaptive Multi-Agents15 Apr
  3. 2025Adaptive Attacks Break Defenses Against Indirect Prompt Injection Attacks on LLM Agents27 Feb
  4. 2024Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents3 Oct
  5. 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar

Other references · 20

  1. 2025Qwen3 Technical Reportcited by 8,820
  2. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
  3. 2024GPT-4o System Cardcited by 4,588
  4. 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,796
  5. 2025Gemma 3 Technical Reportcited by 1,824
  6. 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
  7. 2025gpt-oss-120b & gpt-oss-20b Model Cardcited by 1,386
  8. 2025BrowseComp: A Simple Yet Challenging Benchmark for Browsing Agentscited by 647
  9. 2024How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMscited by 573
  10. 2025Kimi K2: Open Agentic Intelligencecited by 567
  11. 2020On Adaptive Attacks to Adversarial Example Defensescited by 555
  12. 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 493
8 more
  1. 2025GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Modelscited by 467
  2. 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 267
  3. 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 210
  4. 2024LLM Defenses Are Not Robust to Multi-Turn Human Jailbreaks Yetcited by 151
  5. 2024Can LLMs Separate Instructions From Data? And What Do We Even Mean By That?cited by 81
  6. 2025Foot-In-The-Door: A Multi-turn Jailbreak for LLMscited by 54
  7. 2024ChatBug: A Common Vulnerability of Aligned LLMs Induced by Chat Templatescited by 30
  8. 2024On the Loss of Context-awareness in General Instruction Fine-tuningcited by 11

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 2; 2026: 29.

31 papers.

Sort:

By area:

  1. 2026Taming Various Privilege Escalation in LLM-Based Agent Systems: A Mandatory Access Control Frameworkcited by 54
  2. 2026AgentLAB: Benchmarking LLM Agents against Long-Horizon Attackscited by 39
  3. 2026ClawGuard: A Runtime Security Framework for Tool-Augmented LLM Agents Against Indirect Prompt Injectioncited by 27
  4. 2026Prompt Injection as Role Confusioncited by 17
  5. 2025SoK: Trust-Authorization Mismatch in LLM Agent Interactionscited by 11
  6. 2025Taxonomy, Evaluation and Exploitation of IPI-Centric LLM Agent Defense Frameworkscited by 9
  7. 2026What Matters For Safety Alignment?cited by 7
  8. 2026Safeguarding LLM Agents against Long-Horizon Threats via Shadow Memorycited by 7
  9. 2026IterInject: Indirect Prompt Injection Against LLM Agents via Feedback-Guided Iterative Optimizationcited by 7
  10. 2026Toward Secure LLM Agents: Threat Surfaces, Attacks, Defenses, and Evaluationcited by 7
  11. 2026Automating Agent Hijacking via Structural Template Injectioncited by 6
  12. 2026Evaluating Performance Drift from Model Switching in Multi-Turn LLM Systemscited by 6
19 more
  1. 2026Inference-Time Backdoors via Chat Templates: From LLM Supply Chains to Agentic System Compromisecited by 2
  2. 2026ToolHazard: Scaling Adversarial Environments for Security Evaluation and Alignment of LLM-based Agentscited by 2
  3. 2026CoER: Defending against Adaptive Indirect Prompt Injection via Adversarial Co-Evolution and Refinementcited by 2
  4. 2026Security Attack and Defense Strategies for Autonomous Agent Frameworks: A Layered Review with OpenClaw as a Case Studycited by 0
  5. 2026On the Geometric Limits of Transformer Defenses against Obfuscation Attacks: Latent Embedding Collapse & Performance Robustness Gapcited by 0
  6. 2026Evaluating using Mock Tool Calls to Quarantine Untrusted Prompt Inputscited by 0
  7. 2026Same Payload, Different Channel: Measuring Trust Asymmetry in Tool-Using Language Modelscited by 0
  8. 2026Local LLM Agents as Vulnerable Runtimes:A Source-Code Audit of the Agent Runtime Layercited by 0
  9. 2026Pigeonholing: how bad prompts hurt models, causing collapse and mistakescited by 0
  10. 2026IHDec: Divergence-Steered Contrastive Decoding for Securing Multi-Turn Instruction Hierarchiescited by 0
  11. 2026Know Your Agent: Reconnaissance-Driven Pentesting of AI Agentscited by 0
  12. 2026Workspace Topology as an Attack Vector in Agentic Coding Assistantscited by 0
  13. 2026WebMCP-Phalanx: Enforcing and Characterizing Trust Boundaries for Browser-Integrated LLM Agentscited by 0
  14. 2026Will the User Ever Know? Covert Indirect Prompt Injection Attacks on Tool-Using LLM Agentscited by 0
  15. 2026Control-Token Injection Suppresses Chain-of-Thought and Defeats Reasoning-Based Oversight in Tool-Using Agentscited by 0
  16. 2026Prefilling the Reasoning Channel: Output-Prefix Attacks on Reasoning LLMscited by 0
  17. 2026Epistemic Policy Divergence in Multi-Turn LLM Contamination: A Protocol-Gradient Investigationcited by 0
  18. 2026Same Bytes, Different Authority: Reserved-Token Representations in Chat-Template Prompt Injectioncited by 0
  19. 2026Render Before Reading: Visual Rendering as a Prompt Injection Defensecited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2025Breaking the Prompt Wall (I): A Real-World Case Study of Attacking ChatGPT via Lightweight Prompt Injection
  2. 2024An Early Categorization of Prompt Injection Attacks on Large Language Models
  3. 2025Dialogue Injection Attack: Jailbreaking LLMs through Context Manipulation
  4. 2025When AI Meets the Web: Prompt Injection Risks in Third-Party AI Chatbot Plugins
  5. 2024Automatic and Universal Prompt Injection Attacks against Large Language Models
  6. 2023Ignore This Title and HackAPrompt: Exposing Systemic Vulnerabilities of LLMs through a Global Scale Prompt Hacking Competition
  7. 2026TEMPLATEFUZZ: Fine-Grained Chat Template Fuzzing for Jailbreaking and Red Teaming LLMs
  8. 2026A Layered Security Framework Against Prompt Injection in RAG-Based Chatbots