QueryIPI: Query-agnostic Indirect Prompt Injection on Coding Agents
This paper introduces QueryIPI, an automated framework that achieves query-agnostic Indirect Prompt Injection on coding agents by optimizing malicious tool descriptions within invariant prompt contexts, demonstrating high success rates and real-world transferability.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a super-smart digital assistant living inside your computer. This assistant (a "coding agent") is incredibly powerful: it can write code, manage files, and even run commands on your computer's operating system. It's like having a highly skilled mechanic who not only fixes your car but also has the keys to your entire garage and the ability to order new parts.
This paper introduces a new, scary way to hack this assistant, called QueryIPI.
Here is the breakdown of how it works, using simple analogies:
1. The Old Way vs. The New Way
The Old Way (Query-Specific Attack):
Imagine a thief trying to trick your mechanic. In the past, the thief had to wait for you to ask a very specific question, like, "Can you build a maze game?" Only then would the thief slip a hidden note into the mechanic's instructions saying, "While building the maze, also delete all my files."
- The Problem: If you asked, "Can you fix my printer?" the thief's trick wouldn't work. The attack only happened if you asked the exact right question. It was unreliable.
The New Way (Query-Agnostic Attack - QueryIPI):
The researchers found a way to make the trick work no matter what you ask. Whether you ask for a maze, a printer fix, or a weather report, the hidden instruction triggers automatically.
- The Result: The assistant is compromised 100% of the time, regardless of what you are trying to do.
2. How Did They Do It? (The Secret Sauce)
The researchers realized that the assistant has two types of "instructions" it reads:
- Your Questions: These change every time (like the weather).
- The System Manual: This is a permanent document the assistant always reads. It contains its core rules, its job description, and a list of tools it is allowed to use.
The Insight:
The attackers realized that instead of trying to match their trick to your changing questions (which is hard), they should match their trick to the permanent System Manual.
They treated the System Manual as a "constant" or an "invariant." By studying this manual (which they found leaked online or extracted from the software), they crafted a fake tool description that looked exactly like a legitimate part of the assistant's own manual.
3. The "QueryIPI" Factory
The paper describes an automated system called QueryIPI that acts like a master forger. Here is how it works:
- Step 1: The Seed (The First Draft): The system looks at the leaked System Manual. It sees how the assistant talks and what tools it uses. It then writes a fake tool description that sounds exactly like the assistant's own voice. It's like a forger studying a bank's official letterhead to make a fake check that looks 100% real.
- Step 2: The Trial and Error (Iterative Reflection): The system tries this fake tool on the assistant with many different questions.
- If the assistant ignores it: The system rewrites the tool to be more obvious.
- If the assistant says "No, that's unsafe": The system looks at the System Manual again to see which safety rule was triggered, then rewrites the tool to sneak past that specific rule.
- Step 3: The Final Product: After many rounds of testing and tweaking, the system produces a "perfect" fake tool description.
4. The Results
The researchers tested this on five popular coding assistants (like Cursor, Copilot, and Windsurf).
- In the Lab: When they simulated these assistants, their method worked incredibly well. With just a few practice runs, they achieved a 70% to 87% success rate in making the assistants execute malicious commands (like deleting files or stealing data).
- In the Real World: They took the "perfect" fake tools they made in the lab and tested them on the actual real-world software. Even though the real software had extra defenses, the attack still worked 50% of the time. This is huge because previous methods barely worked at all in the real world.
5. Why This Matters
The paper concludes that the biggest risk isn't just the hackers; it's the leaked internal manuals. Because these coding assistants' "System Manuals" are often leaked or can be stolen, attackers can use them to build "universal keys" that unlock the assistant's dangerous capabilities no matter what the user is doing.
In short: The paper shows that if an attacker knows the "rulebook" of a coding assistant, they can write a fake rule that tricks the assistant into doing bad things, even when the user is asking innocent questions. It turns a "conditional" hack into a "guaranteed" hack.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.