CommandSans: Securing AI Agents with Surgical Precision Prompt Sanitization
On the map: LLM agents and tool use → Agent threats, guardrails and governance
also in 1 more
Abstract (arXiv)
The increasing adoption of LLM agents with access to numerous tools and sensitive data significantly widens the attack surface for indirect prompt injections. Due to the context-dependent nature of attacks, however, current defenses are often ill-calibrated as they cannot reliably differentiate malicious and benign instructions, leading to high false positive rates that prevent their real-world adoption. To address this, we present a novel approach inspired by the fundamental principle of computer security: data should not contain executable instructions. Instead of sample-level classification, we propose a token-level sanitization process, which surgically removes any instructions directed at AI systems from tool outputs, capturing malicious instructions as a byproduct. In contrast to existing safety classifiers, this approach is non-blocking, does not require calibration, and is agnostic to the context of tool outputs. Further, we can train such token-level predictors with readily available instruction-tuning data only, and don't have to rely on unrealistic prompt injection examples from challenges or of other synthetic origin. In our experiments, we find that this approach generalizes well across a wide range of attacks and benchmarks like AgentDojo, BIPIA, InjecAgent, ASB and SEP, achieving a 7-10x reduction of attack success rate (ASR) (34% to 3% on AgentDojo), without impairing agent utility in both benign and malicious settings.
Key facts. Cited by 12 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 33 of its 49 references that are in the map. First posted on arXiv 9 Oct 2025.
Builds on
33 of 49 references.
Closest ancestors · 7
Same direction, newest first
- 2025BlindGuard: Safeguarding LLM-based Multi-Agent Systems under Unknown Attacks11 Aug
- 2025Design Patterns for Securing LLM Agents against Prompt Injections10 Jun
- 2025Defeating Prompt Injections by Design24 Mar
- 2025MELON: Provable Defense Against Indirect Prompt Injection Attacks in AI Agents7 Feb
- 2024The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agents21 Dec
- 2024Agent Security Bench (ASB): Formalizing and Benchmarking Attacks and Defenses in LLM-based Agents3 Oct
- 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar
Other references · 26
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2023GPT-4 Technical Reportcited by 18,396
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2019BERTScore: Evaluating Text Generation with BERTcited by 5,512
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2019Unsupervised Cross-lingual Representation Learning at Scalecited by 3,935
- 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
- 2024Qwen2 Technical Reportcited by 2,120
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,745
- 2016Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translationcited by 1,475
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,443
14 more
- 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 493
- 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 375
- 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 267
- 2023Benchmarking and Defending Against Indirect Prompt Injection Attacks on Large Language Modelscited by 264
- 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 210
- 2025Securing AI Agents with Information-Flow Controlcited by 121
- 2024Can LLMs Separate Instructions From Data? And What Do We Even Mean By That?cited by 81
- 2025Can Indirect Prompt Injection Attacks Be Detected and Removed?cited by 52
- 2025PromptShield: Deployable Detection for Prompt Injection Attackscited by 50
- 2025Defending Against Prompt Injection With a Few DefensiveTokenscited by 33
- 2025ASIDE: Architectural Separation of Instructions and Data in Language Modelscited by 24
- 2024FATH: Authentication-based Test-time Defense against Indirect Prompt Injection Attackscited by 22
- 2021Subword Pooling Makes a Differencecited by 18
- 2025Sentinel: SOTA model to protect against prompt injectionscited by 6
Built on by
Citing papers per year: 2026: 12.
12 papers.
- 2026From Untrusted Input to Trusted Memory: A Systematic Study of Memory Poisoning Attacks in LLM Agentscited by 33
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysiscited by 30
- 2026CausalArmor: Efficient Indirect Prompt Injection Guardrails via Causal Attributioncited by 14
- 2026Trojan Hippo: Weaponizing Agent Memory for Data Exfiltrationcited by 12
- 2026MPIB: A Benchmark for Medical Prompt Injection Attacks and Clinical Safety in LLMscited by 3
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedbackcited by 2
- 2026Security--Fidelity Tradeoffs: The Hidden Cost of Prompt Injection Defensecited by 2
- 2026CAGE: Certified Authorization under Typed-Return Uncertainty for Tool-Using Agentscited by 1
- 2026Silent Failures in Agentic Security Evaluation: A Validated Harness for Tool-Call Mediation Under Indirect Prompt Injectioncited by 1
- 2026CLASP: Defending Hybrid Large Language Models Against Hidden State Poisoning Attackscited by 0
- 2026PARSE: Provenance-Aware Retrieval Sanitization for Professional Domain LLM Agentscited by 0
- 2026Why LLM Agents Collapse Without Oversight: The Enforcement Gap as the Mechanism Behind Emergence World Failurescited by 0
- 2026Silent Failures in Agentic Security Evaluation: A Validated Harness for Tool-Call Mediation Under Indirect Prompt Injection26 Sep 2026
- 2026Why LLM Agents Collapse Without Oversight: The Enforcement Gap as the Mechanism Behind Emergence World Failures14 Sep 2026
- 2026CAGE: Certified Authorization under Typed-Return Uncertainty for Tool-Using Agents31 Jul 2026
- 2026Security--Fidelity Tradeoffs: The Hidden Cost of Prompt Injection Defense29 Jun 2026
- 2026PARSE: Provenance-Aware Retrieval Sanitization for Professional Domain LLM Agents16 Jun 2026
- 2026From Untrusted Input to Trusted Memory: A Systematic Study of Memory Poisoning Attacks in LLM Agents3 Jun 2026
- 2026Trust No Tool: Evaluating and Defending LLM Agents under Untrusted Tool Feedback17 May 2026
- 2026Trojan Hippo: Weaponizing Agent Memory for Data Exfiltration3 May 2026
- 2026CLASP: Defending Hybrid Large Language Models Against Hidden State Poisoning Attacks12 Mar 2026
- 2026The Landscape of Prompt Injection Threats in LLM Agents: From Taxonomy to Analysis11 Feb 2026
- 2026CausalArmor: Efficient Indirect Prompt Injection Guardrails via Causal Attribution8 Feb 2026
- 2026MPIB: A Benchmark for Medical Prompt Injection Attacks and Clinical Safety in LLMs6 Feb 2026
Similar, not cited
Close in wording, no citation either way
- 2025Soft Instruction De-escalation Defense
- 2026Defense Against Indirect Prompt Injection via Tool Result Parsing
- 2026Skill-Inject: Measuring Agent Vulnerability to Skill File Attacks
- 2025Agent Skills Enable a New Class of Realistic and Trivially Simple Prompt Injections
- 2026Architecting Secure AI Agents: Perspectives on System-Level Defenses Against Indirect Prompt Injection Attacks
- 2024Prompt Infection: LLM-to-LLM Prompt Injection within Multi-Agent Systems
- 2026Prompt Injection Attacks on Agentic Coding Assistants: A Systematic Analysis of Vulnerabilities in Skills, Tools, and Protocol Ecosystems
- 2026SecOPD: Mitigating Adaptive Prompt Injections by On-Policy Distillation