For agents handling untrusted content, one more pattern is worth knowing.
Split the work between a privileged model that sees sensitive data and can call tools, and an unprivileged model that processes untrusted external content and cannot. The untrusted content never reaches the model holding the capabilities, so an injection in a scraped web page or an inbound email cannot directly drive a tool call.
It costs an extra call and a more complex orchestration. For an agent that reads inbound email and takes action, it is the difference between a design that can be hijacked by anyone who can send you a message and one that cannot.
Chapter 13 built the markdown image filter. It belongs here too, because retrieval and agents are what make it exploitable.
EchoLeak, CVE-2025-32711, is the worked example. A crafted email reached Microsoft 365 Copilot's context through ordinary ingestion. Reference-style markdown slipped past link redaction. Auto-fetched images carried data out. Zero clicks. Microsoft patched it server-side in June 2025 and reported no exploitation in the wild, so treat it as a proven technique rather than an open hole.
Every element was a normal feature. Ingest email so the assistant is useful. Render markdown so answers look good. Fetch images so they display. The vulnerability lived in the combination, which is why a control on any single component would have missed it, and why the output filter belongs at the gateway where it sees the assembled result.
If your application renders model output and your model reads content you did not author, you have this shape. Allowlist the hosts your renderer will fetch from, and treat every URL in a completion as attacker-controlled until proven otherwise.
| Control | Effort | Closes |
|---|---|---|
| Add provenance metadata to chunks | Low | Erasure, partitioning |
| Apply the caller's filter inside the search | Low | Cross-tenant retrieval |
| De-identify at ingestion | Medium | Bulk exposure in the index |
| Output host allowlist | Low | Rendered exfiltration |
| Audit tool calls | Low | Blind exfiltration |
| Capability-limit agents | Medium | Injection blast radius |
| Dual-model separation | High | Injection from untrusted content |
The first two are afternoons and they close the highest-volume failure in most RAG applications. Start there.
Four doors are shut. The fifth is the widest, the cheapest to close, and the one almost nobody has looked at.
The deletion and provenance guidance, the argument for filtering inside the search rather than after it, and the priority table at the end are the author's engineering positions.
Download the full PDF for free?
Free download — no account required