Piling on prompt injection defences often stops AI agents doing their real work
A preprint tests 66 combinations of published defences for tool-using AI agents. Deeper stacks often stopped attacks by stopping the agent's real work, and the authors propose 11 rules to repair the handoffs between defences.
scienceunderway.com/articles/piling-on-prompt-injection-defences-often-stops-ai-agents-doing-their-real-work

AI illustrationWhat the study shows
The study looks at indirect prompt injection. This is when malicious instructions are hidden in a web page, email or file that an AI agent reads while doing a task. The agent may then follow the attacker instead of the user. Many defences exist, but each has usually been tested alone.
The authors, from Huazhong University of Science and Technology and The Hong Kong Polytechnic University, wrapped 13 published defences in one test harness. Some rewrite or mark untrusted text. Some limit which tools the agent may use. Some check each proposed action, and some clean the content tools return. They tested 66 ordered combinations on AgentDojo, a public benchmark of banking, travel, workspace and Slack tasks, using Google's Gemini-2.5-Flash. The full study covers about 26,000 agent runs. It is a preprint and has not been peer reviewed.
The authors report that more layers did not buy more safety. A two-defence pair, Delimiters plus ToolFilter, let 0.4% of attacks through and completed 77.5% of normal tasks. It also used fewer tokens than the undefended agent. A four-defence stack let no fixed attacks through, but completed only 5% of normal tasks. The undefended agent completed 80%.
Against attacks written for each stack's exact defence order, the light pair and the four-defence stack both let 8% of attacks through. An automated attacker found at least one bypass for every stack it tried, within five attempts per task.
The authors examined the 38 normal tasks the four-defence stack failed. In 30 of them, no single defence caused the failure. It appeared only when defences ran together. They group these into three patterns. One defence strips or rewrites information a later one needs. Defences run in an order that clashes. Or a defence changes more than it should, such as a file ID. In one example, a defence that tags untrusted text turned file ID "3" into a tagged string, and the file tool then reported that the file did not exist.
Fixing the handoffs by hand raised the four-defence stack's normal task completion from 5% to 35%, with no successful fixed attacks. The authors then wrote ten rules from these fixes, added one rule for choosing stacks, and gave all 11 to OpenAI's Codex coding agent as a reusable skill. On six two-defence stacks not used to write the rules, rule-guided repairs completed about 15 percentage points more tasks under attack than repairs made from source code alone.
Our reading
In our reading, the most useful result is not the rules but the measurement warning. A defence stack that blocks every attack by blocking almost every task looks perfect on the usual headline metric, attack success rate. This study shows that happening, with traces that explain why. Any security score for an agent should come with a task completion score measured on the same runs.
The second lesson is that order and interfaces matter as much as the choice of defences. Several failures were small and mechanical: a tag that pushed short names over a length threshold, a cleaner that deleted boundary markers another defence had added, a paraphraser that changed a message the user wanted sent word for word. These are the kind of bugs integration testing usually catches. They are easy to miss here because each defence works fine on its own.
A concrete case: a company that wraps its email assistant in a paraphraser and an action checker may find that requests to send exact wording quietly fail. Attack metrics would still look excellent. The fix the authors suggest is simple: keep the user's original request available to every later check.
The rest of this story is for members. Membership is free: read it at scienceunderway.com/articles/piling-on-prompt-injection-defences-often-stops-ai-agents-doing-their-real-work
Read the rest of this story
Membership is free. You get every article in full, and can save stories and follow topics.
We send a sign-in link, no password needed. Already a member? Sign inReadiness assessment
| Level | Status | Evidence |
|---|---|---|
| I Lab only | Met | A working harness, a failure taxonomy and a repair workflow were built and run in controlled benchmark environments. |
| II Benchmarked | Met | Results are reported on the public AgentDojo benchmark (66 variants) and on DTap, with comparisons against an undefended agent and reference defences. |
| III Open source | Met | The authors say the workflow is released as an open-source Codex skill, and the ethics appendix mentions released artefacts. No repository link appears in the paper text, so this rests on the authors' statement. |
| IV In production | Not yet | There is no documented use by a named organisation. The authors state they did not test deployed services. |
What would move it up
Documented use of the rules or Codex skill by a named organisation to configure defences in a production agent, with reported effects on task completion and attacks. A public repository link would also confirm level III.
The study
Jiahe Chen, Mengdi Li, Junjie Huang et al. DefenseComposer: Knowledge-Guided Defense Stacking Against Indirect Prompt Injection. arXiv, 27 November 2026. arXiv:2611.37071
Notes
- Chen, Li, Huang, Han and Li, "DefenseComposer: Knowledge-Guided Defense Stacking Against Indirect Prompt Injection", arXiv preprint, 27 November 2026. Source
- Key primary figures on AgentDojo with Gemini-2.5-Flash: undefended agent 80.0% normal task completion and 13.3% attack success; Delimiters+ToolFilter 77.5% and 0.4% at 0.60x tokens; four-defence stack (Spotlighting+PromptArmor+TaskShield+CommandSans) 5.0% and 0.0%.
- Repair transfer results: rule-guided Codex repairs raised normal completion from 85.4% to 100.0% and completion under attack from 71.9% to 87.2%, compared with repairs from source code alone, on six two-defence stacks with eight tasks each.
- AgentDojo benchmark (Debenedetti et al., NeurIPS 2024 Datasets and Benchmarks). Source
- The authors state the workflow is released as an open-source Codex skill; the paper gives no repository link.
Edited and signed by
Stefan PerdalFounder. Twenty-five years of building digital products.220 stories editedStefan read the study, set the readiness level and approved this story. An AI system found the paper and wrote the first draft.
How this was made
An AI model read the study and wrote this article in the structure Science Underway uses. An editor reviewed it and approved it for publication. Check the original study before you rely on the details.
No corrections to this article. Found an error? Report it.


