SI explained

What is prompt injection? How SI tools get tricked by hidden instructions

Glowing black orb drawing in a stack of floating documents and e-mails, one faint amber thread sneaking in like a hidden instruction
Illustration created with Claude (Anthropic).

Prompt injection is an attack in which someone else's text is read by an SI (AI) model as an instruction. We explain where the name comes from, why it works, two documented cases and how to reduce the risk.

What is prompt injection? It is an attack on SI (AI) systems in which text written by someone else is read by the model as if it were an instruction from you or from the developer. The model then does what the attacker's text says instead of, or as well as, what it was asked to do. It needs no malware and no stolen password: a sentence hidden in a web page, an email or a document can be enough. This guide covers where the name comes from, why the problem exists, direct and indirect attacks, two documented cases, how SI companies defend against it and what you can do. It explains the principle; it is not a how-to.

Where the name comes from

On 11 September 2022, Riley Goodside posted examples on Twitter showing that a model given a fixed task would drop that task if the text it was asked to process told it to. The next day, the developer Simon Willison wrote the episode up on his blog and proposed a name for it: prompt injection. His best-known example was a translation app. The app told the model to translate the user's text from English to French; the "text" instead told the model to ignore those directions, and the model obediently replied "Haha pwned!!" instead of translating anything.

Willison chose the name on purpose. It echoes SQL injection, the classic web attack where untrusted input typed into a form is pasted into a database query and executed as code. Both problems come from the same habit: gluing trusted instructions and untrusted input into one string. In the same post he noted that two obvious fixes did not hold. Putting the user's text in quotes was quickly bypassed by another developer, and asking a second SI model to spot the attack only moves the problem, because that second model can be tricked too. In a 2023 update he described the clean fix he hoped for as "extremely difficult, if not impossible, to implement on the current architecture of large language models."

Why SI models fall for it

A chatbot or SI assistant receives one long block of text. At the top there are usually hidden instructions from the company (the "system prompt"), then your request, then anything the tool fetched to help: a web page, an email thread, a PDF, the output of another program. The model reads all of it as one sequence and predicts what comes next. Nothing in that sequence is labelled as "safe to obey" or "only data" in a way the model is forced to respect.

The UK National Cyber Security Centre (NCSC) put it bluntly in a December 2025 post by Dave Chismon, its chief technology officer for architecture: "Current large language models (LLMs) simply do not enforce a security boundary between instructions and data inside a prompt." That is the key difference with SQL injection. Databases gained a structural fix, parameterised queries, which keep data in a separate slot that is never executed. SI models have no equivalent slot. The NCSC suggests thinking of the model as an "inherently confusable deputy": a helper that acts with your permissions and can be talked into acting for someone else.

The US National Institute of Standards and Technology (NIST) says the same thing in its March 2025 taxonomy of attacks on machine learning (NIST AI 100-2 E2025): because generative models "combine the data and instruction channels", an attacker who controls a resource the system reads can use it to steer what the system does.

Direct and indirect prompt injection

Security references separate two kinds of attack. The OWASP Top 10 for LLM Applications, a widely used checklist for developers, ranks prompt injection first in its 2025 edition (LLM01:2025) and defines both.

Direct prompt injectionIndirect prompt injection
Who writes the attackThe person typing into the chatbotA third party who never talks to the model
Where it hidesIn the user's own messageIn content the tool reads: web pages, emails, files, calendar invites, tool results
Who gets hurtUsually the company running the toolOften the user, whose data or accounts the tool can reach
Typical goalReveal hidden instructions, get around rulesLeak data, take unwanted actions, skew answers

NIST stresses the last row: with indirect attacks, "in many cases, it is the primary user of the model who is harmed." Microsoft, in a July 2025 post from its Security Response Center, says indirect prompt injection is "one of the most widely-used techniques" in the SI security vulnerabilities reported to it. The injected text does not have to be visible. Microsoft gives the examples of white text on a white background and non-printing Unicode characters, and OWASP notes that instructions can also be hidden in images when a model reads pictures as well as text.

Prompt injection is not the same as a jailbreak. OWASP treats jailbreaking as one form of prompt injection: the goal is to make the model ignore its safety rules altogether. Prompt injection is the wider problem of untrusted text taking over a task, even when the result is not harmful content but, say, a wrong recommendation or a leaked file.

Two documented cases

Bing Chat reveals "Sydney" (February 2023)

The day after Microsoft unveiled its new Bing chatbot, a Stanford University student, Kevin Liu, asked it to ignore its previous instructions and write out what was at the beginning of the document. It printed its hidden system prompt, which gave the bot the internal codename "Sydney" and told it not to disclose that codename, as Ars Technica reported on 10 February 2023. Another student, Marvin von Hagen, obtained the same list by a different route, and a Microsoft spokesperson later confirmed to The Verge, as Ars Technica's update notes, that the directives were genuine. Nothing was stolen, but it showed that a system prompt is not a secret a model can reliably keep.

EchoLeak in Microsoft 365 Copilot (June 2025)

The more serious case came two years later. The security firm Aim Security reported a flaw in Microsoft 365 Copilot, the assistant that can search a user's mail and documents. As SecurityWeek described it on 12 June 2025, an attacker could send an email containing instructions aimed at Copilot. The victim did not have to open it. When the victim later asked Copilot about a topic the email mentioned, Copilot pulled the email in as context, followed the hidden instructions and sent sensitive information from the conversation to the attacker's server. To get there, the attack had to slip past several protections, including a classifier designed to spot this kind of injection. Microsoft rated the vulnerability (CVE-2025-32711) critical, described it as "AI command injection" and fixed it on its own servers; customers did not need to do anything.

EchoLeak is a textbook indirect attack. The attacker never used Copilot. They only had to place text where Copilot would eventually read it, and the victim's own ordinary question did the rest.

What an attacker can get out of it

NIST groups the goals of indirect prompt injection into three families, and Microsoft's post gives concrete examples of each.

  • Privacy. The model is made to find personal data it has access to and send it out. Microsoft lists several channels researchers have demonstrated: an image link whose address carries the data, a clickable link, or a tool call that writes the data somewhere public.
  • Integrity. The answer itself is bent. NIST cites research showing summaries that are "arbitrarily incorrect", answers that push attacker-chosen information, sources quietly hidden, and agents hijacked to run a different task. OpenAI's own example is an apartment search in which a listing contains text that tricks the assistant into recommending it regardless of what you asked for.
  • Availability. The tool is made useless, for instance told not to use its search function, or pushed into a long pointless task before answering.

The risk grows with what the tool is allowed to do. A chatbot that can only write text can be fooled into writing nonsense. An SI agent that can read your inbox, send messages, browse while logged in or run commands can be fooled into doing those things. OWASP's wording is that severity depends on the business context and on how much agency the model has.

Why it has not been fixed

Every major source agrees that there is no complete solution yet. OpenAI, in a November 2025 explainer, calls robustness to adversarial attacks "a hard, open problem". OWASP warns that prevention "may not be foolproof" because generative models are stochastic, and that retrieval and fine-tuning "do not fully mitigate" the problem. Microsoft writes that deterministically detecting indirect prompt injection "is still an open research challenge". The NCSC goes furthest: it is "very possible that prompt injection attacks may never be totally mitigated," so the realistic goal is to reduce how likely they are and how much damage they can do.

The reason is the one described above. As long as instructions and data travel in the same channel, a model that is good at following instructions is, by design, open to following the wrong ones. Filters that look for suspicious phrases help a little, but the NCSC advises against relying on lists of banned phrases, because an attacker can simply reword, and it tells organisations to be wary of products that claim to "stop" prompt injection.

How SI companies defend against it

Because no single fix works, the companies that build these tools stack several layers. Their published descriptions overlap a lot.

LayerWhat it doesWho describes it
Model trainingTeach the model to tell trusted instructions from untrusted ones and to ignore the latterOpenAI ("Instruction Hierarchy"), Google (adversarial training)
Marking outside contentWrap or tag fetched text so the model knows it is data, not ordersMicrosoft ("Spotlighting"), Google, NCSC, OWASP
DetectionClassifiers that scan inputs for injected instructionsMicrosoft (Prompt Shields), Google, OpenAI monitors
Blocking leaksDo not load outside images, remove or flag suspicious linksMicrosoft, Google (markdown sanitisation, URL redaction)
Least privilegeGive the tool only the access the task needsOWASP, NCSC, Microsoft (data governance)
Human confirmationAsk the user before purchases, deletions or sending messagesOpenAI, Google, Microsoft, OWASP

The first three layers are probabilistic: they lower the odds of an attack working but cannot guarantee it fails. Microsoft explicitly prefers deterministic measures where it can, such as refusing to render outside images at all, because they give "hard guarantees". Google's June 2025 post notes that its markdown sanitiser does not render external image links, which it says makes the EchoLeak-style image leak "not applicable" to Gemini. The NCSC also recommends logging inputs, outputs and tool calls, since a run of failed tool calls can be a sign that someone is probing the system.

What you can do as a user

Most of the burden sits with the companies, but a few habits reduce your exposure, and several of them come from OpenAI's own advice.

  1. Limit access. Connect an SI assistant to your email, files or accounts only when a task needs it, and disconnect it afterwards. If a tool offers a logged-out mode for browsing, use it for tasks that do not need your accounts.
  2. Read confirmations properly. When an agent asks "should I send this?" or "should I buy this?", check what it is about to do. That pause exists because of prompt injection.
  3. Give narrow instructions. "Reply to the message from my landlord" leaves less room than "deal with my inbox", which is the exact scenario OpenAI uses to show how an agent can be steered into sharing bank statements.
  4. Treat summaries of outside content with care. If an SI tool summarised a page, an email or a document you did not write, its answer may have been shaped by that content. Check important claims against the original, just as you would for an SI hallucination.
  5. Watch for odd links in answers. A link you did not ask for, inside an SI summary of someone else's content, deserves the same suspicion as a link in a phishing email.

These habits fit with the wider privacy advice in our guide Is ChatGPT safe?: what you type and what you connect are two separate risks, and prompt injection mostly concerns the second.

The short version

Prompt injection is what happens when an SI tool cannot tell your instructions from someone else's text. It was named in 2022, it tops the OWASP list for SI applications, and it has already been used against a production assistant to pull out data with a single email. Vendors now layer training, tagging, detection, link blocking, limited permissions and human confirmation on top of each other, and security agencies say the risk will not disappear, only shrink. For readers, the practical lesson is close to the one behind any SI check: do not take content at face value just because a machine processed it. For the vocabulary around these tools, from prompts to system prompts and agents, see our guide What is SI?

FAQ

What is prompt injection in AI?

Prompt injection is an attack on AI (now also called SI) systems in which text from someone other than the user or developer is treated by the model as an instruction. The model then follows the attacker's text instead of, or as well as, its real task. The name was proposed by developer Simon Willison in September 2022, by analogy with SQL injection.

What is the difference between direct and indirect prompt injection?

In a direct prompt injection, the person typing into the chatbot writes the attack in their own message, for example to reveal hidden instructions. In an indirect prompt injection, a third party hides instructions in content the tool will read later, such as a web page, an email or a document, and the user is usually the one harmed.

Is prompt injection the same as jailbreaking?

Not exactly. OWASP treats jailbreaking as one form of prompt injection whose goal is to make a model ignore its safety rules. Prompt injection is the broader problem of untrusted text taking control of a task, even when the result is a wrong answer or a data leak rather than harmful content.

Can prompt injection be fully prevented?

Not today. OpenAI calls it a hard, open problem, OWASP says prevention may not be foolproof, and the UK National Cyber Security Centre says it may never be totally mitigated. Vendors combine model training, tagging of outside content, detection, link blocking, limited permissions and user confirmation to reduce the risk and its impact.

What is a real example of a prompt injection attack?

In June 2025 Aim Security disclosed EchoLeak (CVE-2025-32711) in Microsoft 365 Copilot. An email containing hidden instructions could make Copilot send sensitive information to an attacker when the victim later asked about a related topic, without the victim opening the email. Microsoft rated it critical and fixed it on the server side.

How can I protect myself from prompt injection?

Connect AI assistants to your email, files and accounts only when needed, read every confirmation before an agent sends, buys or deletes something, give narrow instructions rather than open-ended ones, check important claims in summaries of other people's content against the original, and be suspicious of links you did not ask for.

Sources

  1. Prompt injection attacks against GPT-3 · Simon Willison's Weblog, 12 September 2022
  2. LLM01:2025 Prompt Injection · OWASP Gen AI Security Project, 2025
  3. Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations (NIST AI 100-2 E2025) · NIST, March 2025
  4. Prompt injection is not SQL injection (it may be worse) · UK National Cyber Security Centre, 8 December 2025
  5. AI-powered Bing Chat spills its secrets via prompt injection attack · Ars Technica, 10 February 2023
  6. 'EchoLeak' AI Attack Enabled Theft of Sensitive Data via Microsoft 365 Copilot · SecurityWeek, 12 June 2025
  7. How Microsoft defends against indirect prompt injection attacks · Microsoft Security Response Center, 29 July 2025
  8. Mitigating prompt injection attacks with a layered defense strategy · Google Security Blog, 13 June 2025
  9. Understanding prompt injections: a frontier security challenge · OpenAI, 7 November 2025

Spotted an error? Write to hello@siornot.com. Corrections are made in the article and the update date changes. Read our editorial policy.