attack arXiv Oct 27, 2025 · Oct 2025
Yuchong Xie, Zesen Liu, Mingyu Luo et al. · The Hong Kong University of Science and Technology · Fudan University +1 more
Query-agnostic indirect prompt injection on coding agents via optimized malicious tool descriptions, achieving 87% attack success rate
Prompt Injection Insecure Plugin Design nlp
Modern coding agents integrated into IDEs orchestrate powerful tools and high-privilege system access, creating a high-stakes attack surface. Prior work on Indirect Prompt Injection (IPI) is mainly query-specific, requiring particular user queries as triggers and leading to poor generalizability. We propose query-agnostic IPI, a new attack paradigm that reliably executes malicious payloads under arbitrary user queries. Our key insight is that malicious payloads should leverage the invariant prompt context (i.e., system prompt and tool descriptions) rather than variant user queries. We present QueryIPI, an automated framework that uses tool descriptions as optimizable payloads and refines them via iterative, prompt-based blackbox optimization. QueryIPI leverages system invariants for initial seed generation aligned with agent conventions, and iterative reflection to resolve instruction-following failures and safety refusals. Experiments on five simulated agents show that QueryIPI achieves up to 87% success rate, outperforming the best baseline (50%). Crucially, generated malicious descriptions transfer to real-world coding agents, highlighting a practical security risk.
llm The Hong Kong University of Science and Technology · Fudan University · Tsinghua University