What is Indirect Prompt Injection?
Indirect prompt injection, told as a story about the chef reading a command hidden not by the guest, but on the ingredient wrapper.
The guest asked plainly — the note was sitting on the wrapper instead.The guest didn't write the note. The wrapper was already sitting in the pantry.
The chef reads whatever is on the wrapper as if the guest said it.The guest only said 'as the wrapper says'. Every word on that wrapper can become a command.
Indirect injection is a command hidden in outside material the model reads later.Not written by the guest — it was already waiting inside material the guest only pointed to.
Direct injection is one path; indirect injection crosses two.Guest to material, material to chef. The attacker never even has to speak to the guest.
Direct and indirect injection differ only in where the command hides.The more errands fetch search results or documents, the more places there are to hide.
Indirect prompt injection = a command hidden not by the guest, but in outside material the chef goes to read later — a wrapper, search results, a document.
An attack where an attacker's instructions sit inside content an LLM or agent fetches from outside — search results, a web page, a document — and get executed when the model reads it. The user never wrote or even saw the malicious text, which makes it harder to notice than direct injection.
When grown-ups say it
- Indirect Prompt Injection
- A note hidden inside the ingredient wrapper. Not written by the guest — it waits inside the material beforehand.
- Direct Injection
- A note slipped straight into the ticket. The neighboring term — only the hiding place differs. → The Note Slipped Behind the Order
- RAG (retrieval)
- Using fetched material as an ingredient, as-is. The underlying AI concept. → What is RAG?
- Tool or Errand Results
- It can hide even inside a document the runner brings back. The more autonomous the agent, the more material it fetches.
- Supply Chain
- The wrapper already sitting on the shelf. The ingredient can be targeted from the moment it enters the pantry.
- Trust Boundary
- 'The guest's words' and 'the wrapper's words' shouldn't share the same trust. Wrapper text should describe the ingredient — never become a command.
- Guardrail (action limits)
- One more check after reading, before any errand runs. Even if the fetched material asked for it, the errand gets re-checked first.
- Prompt Injection (overview)
- The kitchen's first weak point. The whole picture starts here. → The Kitchen That Takes Any Order