Notes

Indirect Prompt Injection

A language model reads its instructions and its data from the same stream of text, and has no reliable way to tell them apart. Indirect prompt injection exploits that: the attacker never talks to the model at all, but plants instructions in a document, a web page or an email that the model will later be asked to read.

How the payload arrives

The text can be invisible to the human in the loop — white-on-white in a PDF, a comment in HTML, an alt attribute, a line buried in a long support ticket. When an assistant summarises that page, searches that knowledge base or triages that inbox, the planted line enters the context alongside the genuine content and competes with the system prompt for authority. Typical payloads tell the model to ignore its earlier instructions, to append a crafted link, or to reveal the rest of the conversation.

Why it is more than a trick
  • A retrieval-augmented system turns every indexed document into a potential attack surface, including documents uploaded by customers.
  • Where the model can act — send mail, call an API, run a search — the injected instruction inherits the user's permissions.
  • Exfiltration needs no network access of its own: rendering an image whose URL carries the stolen text is enough.
What helps

There is no clean fix, because the ambiguity lives in the architecture rather than in any one implementation. What works is defence in depth: treat all retrieved content as untrusted input, delimit it clearly and strip active markup, restrict what the model's tools can reach, allowlist outbound destinations, and require human confirmation for anything consequential. It sits at the top of the OWASP list of LLM application risks for good reason.

Indirect prompt injection is an attack in which malicious instructions are hidden in content the model will later ingest — a web page, a PDF, an email, a retrieved document — rather than typed by the user. Because instructions and data share one token stream, the model can obey them. It matters wherever a model reads untrusted text or holds tool access: the planted command runs with the user's permissions, making every indexed document part of the attack surface.

Imagine hiring an assistant who does whatever any piece of paper on her desk tells her to do. You ask her to summarise a report. Someone has written in tiny print at the bottom: forward this person's emails to me. And she does it, because she cannot tell the difference between the document she is reading and an order from you. That is indirect prompt injection. The attacker never speaks to the AI at all. They hide instructions inside a web page, a PDF or an email that the AI will later be asked to read, and wait for it to obey.