What is indirect prompt injection?
An indirect prompt injection is an attack in which the adversary slips an instruction into an email, an incident ticket, a web page or a shared file, then waits for an authorized internal agent to process that document. It works because a language model receives system instructions, the user's request and third-party text in a single sequence of tokens, with no watertight boundary between "what I must do" and "what I must read". In February 2023, Kai Greshake and his coauthors formalized this vector in the founding study Not what you've signed up for.
Kai Greshake, Sahar Abdelnabi, Shailendra Mishra, Christoph Endres, Thorsten Holz and Mario Fritz set it out in Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. Their demonstration starts from a structural finding: once an application connects a language model to external sources, the separation between instruction code and processed data disappears. An attacker can therefore hide their own orders in content the application will consult, and take control of the session remotely. The researchers validated their attacks on Bing Chat (powered by GPT-4) and on representative application integrations. They documented three main families of impact: exfiltration of confidential information, self-replicating attacks and poisoning of the sources consulted. They also found no reliable countermeasure at the time.
Indirect prompt injection is not an isolated bug that a patch will close. It follows from the nature of a system that interprets text to trigger actions.
Direct or indirect: who holds the keyboard
OWASP places prompt injection at the top of its ranking of application risks for language models (LLM01). Its general definition covers any situation in which an input changes the model's behavior or output in a way its designers did not intend. For the indirect variant, OWASP uses one sentence: it occurs when the model ingests data from external sources such as websites or files.
The operational difference between the two variants lies in where the incoming flow comes from. In a direct injection, the attacker faces the conversational interface: they hold an account, they authenticate and their rights can be revoked. In an indirect injection, the logged-in user is the victim. They simply ask their agent to summarize overdue emails, work through a ticket queue or sum up a case file. The author of the attack operates from outside, with no privilege on your infrastructure.
In its analysis of July 29, 2025, the Microsoft Security Response Center describes this attack as the process by which a third party alters the output of an instruction-following model by injecting, inside external data, text that the model interprets as a legitimate instruction. An agent's exposure surface is therefore no longer limited to its user interface. It takes in every email received, every attachment, every web page consulted, every connector description and every tool return.
The table sums up what separates the two variants from the defender's point of view.
| Direct injection | Indirect injection | |
|---|---|---|
| Who writes the instruction | The user, in the interface | A third party, in a page, an email, a ticket or a tool description |
| Where it arrives | In the conversation | In the data the agent reads to do its task |
| Who the victim is | The vendor or the company, facing a hostile user | The legitimate user, who asked for nothing of the kind |
| What the attacker holds | An account, which can be identified and revoked | No privilege on your infrastructure |
| What the user sees | Their own request | Often nothing: the text is invisible or buried in the document |
| Where the defense applies | Authentication, quotas, moderation of requests | The action the agent is about to take, judged before it leaves |
The same word covers another debate, that of the jailbreak: making the model say what it refuses to say. Jailbreak or prompt injection offers a test to tell them apart. The case that concentrates the most risk today is the browser whose agent reads the web in place of the user, covered in agentic browsers in the enterprise.
Three public cases
Bing Chat, 2023: a consumer product, tested in the lab
The work of Greshake and his coauthors was not confined to laboratory mock-ups: their injection scenarios were successfully demonstrated on Bing Chat in production. The lesson set out in 2023 recurs unchanged in every later incident. The offensive payload sits in the remote resource the assistant retrieves, not in the request the user makes.
GitHub and MCP, May 2025: a public ticket, private repositories
On May 26, 2025, researchers at Invariant Labs documented the compromise of an agent connected to GitHub's official MCP server. The attack begins with a booby-trapped ticket (issue) opened on a public repository of the target. When the developer then asks their agent to process the project's tickets, the model reads the hidden instruction, goes through the private repositories the account can access, then publishes that confidential information itself in a pull request created on the public repository, where the attacker only has to collect it. The experiment exfiltrated the contents of private repositories as well as personal data from the test account.
Yet each of these individual operations fell within the rights granted to the agent: reading public tickets, consulting private repositories and opening a pull request were all among its legitimate functions. No authentication secret was stolen. As the authors point out, the attack requires only three conditions common in companies: a public repository open to external reports, an agent holding a multi-repository token and the "always allow" mode, by which the user delegates execution without confirmation.
EchoLeak, 2025: the email that is never opened
Under the name EchoLeak (CVE-2025-32711), Pavan Reddy and Aditya Sanjay Gujral published in September 2025 the analysis of a critical vulnerability in Microsoft 365 Copilot. It is a zero-click prompt injection chain that remotely and without authentication exfiltrates internal data through a single forged email, crossing the model's trust boundaries without any action by the victim. To succeed, the exploit bypasses several internal barriers in turn, including the XPIA security classifier deployed by Microsoft.
The main interest of this case lies not in a lapse of vigilance by the vendor but in the mechanics of the vector itself. A single incoming email is enough to trigger the leak, precisely because the job of a mail assistant is to read the mail it receives.
Why isn't a filter enough?
Faced with this risk, most teams begin by inserting an input classifier meant to spot injection phrasing before it reaches the main model. This filtering stops the crudest attacks, but it is never a watertight barrier, and the leading players in the field agree on that.
- Simon Willison sums up the state of the art on June 16, 2025: "we still don't know how to 100% reliably prevent this from happening".
- Anthropic reaches the same finding on November 24, 2025 about browsing agents: "No browser agent is immune to prompt injection". It stresses that even a residual success rate brought down to 1% remains a major risk in production.
- CERT-FR notes in its bulletin of April 13, 2026 that careful defensive prompt writing helps reduce the risk but can still be bypassed by injection attacks.
- The EchoLeak case supplies the empirical proof: the exploitation chain directly bypassed the XPIA classifier that was built to intercept these injections.
The limit is statistical. An enterprise agent works through thousands of external documents every week. A probabilistic filter that blocks 99% of attempts lets the hundredth through, and one successful execution is all the attacker needs. When the stake is a bank transfer or the extraction of a customer database, an input filter does not remove the risk. It only delays the day it materializes.
Microsoft arrives at exactly this engineering rule in its publication of July 29, 2025: security must rest first on deterministic controls able to give strict guarantees, with probabilistic classifiers serving only as defense in depth.
What makes the attack useful to the attacker
Fooling a language model gains the adversary nothing if the agent has no way to act or to extract what it sees. The operational danger of injection comes from the combination of three factors that Simon Willison calls the "lethal trifecta": access to confidential data, ingestion of external content the agent does not control and a communication channel to the outside. Both the GitHub MCP compromise and the EchoLeak chain rest on these three properties coexisting in a single agent.
This reading moves the cursor on accreditation. To the question "Can the model be fooled?", the technical answer is always yes. The only relevant question for a CISO becomes: what can the agent do the day it is fooled? The answer to that question is read in the agent's tool rights, whatever model was chosen and however fine its system prompt.
The defenses that hold
OWASP's LLM01 entry lists seven families of countermeasures against prompt injection: constrain the model's behavior, enforce and validate strict output formats, filter inputs and outputs, apply least privilege to tools, require human approval for sensitive operations, segregate and mark external content, and run adversarial penetration tests. Marking and filters lower the probability that an injection succeeds. Only least privilege and deterministic control of actions reduce the real impact on the day the model gives way.
- Break the coexistence of the three factors. An agent that reads uncontrolled external sources loses any channel for writing or sending freely to the outside. Conversely, an agent allowed to communicate outward consults only verified internal sources.
- Size privileges to the task, not to the user. An agent dedicated to sorting public tickets gets no right to read private repositories, in line with CERT-FR's requirement to restrict tools to the strict minimum.
- Control the outgoing tool call rather than the incoming text. The security engine evaluates the requested operation, its recipient, the sensitivity of the data handled and the sources read during the session. Blocking the writing of private data to a public repository does not require having detected the booby-trapped sentence in the original ticket.
- Put actions with side effects through targeted human approval. In line with CERT-FR's recommendation, every system command or irreversible operation is held for approval by a person, and "always allow" modes that neutralize this safeguard are banned.
- Mark external data explicitly in the context. Delimiting third-party text helps the model tell data from instruction, as OWASP recommends, but never replaces a deterministic control on output.
On the regulatory side, Article 15(5) of the AI Act targets this scenario directly. It requires high-risk AI systems to resist attempts by unauthorized third parties to alter their use or outputs by exploiting their vulnerabilities. In an indirect injection, that third party is the author of the external document the agent ingests. The full implications of this article are analyzed in our study of the AI Act.
What this changes for architecture
The defenses that indirect injection defeats all share the same weakness: they count on the model's ability to spot the trick in a homogeneous stream of tokens. The architectures that hold up share the opposite principle. They expect no clairvoyance from the model and check every action outside it.
SentinelOS sits inline between your agents and every resource they call on. It judges each action before it leaves, including when the order comes from an external document the agent read, and records in a chained log that cannot be altered the exact state of what the agent had in context at the moment of the decision.
For related mechanisms, our other pages cover multi-step attacks, the vectors of data exfiltration by an agent, the vulnerabilities specific to MCP security and the overall architecture of AI agent security.
Design as if the document were lying
- They map every input of every agent. Emails, tickets, web pages, shared folders and API returns are inventoried, noting for each channel whether external third parties can drop content into it.
- They run each agent through Willison's trifecta. As soon as an agent combines reading internal data, exposure to external content and an outgoing communication tool, its architecture is reviewed to remove one link or insert a block.
- They cut the implicit exfiltration channels. Automatic rendering of remote images, generation of links to unapproved domains and sending to arbitrary recipients are disabled by default.
- They ban the "always allow" option on every call with side effects.
- They log the sources read alongside each tool call. Without the input context on file, it is impossible to establish afterward which document caused an abnormal action.
- They observe flows in listening mode before turning on blocking rules. A few weeks of logging without interruption show exactly which combinations of reads and actions must be held in production.
SentinelOS judges every action of your agents before it leaves, holds the ones that matter for a person, and signs every decision. Installed on your premises.
Discover SentinelOSSources
- Greshake, Abdelnabi, Mishra, Endres, Holz, Fritz, "Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection", arXiv:2302.12173, February 23, 2023. arxiv.org
- OWASP GenAI, "LLM01: Prompt Injection". genai.owasp.org
- Microsoft Security Response Center, "How Microsoft defends against indirect prompt injection attacks", July 29, 2025. microsoft.com
- Invariant Labs, "GitHub MCP Exploited: Accessing private repositories via MCP", May 26, 2025. invariantlabs.ai
- Reddy and Gujral, "EchoLeak: The First Real-World Zero-Click Prompt Injection Exploit in a Production LLM System", arXiv:2509.10540, September 2025. arxiv.org
- Simon Willison, "The lethal trifecta for AI agents", June 16, 2025. simonwillison.net
- Anthropic, "Mitigating prompt injections in browser use", November 24, 2025. anthropic.com
- CERT-FR, CERTFR-2026-ACT-016, April 13, 2026. cert.cyber.gouv.fr
- Regulation (EU) 2024/1689 (AI Act), Article 15(5). eur-lex.europa.eu
Frequently asked questions
What is indirect prompt injection?
It is an attack in which the adversary slips an instruction into an email, a ticket, a web page or a file, then waits for an authorized agent to process that document. They need no account on your system and no access to the agent's interface. Firewalls, strong authentication and access management flag nothing, because every flow is legitimate.
What is the difference between direct and indirect prompt injection?
In direct injection, the user writes the instruction in the interface themselves, with an account that can be identified and revoked. In indirect injection, a third party writes the instruction in a page, an email, a ticket or a tool description, and the legitimate user is the victim. The attacker holds no privilege on your infrastructure.
Is a filter enough to stop prompt injection?
No. An input filter stops crude attacks but is never a watertight barrier, and on June 16, 2025 Simon Willison wrote: "we still don't know how to 100% reliably prevent this from happening". A filter that blocks 99% of attempts lets the hundredth through, and one successful execution is all the attacker needs. Only a control placed on the outgoing action can stop the maneuver.
