The short answer
A large language model reads everything in its context as one stream of text. Your instructions, the user’s question and any documents, emails or web pages the application feeds in all arrive together. Prompt injection exploits this: an attacker writes text the model treats as an instruction, so it follows the attacker rather than you.
In a simple chatbot that might mean an embarrassing reply. In an AI agent that can read mailboxes, query records or call tools, it can mean data leaking out or actions taken in a user’s name. The risk is set less by the model than by what the model is allowed to reach and do.
Direct and indirect prompt injection
Direct prompt injection is when a user types instructions designed to override the system’s rules, such as telling the model to ignore its previous instructions or to reveal its system prompt. Jailbreaking is a close relative, aimed at the model’s safety training rather than the application’s rules.
Indirect prompt injection is the bigger risk for most businesses. The hostile instructions sit in content the AI processes on someone else’s behalf: an email in the inbox, a shared document, a web page an agent browses, a support ticket or a record retrieved from a database. The victim never sees the instruction and may never interact with the attacker at all.
| Route | How the instruction arrives | Typical target |
|---|---|---|
| Chat input | Typed directly by a user | System prompt, safety rules, other users’ data |
| Email and calendar | Hidden in a message or invite an assistant summarises | Mailbox contents, contacts, sending email |
| Documents and files | White text, comments or metadata in a PDF, Word file or spreadsheet | Files the assistant can search, summaries given to staff |
| Web pages | Text on a page an agent browses or a search tool retrieves | Browsing agents, research tools, purchasing agents |
| Retrieved records | Planted in a CRM field, ticket or knowledge base used for retrieval | Customer data, internal answers, downstream actions |
| Tool and MCP responses | Returned by a connected tool or server the agent trusts | Further tool calls, credentials, other agents |
What prompt injection has achieved in practice
In June 2025 researchers at Aim Security disclosed EchoLeak, a flaw in Microsoft 365 Copilot tracked as CVE-2025-32711 and rated critical at 9.3. An attacker could send a crafted email that Copilot would later read while answering an unrelated question, causing it to pull sensitive data from the user’s context and send it out without the user clicking anything. Microsoft fixed it server-side, and it has been described as the first known zero-click attack on an AI agent.
The OWASP Top 10 for Agentic Applications, published in December 2025, draws on incidents like this. Its first three risks are agent goal hijack, where planted content redirects what the agent is trying to do; tool misuse, where an agent uses legitimate tools in harmful ways; and identity and privilege abuse, where an agent acts with more access than it should have.
Why it is so hard to fix
SQL injection was largely solved by keeping data and commands apart, through parameterised queries. In December 2025 the NCSC published an assessment arguing that prompt injection is different: a language model has no reliable boundary between instructions and data, so the same separation is not available. Its conclusion was that prompt injection may never be totally mitigated in the way SQL injection can be, and that systems should be designed to limit what a confused model can do.
That is why the usual first defences have limits:
- Telling the model to ignore injected instructions helps a little, but it can be talked around.
- Input filters and classifiers catch known patterns. Attackers rephrase, translate, encode or split instructions across several inputs.
- Keeping the system prompt secret is not a control. OWASP treats system prompt leakage as a risk in its own right, so assume it will be read.
Filters are still worth having. They are one layer, not the fix.
How to limit the damage
The controls that hold up are the ones that still work when the model has been fooled. The UK AI Cyber Security Code of Practice, and the ETSI EN 304 223 standard built on it, apply the same principle across the AI lifecycle.
- Least privilege for agents. Give each agent its own identity with only the permissions its task needs, and short-lived credentials rather than broad API keys.
- Human approval for consequential actions. Payments, external email, deleting records and changing permissions should need a person to confirm.
- Keep untrusted content away from sensitive capability. An agent that reads inbound email or the open web should not also hold broad access to confidential data and an outbound channel.
- Treat model output as untrusted. Validate it before it reaches a browser, database, shell or another system, and block automatic loading of external links and images that could carry data out.
- Fix the permissions underneath. Assistants such as Copilot surface whatever a user can technically reach, so tighten oversharing before switching them on. A configuration review covers this.
- Log and monitor. Record prompts, retrieved content and tool calls so unusual behaviour can be spotted and investigated.
How to test for prompt injection
Testing should follow the attacker’s routes rather than a fixed list of jailbreak prompts. A useful test:
- maps every source of content the application reads, including retrieved records and tool responses
- plants instructions in each source and checks whether the model follows them
- measures impact, meaning data disclosed, actions taken and tools misused, rather than odd replies
- tests the conventional application around the model, since model output passed unchecked to other systems can become injection or code execution
- maps findings to the OWASP Top 10 for LLM Applications and for Agentic Applications, so developers, auditors and boards share one vocabulary
Model behaviour changes with updates, so a test is a point-in-time view. Retest after a model change, a new tool or a wider rollout. Our AI and agent security testing covers each of these steps, alongside web application testing for the application around the model.
- Prompt injection is not SQL injection (it may be worse)National Cyber Security Centre
- The OWASP Top 10 for LLM Applications (2026): what changed and why it mattersCloud Security Alliance
- OWASP Top 10 for Agentic Applications for 2026OWASP GenAI Security Project
- Zero-click AI vulnerability exposes Microsoft 365 Copilot data without user interactionThe Hacker News
- AI Cyber Security Code of PracticeDepartment for Science, Innovation and Technology
- ETSI sets out new European standard to strengthen AI cyber securitytechUK



