Indirect prompt injection
Indirect prompt injection is an attack in which instructions are hidden in content an AI system reads, such as a web page, email or document, so the model follows the attacker's commands instead of its user's.
In ordinary prompt injection, the person typing tries to trick the model. In the indirect form, the attacker never talks to the model at all. They plant instructions somewhere the model will later read: hidden text on a web page, a line in an email, a comment in a code repository or metadata in a document. When a user asks an AI assistant to summarise that page or deal with that inbox, the planted text enters the model's context and may be treated as a command.
The attack was set out in a February 2023 paper by Kai Greshake, Sahar Abdelnabi and colleagues, titled Not what you've signed up for. They argued that applications built on language models blur the line between data and instructions, so anyone who can put text in front of the model can steer it remotely. They demonstrated attacks on Bing's GPT-4-powered chat and on code-completion tools, and described outcomes including data theft, manipulation of what the assistant tells users, and self-spreading attacks.
OWASP gives a typical example. A user asks a chatbot to summarise a web page. The page contains hidden instructions telling the model to insert an image whose web address includes the user's private conversation. When the image loads, the conversation is sent to the attacker's server.
The danger grows with what the AI can do. A model that only writes text can be made to lie. An agent that can send email, browse, edit files or call other services can be made to act, which is why indirect prompt injection is regarded as one of the main security problems for AI agents. OWASP lists prompt injection first in its 2025 Top 10 for LLM applications and states that fool-proof prevention may not exist, given how models work.
Defences are layered rather than complete: marking external content as untrusted, filtering inputs and outputs, giving the model only the permissions it needs, and requiring human approval before high-risk actions. The working assumption for anyone building agents is that any content the model reads could contain an attack.
In direct prompt injection, the user types instructions intended to override the model's rules. In indirect prompt injection, the instructions are hidden in external content, such as a web page, email or file, that the model reads while doing a task. The user may be the victim rather than the attacker. Agents read content from the web, inboxes and documents and can take actions such as sending messages or changing files. A hidden instruction in that content can turn the agent against its own user, for example making it send private data to an attacker. The more tools and permissions an agent has, the more an injection can do. Not completely with current techniques. OWASP says it is not clear that fool-proof prevention exists, because models do not reliably separate instructions from data. Developers reduce the risk by limiting the model's permissions, isolating untrusted content, filtering outputs and requiring human confirmation for sensitive actions. The attack was described in detail in a February 2023 paper by Kai Greshake, Sahar Abdelnabi and colleagues, which demonstrated it against Bing's GPT-4-powered chat and other LLM-integrated applications.Common questions
What is the difference between direct and indirect prompt injection?
Why is indirect prompt injection dangerous for AI agents?
Can indirect prompt injection be prevented?
Who discovered indirect prompt injection?
Search for "indirect prompt injection", "OWASP LLM01" or "prompt injection AI agents" to follow the research and the defences. Reliable sources include the original papers on arXiv, the OWASP GenAI Security Project, security write-ups from AI developers and established security researchers, and guidance from national cyber agencies. Be cautious about products that claim to block all prompt injection; the leading references say no complete fix is known.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.