Prompt injection is the risk at the top of the OWASP Top 10 for LLM Applications, and it is no longer a lab curiosity. Since 2024, security researchers have shown it working against widely used AI assistants built into email, workplace chat, code hosting and calendars, and vendors have shipped fixes in response. The pattern is the same each time: the assistant reads text an attacker controls, treats it as instructions and uses its own access to do something the user never asked for. This guide walks through five documented patterns and the defences that hold up.
Direct and indirect prompt injection
Direct prompt injection is a user typing instructions to override the system's rules, such as asking a support bot to ignore its policy. It matters, but the user can only reach what they already have access to. Indirect prompt injection is more dangerous: the instructions arrive inside content the model processes on someone else's behalf, such as an email, a web page, a document, a code issue or a calendar invite. The victim never sees them, and the model acts with the victim's access.
Pattern 1: Zero-click injection through email
In 2025 researchers disclosed a flaw, tracked as EchoLeak, in which a crafted email could cause Microsoft 365 Copilot to pull sensitive data from the user's context and send it to an outside server, without the user clicking anything. Microsoft fixed it on its side. The lesson for anyone building assistants over mailboxes is that every incoming email is attacker-controlled input to your model.
Pattern 2: Data exfiltration through workplace chat
Researchers have shown that an AI assistant in a workplace chat tool could be steered by a message planted in a channel the attacker could post in, causing it to reveal data from private channels in an answer that included an attacker's link. The fix pattern is to limit what the assistant can retrieve and how it can render links.
Pattern 3: Coding agents and repository content
In 2025 researchers showed that an AI agent connected to a code hosting platform through a tool integration could be manipulated by a malicious issue in a public repository into reading the user's private repositories and leaking their contents in a pull request. The agent had broad tokens and followed the instructions it found. Coding agents that read issues, pull requests, documentation and dependencies face the same risk.
Pattern 4: Calendar invites and connected apps
Researchers have also demonstrated attacks where instructions hidden in a calendar invite or shared document were acted on by an assistant connected to the victim's calendar, email or smart home, triggering actions when the user later asked an ordinary question. Every connected app an assistant can read widens the set of places an attacker can plant instructions.
Pattern 5: Poisoned knowledge bases and web pages
Assistants that search the web or a company knowledge base can be steered by planted content: hidden text on a page, instructions in an uploaded file or a wiki edit. The result can be false answers, phishing links or, if tools are connected, actions. Our RAG security guide covers this case in detail.
Why filters do not solve it
The model cannot reliably tell the difference between instructions and data, because both are just text in its context. Input filters miss rephrased, encoded or hidden instructions, and output filters cannot see actions taken through tools. Vendors improve their defences with every release, but no current technique blocks every injection, so design on the assumption that some will succeed.
Defenses that hold up
The controls that limited damage in these cases share one idea: a fooled model should not be able to do much.
- Least privilege: give the assistant only the data and tools its feature needs, with the user's permissions rather than a broad service account.
- Separate trusted and untrusted content, and avoid giving one assistant both access to private data and the ability to send data out.
- Restrict outbound channels: block or proxy external links and images in responses, and limit network egress for agents.
- Require human confirmation for sending messages, sharing files, changing records and anything irreversible.
- Validate tool calls in code against what the user actually asked for.
- Log prompts, retrieved content and tool calls so incidents can be investigated.
- Test with injection attempts through every channel the assistant reads, and retest after model or prompt changes.
Testing your own AI features
If you build assistants, chatbots or agents, test them the way these researchers did: plant instructions in each content source and see what the system does. An AI and LLM penetration test covers direct and indirect injection, data leakage and tool misuse against your real application. For the wider agent controls, see our AI agent security guide.
Frequently asked questions
What is prompt injection?
Can it be prevented completely?
Is there a prompt injection certification?
Are the AI assistants in Microsoft 365 or Google Workspace safe?
Find out if your AI features can be hijacked
We plant instructions in every source your assistant reads and show what it does with them, with fixes ranked by impact.

