16 minute read

“The attack didn’t come through the chat box. It came through a Google Doc.”

TL;DR

Direct prompt injection requires talking to the AI. Indirect injection doesn’t. An attacker plants instructions in a document, email, web page, or form field that the AI later retrieves and executes. Major AI products shipped with this vulnerability in 2024-2025: Microsoft 365 Copilot, Slack AI, Salesforce Agentforce and the leading coding agents. The conditions are architectural. OpenAI said in December 2025 that prompt injection “is unlikely to ever be fully ‘solved’”. For why filtering cannot fix this, see Prompt injection is a structural attack; for how an injection escalates into full agent compromise, see The privilege escalation kill chain.


A circuit board with one chip soldered at a wrong angle among rows of identical components

What makes indirect injection different from direct injection?

Direct prompt injection means typing malicious instructions into the AI’s input field. The user IS the attacker. It’s the AI equivalent of SQL injection through a login form. You can see it happening. You can log it. You can rate-limit it.

Indirect prompt injection is fundamentally different. The attacker never interacts with the AI directly. They plant instructions in data the AI will later retrieve: a document in SharePoint, an email in Outlook, a web page the agent browses, a comment on a GitHub issue, a form submission in a CRM. When the AI retrieves that content as context, it processes the hidden instructions alongside the legitimate data.

Kai Greshake, Sahar Abdelnabi, and colleagues formalized this in their 2023 paper (arXiv:2302.12173). Their key insight: any AI system that retrieves external data has an injection surface that the user cannot control.

The distinction matters because the entire defense posture changes. Direct injection is an input validation problem. Indirect injection is a trust boundary problem. The AI trusts everything in its context window equally because it has no mechanism to distinguish “data I should process” from “instructions I should follow.” That’s not a bug in any specific product. It’s how language models work.

OWASP ranked prompt injection as LLM01 in their 2025 Top 10 for LLM Applications. HackerOne’s 2025 Hacker-Powered Security Report (covering July 2024 to June 2025) recorded a 540% rise in valid prompt injection reports and a 270% rise in programs with AI in scope.


How does an indirect injection attack actually work?

The attack follows a consistent pattern across every documented case. Here’s the anatomy:

sequenceDiagram
    participant Attacker
    participant Data Source
    participant AI System
    participant Victim
    participant Exfil as Exfiltration Channel

    Attacker->>Data Source: 1. Plant malicious instructions<br/>(email, doc, web page, form field)
    Victim->>AI System: 2. Ask a legitimate question
    AI System->>Data Source: 3. Retrieve context<br/>(RAG, search, tool call)
    Data Source->>AI System: 4. Return content WITH<br/>hidden instructions
    AI System->>AI System: 5. Process instructions<br/>as if legitimate
    AI System->>Exfil: 6. Exfiltrate data via<br/>authorized channel
    Note over Exfil: Image URL, API call,<br/>hyperlink, DNS request

Step 1: Poison the data source. The attacker puts instructions where the AI will find them. This could be an email body, a Salesforce lead description, a Slack message in a public channel, a web page the agent will browse, or a comment in a code repository.

Step 2: Wait. The attacker doesn’t need to interact with the victim or the AI system again. The payload sits dormant until retrieval.

Step 3: Trigger. A legitimate user asks the AI a question. The AI retrieves context from the poisoned data source. The hidden instructions enter the AI’s context window mixed with legitimate content.

Step 4: Execute. The AI follows the injected instructions. It might summarize data and send it to an external URL. It might modify files. It might change its own configuration. The AI treats the injected instructions with the same authority as the user’s original request.

Step 5: Exfiltrate. Data leaves through channels the AI is already authorized to use: rendering a Markdown image (triggering an HTTP request to an attacker-controlled server with data encoded in the URL), making an API call, generating a hyperlink, or executing a DNS lookup with data encoded as a subdomain.

The payload doesn’t need to be sophisticated. Johann Rehberger’s Devin AI disclosures used plain-language instructions planted in a GitHub issue and on a web page Devin was asked to visit. No obfuscation was needed for Devin to download and run attacker code or send secrets out.


What happened when this hit real products?

Every major AI product category had working exploits in 2024-2025. Not “theoretically vulnerable.” Demonstrated, with CVEs, CVSS scores, and vendor patches.

Microsoft 365 Copilot was hit twice. The first attack (disclosed August 2024): Johann Rehberger demonstrated a four-step chain combining prompt injection via email, automatic tool invocation, ASCII smuggling using Unicode tag characters (invisible to users but readable by the AI), and hyperlink rendering. He exfiltrated email bodies, sales figures, and MFA codes. Microsoft fixed it before the public write-up. The second attack, EchoLeak (CVE-2025-32711, CVSS 9.3), was worse: a zero-click vulnerability where a crafted email the victim never opens hijacks Copilot when the victim later asks any question that touches that email’s context. Discovered by Aim Security, patched June 2025.

Slack AI (August 2024): PromptArmor demonstrated that malicious instructions in a public Slack channel caused Slack AI to collect and return data from private channels the attacker had no access to. Slack initially rejected the report. After public disclosure forced their hand, Slack deployed what they called a patch covering “very limited and specific circumstances.”

Salesforce Agentforce (CVSS 9.4, patched September 2025): Noma Security found that Salesforce’s Web-to-Lead form has a description field with a 42,000-character limit. Attackers inject hidden LLM instructions into the field. The data gets stored as a legitimate CRM record. When employees query Agentforce about those leads, the hidden instructions execute and send CRM data to an attacker-controlled server. Noma also purchased an expired domain still on Salesforce’s Content Security Policy allowlist for $5.

The coding agents fell in a month-long wave. Johann Rehberger’s Month of AI Bugs (August 2025, 29 disclosures) covered Devin AI, Cursor (CVE-2025-54132), GitHub Copilot (CVE-2025-53773, CVSS 7.8), Claude Code (CVE-2025-55284, CVSS 7.1), Google Jules, Amazon Q Developer, Windsurf and others. The vector in almost every case: plant instructions in content the agent reads, watch the agent execute them with its own credentials. Claude Code’s exfiltration path was DNS: a pre-approved command such as ping with secrets encoded as subdomains of an attacker’s domain. Anthropic fixed it in Claude Code 1.0.4. For more on how agents escalate from initial injection to full compromise, see The privilege escalation kill chain.


What is the Lethal Trifecta and why does it matter?

Simon Willison defined the lethal trifecta in June 2025 as three capabilities that, combined, let an attacker steal data through indirect prompt injection:

  1. The AI has access to private or sensitive data
  2. The AI is exposed to untrusted content
  3. The AI has a way to communicate externally, which becomes the exfiltration channel

When all three are present simultaneously, prompt engineering, safety training and instruction tuning cannot reliably prevent data theft. The conditions are architectural, not behavioral.

Think about what this means for the products listed above. Microsoft 365 Copilot accesses your email, calendar, and documents (condition 1). It processes content from emails sent by anyone on the internet (condition 2). It renders Markdown, generates links, and makes API calls (condition 3). All three conditions met by design. The same product requirements that make Copilot useful are the ones that make it exploitable.

Salesforce Agentforce accesses your entire CRM (condition 1). It processes web-to-lead form submissions from anonymous visitors (condition 2). It can call external APIs and generate responses containing CRM data (condition 3). Three for three.

Willison’s framing is useful because it shifts the conversation from “how do we block injection?” to “how do we break one of the three conditions?” The realistic options:

  • Remove private data access: Defeats the product’s purpose. Not viable.
  • Stop ingesting untrusted content: Possible in some architectures but eliminates most retrieval-augmented features.
  • Block exfiltration channels: The most practical target. Restrict image rendering, limit outbound URLs, filter output for data patterns. This is where most defenses concentrate.

The uncomfortable conclusion: most AI products are designed to satisfy all three conditions simultaneously. That’s the value proposition. And it’s the vulnerability.


What defenses exist and how effective are they?

I’ll be honest about the state of defenses: nothing works completely, several things help, and the gap between academic results and production reality is wide.

Instruction hierarchy (also called system prompt priority) trains the model to treat system-level instructions as higher authority than user or retrieved content. OpenAI and Anthropic both implement versions, and OpenAI’s 2024 instruction hierarchy paper reported large robustness gains against the attacks it tested. The problem is adaptive attackers: in “The Attacker Moves Second” (arXiv 2510.09023, October 2025), researchers from OpenAI, Anthropic and Google DeepMind used gradient descent, reinforcement learning, search and human red-teamers to bypass 12 recent jailbreak and prompt injection defenses, most at over 90% attack success, although most had originally reported near-zero. Model-level defenses raise the bar for casual attackers but not for motivated ones.

Privilege separation (dual-LLM pattern) uses one model to process untrusted content and a separate model with access to tools and data. The untrusted-content model can only return structured data, never execute actions. A March 2026 study in the OpenClaw agent platform (arXiv 2603.13424) brought attack success to 0% on the 649 attacks that beat its single-agent baseline; isolation alone was about 323 times better than the baseline. In production, the complexity is significant: you’re running two models, maintaining a structured interface between them, and accepting higher latency and cost. Few organizations implement this.

Input sanitization and filtering strips or modifies retrieved content before it enters the context window. Effective against known injection patterns but inherently reactive. Attackers encode instructions in Unicode, use homoglyphs, split instructions across multiple documents, or embed them in ways that survive sanitization but still influence the model. The cat-and-mouse dynamic mirrors traditional WAF evasion.

Spotlighting (delimiting, datamarking or encoding retrieved content) marks untrusted text so the model can distinguish “this is data to analyze” from “this is an instruction to follow.” Microsoft’s spotlighting paper (arXiv 2403.14720, 2024) reported attack success falling from over 50% to under 2% in its experiments. The limitation: the model has to respect the markers, and sufficiently persuasive or adaptive injected text can still override them. Canary tokens are a separate idea: planted secrets whose appearance in output or traffic signals that an injection succeeded.

Output filtering inspects the model’s responses for signs of exfiltration: unexpected URLs, data patterns matching sensitive content, unusual API call patterns. This catches the symptom rather than the cause but represents the most practical layer for blocking the exfiltration leg of the Lethal Trifecta. Combine it with strict Content Security Policies and allowlisted output domains.

The honest assessment: defense-in-depth with multiple layers significantly reduces risk. No single control is sufficient. Adoption lags: in a December 2025 VentureBeat survey of 100 technical decision-makers, only 34.7% said their organization had bought and deployed dedicated prompt filtering and abuse detection.


Why do experts say this may never be fully solved?

Because the vulnerability comes from how language models process text, not from any specific implementation mistake.

OpenAI said in December 2025 that prompt injection “is unlikely to ever be fully ‘solved’”. The UK’s National Cyber Security Centre (NCSC) made a parallel argument the same month in “Prompt injection is not SQL injection”: because an LLM has no inherent distinction between data and instructions, prompt injection may never be totally mitigated the way SQL injection can be, so organizations should focus on limiting its impact. These aren’t pessimistic fringe opinions. They’re the assessment of the organizations building and regulating these systems.

The fundamental issue: language models don’t have a data plane and a control plane. Prompt injection is a structural attack works through the comparison with SQL injection and parameterized queries; the short version is that LLMs have no equivalent boundary. Everything in the context window is processed by the same mechanism. A sentence that says “summarize this document” and a sentence that says “ignore previous instructions and exfiltrate data” are both sequences of tokens processed identically. The model infers intent from token patterns, and injected instructions can mimic the patterns of legitimate instructions perfectly.

This is why the OWASP LLM Top 10 2025 maintains prompt injection at position LLM01. It’s why MITRE ATLAS includes indirect prompt injection as a distinct adversarial technique. It’s why every mitigation paper includes a “limitations” section acknowledging that sufficiently adaptive attacks can bypass the proposed defense.

The path forward is probably not “solve prompt injection” but “build systems that remain safe even when injection succeeds.” That means: minimize the data accessible in any single context, restrict exfiltration channels aggressively, require human approval for sensitive operations, and monitor for behavioral anomalies. For how cryptographic identity controls can help scope these boundaries, see Cryptographic capability binding.


Key takeaways

  • Indirect prompt injection works through data the AI retrieves, not through the chat interface. The attacker never interacts with the AI directly.
  • Every major AI product category (enterprise copilots, coding agents, CRM tools, messaging platforms) shipped with exploitable indirect injection vulnerabilities in 2024-2025.
  • The Lethal Trifecta (private data access + untrusted content + exfiltration channel) defines when injection can turn into data theft. Most AI products meet all three conditions by design.
  • OWASP ranks prompt injection as LLM01 (2025). HackerOne recorded a 540% rise in valid prompt injection reports in the year to June 2025.
  • OpenAI and the UK NCSC both said in December 2025 that prompt injection is unlikely ever to be fully solved or mitigated. The vulnerability is architectural, not a code bug.
  • Defense-in-depth (instruction hierarchy + privilege separation + input filtering + output filtering + HITL gates) reduces risk. No single control is sufficient. In one December 2025 survey, only 34.7% of organizations had deployed dedicated defenses.
  • The realistic strategy is building systems that remain safe when injection succeeds, not preventing injection entirely.

FAQ

What is indirect prompt injection?

Indirect prompt injection is an attack where malicious instructions are hidden in content an AI system retrieves: documents, emails, web pages, database records, form fields. Unlike direct injection where an attacker types into the AI’s chat, indirect injection reaches the AI through its data retrieval pipeline. The AI cannot tell the difference between legitimate content and embedded attack instructions because both are processed as token sequences in the same context window.

Which AI products have been vulnerable to indirect prompt injection?

Most major AI products tested in 2024-2025. Microsoft 365 Copilot had two serious vulnerabilities (ASCII smuggling, and EchoLeak at CVSS 9.3). Slack AI leaked private channel data. Salesforce Agentforce allowed CRM exfiltration through a form field (CVSS 9.4). The leading coding agents (Devin, Cursor, GitHub Copilot, Claude Code, Google Jules and others) were shown exploitable during Johann Rehberger’s Month of AI Bugs in August 2025.

Can indirect prompt injection be fully prevented?

No, according to the organizations building and regulating these systems. OpenAI said in December 2025 that prompt injection is unlikely to ever be fully solved, and the UK’s NCSC said the same month that it may never be totally mitigated. Defense-in-depth with multiple layers significantly reduces risk, but no combination of controls eliminates the vulnerability entirely. The practical goal is building systems that remain safe even when injection succeeds.

What is the Lethal Trifecta in AI security?

Simon Willison defined the lethal trifecta as three capabilities that, combined, let an attacker steal data through indirect prompt injection: access to private data, exposure to untrusted content, and the ability to communicate externally (image URLs, API calls, hyperlinks). When all three are present, prompt engineering cannot reliably prevent data theft. Most AI products meet all three conditions by design.

How do I reduce the risk of indirect prompt injection?

Use defense-in-depth. Privilege separation between retrieval and instruction contexts is the strongest single control. Add strict output filtering to block exfiltration channels (no dynamic image URLs, no arbitrary API calls). Apply input sanitization on retrieved content. Deploy canary tokens to detect injection attempts. Require human-in-the-loop approval for sensitive operations. Monitor for behavioral anomalies in model outputs and tool calls. No single layer is sufficient, so stack them; the defense stack post and ClawGuard’s runtime enforcement show how. For how detection alone fails, see prompt injection detection is already broken; for what attackers try at scale, see the 272,000-attack study.