MOSAIC: Knowledge-Guided CLI Command Composition Attack in LLM Coding Agents
On the map: LLM agents and tool use → Agent threats, guardrails and governance
Abstract (arXiv)
LLM coding agents increasingly complete development tasks by issuing ordinary CLI commands. Following the Unix design, these commands cooperate through shared operating-system state: one command may write state that a later command reads. While this composition is benign and intended, it creates an overlooked exploit surface. Existing attacks and defenses mainly target the instruction layer, where malicious intent appears as hostile text. In contrast, we observe that individually benign commands can form a dangerous producer-consumer state relation across the command trace, exposing what we call CLI command-composition risk (CCR). Given this new attack surface, it is critical to systematically uncover and characterize the impact of CCR in real-world coding agents. However, systematically understanding this risk is quite challenging, because naive command enumeration and end-to-end LLM generation produce mostly invalid workflows. We present MOSAIC, a knowledge-guided framework that distills validated command-state behaviors from CVEs, advisories, and researcher PoCs into reusable summaries, composes them into exploit paths, and instantiates them as realistic developer workflows for black-box agent evaluation. Across five real-world CLI coding agents and five backend LLMs over 2,525 trials, MOSAIC achieves a 96.59% attack success rate under benign developer tasks.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 28 of its 57 references that are in the map. First posted on arXiv 3 Jul 2026.
Builds on
28 of 57 references.
Closest ancestors · 10
Same direction, newest first
- 2025WAInjectBench: Benchmarking Prompt Injection Detections for Web Agents1 Oct
- 2025"Your AI, My Shell": Demystifying Prompt Injection Attacks on Agentic AI Coding Editors26 Sep
- 2025PromptArmor: Simple yet Effective Prompt Injection Defenses21 Jul
- 2025DRIFT: Dynamic Rule-Based Defense with Injection Isolation for Securing LLM Agents13 Jun
- 2025LlamaFirewall: An open source guardrail system for building secure AI agents6 May
- 2025WASP: Benchmarking Web Agent Security Against Prompt Injection Attacks22 Apr
- 2025Defeating Prompt Injections by Design24 Mar
- 2025Prompt Flow Integrity to Prevent Privilege Escalation in LLM Agents17 Mar
- 2024The Task Shield: Enforcing Task Alignment to Defend Against Indirect Prompt Injection in LLM Agents21 Dec
- 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agents5 Mar
Other references · 18
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
- 2023GPQA: A Graduate-Level Google-Proof Q&A Benchmarkcited by 2,748
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,339
- 2022Ignore Previous Prompt: Attack Techniques For Language Modelscited by 760
- 2023Prompt Injection attack against LLM-integrated Applicationscited by 568
- 2026Terminal-Bench: Benchmarking Agents on Hard, Realistic Tasks in Command Line Interfacescited by 515
- 2024The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructionscited by 441
- 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 328
- 2024StruQ: Defending Against Prompt Injection with Structured Queriescited by 325
- 2024Defending Against Indirect Prompt Injection Attacks With Spotlightingcited by 233
- 2024SecAlign: Defending Against Prompt Injection with Preference Optimizationcited by 179
6 more
- 2025Securing AI Agents with Information-Flow Controlcited by 108
- 2025Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scalingcited by 93
- 2023Jatmo: Prompt Injection Defense by Task-Specific Finetuningcited by 89
- 2024Instructional Segment Embedding: Improving LLM Safety with Instruction Hierarchycited by 62
- 2025Contextual Agent Security: A Policy for Every Purposecited by 55
- 2023Demystifying RCE Vulnerabilities in LLM-Integrated Appscited by 35
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Your Harness is Not Secure: Benchmarking Real-world Threat of Command Line Interface Agent
- 2026MOSAIC-Bench: Measuring Compositional Vulnerability Induction in Coding Agents
- 2026You Told Me to Do It: Measuring Instructional Text-induced Private Data Leakage in LLM Agents
- 2026Towards a Risk Assessment of Malicious Skill Files in Coding Agents
- 2026Securing LLM Agents Need Intent-to-Execution Integrity
- 2026Evaluation and Hardening of LLM System Instructions Against Extraction via Encoding Attacks
- 2026SkillBloat: Token Amplification Attacks via Skill Injection in LLM Coding Agents
- 2026CIBER: A Comprehensive Benchmark for Security Evaluation of Code Interpreter Agents