The MOSAIC framework uses CLI command combination attacks against coding agents, achieving a success rate of 96.59%MOSAIC: Knowledge-Guided CLI Command Composition Attack in LLM Coding Agents
Translation in progress — untranslated text is omitted.
Researchers from Sun Yat-sen University, Shandong University, Peking University, and Hong Kong University of Science and Technology propose MOSAIC, a knowledge-guided framework that distills CVEs, security advisories, and researcher PoCs into reusable command-state summaries, then combines them into attack paths and instantiates them as real development workflows, for black-box evaluation of coding agents' CLI command composition risk (CCR). Across five coding agents—Claude Code, Codex CLI, Gemini CLI, GitHub Copilot CLI, and Trae Agent—and five backend LLMs, totaling 2,525 trials, MOSAIC achieves a 96.59% end-to-end attack success rate under benign development tasks, while the matched instruction-layer baselines AIShellJack and generic indirect prompt injection achieve only 2.18% and 0.79%, respectively. The authors state that the structured knowledge base is key, improving effective attack generation by over 50% compared to a pure LLM generator.
- Coding agents invoke multiple CLI commands through shared operating system state to complete tasks. A single seemingly benign command can, through producer-consumer state passing, combine across command trajectories into security-sensitive capabilities beyond the user's task scope, forming an overlooked CLI command combination risk (CCR).
- MOSAIC extracts command-state summaries from CVEs, security advisories, and PoCs and classifies them into 13 families; by enumerating dependency chains and feasibility checks, it combines valid state transitions into attack paths; then it uses LLMs to generate aligned benign prompts, malicious resources, and expected command sequences, and determines attack success through external effects in black-box execution.
- In 2,525 trials across 5 code agents and 5 backend LLMs, MOSAIC achieves a 96.59% end-to-end ASR, far higher than the two instruction-layer baselines (up to 2.18%); among 5 types of existing defenses, 3 types have an ASR reduction of 0.00 percentage points, and under the strongest defense, 82.57% of attacks still succeed.
- The study evaluated 101 evidence-based exploitation paths, not exhausting all CLI combination strategies; experiments covered 5 coding agents and 5 backend LLMs; the knowledge base construction phase relied on human final confirmation of candidate entries; defense analysis covered only 5 selected tools on a single agent.
The paper proposes CLI command combination risk, distills a knowledge base from CVEs and PoCs to generate attack chains, reports success rates on five coding agents, and tests five defenses.
Related events and news
0 events · 1 news mentions
News that mentions this paper
- Adversa AIcites the paper's id or linkAdversa AI 汇总 2026 年 8 月 AI 编码 Agent 安全资源
MOSAIC: knowledge-guided CLI command composition attack in LLM coding agents