← Back to articles
indirect prompt injectionprompt injectionai securityai agentsowasp llm

Indirect prompt injection: real examples and how to prevent it

By · November 1, 2026 · 5 min read

Indirect prompt injection hides instructions in an email, web page or document that your AI reads on its own. You prevent it by limiting what the assistant can do, not by hoping it spots the trick.

File JG · DocumentBack to articles

Indirect prompt injection: real examples and how to prevent it

Type
Article
Author
Date
Reading time
5 min read
Subjects
indirect prompt injection, prompt injection, ai security, ai agents, owasp llm

Summary

Indirect prompt injection hides instructions in an email, web page or document that your AI reads on its own. You prevent it by limiting what the assistant can do, not by hoping it spots the trick.

Picture an AI assistant that summarises the admin inbox every morning. One day an email arrives from a stranger. You never open it, but the assistant does, and inside are a few lines written for it, not for you. That is indirect prompt injection, and it is the variant that should worry a company already using AI at work.

I have already explained what prompt injection is in general. Here I focus on the indirect kind: where it comes from, which real cases exist and what you can do so it does not catch you off guard.

◢What is indirect prompt injection?

According to OWASP1, it happens when the model takes in external content, such as a web page or a file, that contains instructions able to change its behaviour. Those instructions can be deliberate or accidental, and a person does not need to see them: the model only has to read them.

The difference from direct injection is who writes the text. In the direct kind, the attacker types into the chat. In the indirect kind, the attacker never talks to your AI. They leave the message somewhere they know it will eventually pass.

The concept was formally described in a 2023 research paper2, which explains how applications built on language models "blur the line between data and instructions". That is, the model cannot reliably tell what its user asked for from what a document it is reading says.

◢Real examples of indirect injection

The best-known case is EchoLeak. A technical case study3 describes it as a flaw in Microsoft 365 Copilot (CVE-2025-32711) where a single crafted email was enough to exfiltrate data remotely, with no click from the victim and no authentication by the attacker. The authors explain that the attack chained several bypasses: it evaded the classifier Microsoft used against this kind of attack, got around link redaction with an unusual Markdown format, and abused auto-loaded images and a Teams proxy that the content security policy allowed.

The technical detail matters less than the lesson: a product from one of the biggest companies in the world, with filters built specifically against this attack, could be manipulated with an email.

The 2023 paper had already demonstrated similar attacks against Bing Chat powered by GPT-4 and against code-completion tools, including data theft and changes to how the application behaved.

There are also everyday scenarios in OWASP's own list1: a web page summarised by an AI that hides instructions telling the assistant to insert a link that leaks the conversation, or a poisoned document in an internal knowledge base that skews the answers. The UK's NCSC4 mentions another: instructions hidden in a job application so an AI screening system approves it.

◢Why can't it be fixed with a patch?

IT teams ask this a lot. In a December 2025 post, the NCSC explains that comparing it with SQL injection is misleading: SQL injection was solved by separating data from instructions, and today's language models have no security boundary between the two. Its conclusion is that it may never be fully eliminated, so the goal is to reduce its likelihood and impact rather than wait for it to disappear.

OWASP says something similar: its measures reduce impact but do not guarantee complete prevention.

There is a practical consequence. If a vendor promises its product "stops" prompt injection, ask how they know. The NCSC advises caution with such claims and suggests looking for products that reduce it.

◢What changes when the AI has tools?

Everything. A chatbot that only answers can, at worst, say something wrong. An agent that reads your email, queries your CRM and can send messages turns manipulated text into a real action. The NCSC sums it up: if the model can call tools, injection has the same effect as giving the attacker direct access to those tools.

So the risk depends less on how smart the model is than on what you let it do. It is the same problem I describe in AI agents with too many permissions.

◢How do you prevent indirect prompt injection?

There is no single fix. These are the measures OWASP and the NCSC recommend, in the order I would apply them in a company:

  1. ▹Least privilege. An assistant that processes external email should not have access to privileged tools. If it only has to summarise, it should not be able to send. The NCSC cites a simple idea that has been proposed in the industry: when the assistant reads someone's content, its privileges should drop to that person's level.
  2. ▹Human approval for what matters. Sending, paying, deleting or changing permissions needs a person to confirm after seeing exactly what will happen.
  3. ▹Mark and separate external content. Identifying which text comes from outside helps limit its influence, though it does not remove it.
  4. ▹Validate what comes out. If the assistant has to return a specific format, check it with ordinary code, not with another model.
  5. ▹Log everything. The NCSC advises keeping the full inputs and outputs of the model, tool use and API calls. A failed attempt to use a tool can be an attacker refining their approach.
  6. ▹Test it first. OWASP recommends treating the model as an untrusted user in penetration tests and simulating attacks with prepared documents.

One measure the NCSC advises against: blocking known phrases. They can be reworded endlessly.

◢What staff can do

People who use AI every day are also a barrier. Before accepting what the assistant proposes, it is worth reading what it is about to send, share or delete, and to whom. A summary that insists on something odd, or an action nobody asked for, is a reason to stop and report it, just like a phishing email. If you want a refresher on spotting one, I covered it in how to spot a phishing email.

◢A design risk, not a careless-employee risk

Indirect injection is not caused by a careless employee. It happens even when everyone does their job well, because the trick travels inside the content the AI reads. So the defence is to design on the assumption that the assistant can be fooled, and to limit the damage it could do.

It is one of the topics I cover in my cybersecurity and AI training for companies, designed for non-technical teams.

Related documents

  1. News

    Crédit Mutuel Arkéa cyberattack: attackers came in through a vendor

    French bank Crédit Mutuel Arkéa suffered an attack that allowed fraudulent transfers from its own account. The attackers got in through a service provider's platform. What we know, what we don't and what to learn.

  2. Article

    Device code phishing: what it is and how to stop it

    Device code phishing tricks the victim into typing a code generated by the attacker into Microsoft’s real sign-in page. That gives the attacker access to their Microsoft 365 account without a password and without two-step verification getting in the way. Blocking that sign-in flow stops it.

  3. News

    Claude Code leaks keys on GitHub: the settings.local.json problem

    Claude Code's "don't ask again" option can save passwords and API keys in .claude/settings.local.json. Apiiro found 1,122 public copies on GitHub with secrets inside. What we know and what to do.

End of documentBack to articles