What is Prompt Injection? Risks and Defences
Published Updated
Prompt injection happens when a language model treats untrusted text as instructions and lets it override the instructions its builder gave it. An inbox assistant might return a misleading summary or attempt to send a message the user never asked it to send. The most reliable place to limit the damage is in the application that controls what the model can read, share and do.
What Prompt Injection is
A prompt injection works because trusted instructions and text the model reads both reach its context window, the information it uses to produce the next response. The model can learn to give the builder’s instructions priority. It still has to interpret which words describe a task and which words are part of the material it was asked to read.
Jailbreaking usually means a user tries to get a model to break its safety rules. An indirect prompt injection can come from someone who never uses the assistant themselves. Their instructions arrive through content the assistant reads while working for another person. The terms can overlap when a direct injection tries to bypass safety rules. The Australian Signals Directorate and its partners describe that overlap in their guidance on engaging with artificial intelligence.
Direct and Indirect Prompt Injection
In a direct prompt injection, someone puts the conflicting instructions into the chat. An indirect injection comes through material the assistant retrieves, such as an email, shared document, web page or calendar invitation. It can also come from a code comment or text returned by a tool.
Suppose someone asks an assistant to summarise an inbox. A message contains hidden text asking the assistant to send the latest invoices to an outside address. If the assistant treats that text as part of its task, it could request a send action. Whether any invoices leave depends on what the assistant can access and whether the application lets it send mail without approval.
A person and a model can see different parts of the same document. A page reader might extract white text on a white background or read image alt text, even though those words are invisible in the normal view. A document parser can also pass metadata to the model. What matters is the content the application passes along.
What an Attacker Can Make the Model Do
An injection can change the answer a user sees or steer the model towards an action. The consequences depend on which parts of the application accept the model’s output.
| If the assistant can… | An injection can lead to… |
|---|---|
| Read the conversation or connected files | Sensitive records or chat content appearing in the answer |
| Use tools that change systems | Unauthorised emails or changes to records |
| Summarise information or make recommendations | A false answer that staff use to make a decision |
| Render links or load remote images | Data leaving through an external request when a link is opened or an image loads |
An agent that can edit records or send mail can change the world outside the chat. A read-only assistant has fewer ways to cause damage, though it can still reveal sensitive content or give a false answer.
Why No Filter Stops Every Attack
No current filter, classifier or prompt wording blocks every prompt injection. A classifier can flag suspicious input or retrieved content. Models trained to follow an instruction hierarchy are better placed to give trusted messages priority. Neither measure enforces an access boundary when an application accepts an action requested by the model.
OpenAI calls prompt injection “an open challenge for agent security” in its Atlas security update. Anthropic writes that “protection in the model layer will never be 100% effective” in its account of how it contains Claude. Microsoft’s position is “No single solution is sufficient” in its guidance on defending against indirect prompt injection.
The 2026 OWASP Top 10 for LLM Applications lists Prompt Injection first, as LLM01:2026. ASD’s agentic AI security guidance puts the access and action controls in the software that runs the agent.
Design Controls That Limit the Damage
Put the controls for sensitive data and consequential actions in the application, where they can hold even if the model follows the injected text.
- Apply least privilege by giving the model access only to the data and tools its task needs. See AI agent security for the broader permission design.
- Require human approval before external emails, payments or record deletions. Show the reviewer the actual recipient and attachments for an email so they can judge what will be sent.
- Keep untrusted content away from privileged actions. An assistant reading outside email can prepare a summary or a draft for review. A separate sending function checks for approval before it sends anything.
- Have the renderer block links and remote images that point to unknown domains. Record every tool call and its outcome in a restricted audit log. Record enough to investigate without copying sensitive content into the log.
- Have your authorised security team check before go-live and after changes to prompts, tools or connected data. Use an isolated test environment to verify the assistant treats conflicting directions in synthetic emails or documents as content. Use harmless canaries, which are dummy values that show if data reached a place it should not. Verify that sensitive output stays blocked and consequential actions still require approval.
If a check fails, pause the affected connector or action and preserve the audit records. Find which control allowed the output or action, fix it in the application and repeat the safe check before restoring access. ASD has guidance on securing AI testing environments.
Checking Your Own Assistants for Exposure
For each assistant your organisation uses, map the untrusted content it can read, the sensitive information it can reach and the actions it can take. Treat the deployment’s settings as part of that map. Two teams using the same product can expose different systems.
| Assistant | What can bring outside content into the model’s context |
|---|---|
| Microsoft 365 Copilot | Work content already available to the user can include outside email and shared files. Public web search is generally available unless administrators restrict it. Configured connectors can add other sources. |
| ChatGPT with connectors | Available apps are enabled by default in Business workspaces, subject to admin changes. Reading external account data depends on the connection and its permissions. Some synced apps can surface relevant indexed content automatically. |
| Claude with connectors | When services are connected, Claude’s default Auto mode selects which connectors to load for the conversation. |
| Custom-built agent | The owner controls which files, feeds, connectors and tool responses the app passes to the model. Its default access is whatever the app’s configuration grants. |
Review the actual settings for Copilot web search, ChatGPT app permissions or Claude tool access. For a custom build, trace each declared source to the accounts and tools it can reach.
Harden assistants that read outside content and can act on sensitive systems first. Then review the read-only assistants by the sensitivity of the data their answers can expose. For the highest-risk assistant, make approval and output checks a condition of enabling its connected tools.
Related reading
AI Security: Risks, Data Leakage and Controls
Before staff paste client files into an AI tool, know where the data goes. The main AI security risks, how data leakage happens and the controls that work.
What Are AI Guardrails? Types and Examples
AI guardrails limit what an assistant can say, reveal and do. The main types, worked examples, the tools that apply them and where they fail are all here.
Human in the Loop: Where AI Needs a Person
Decide where a person must check, approve or override AI work. Human in the loop patterns, when each fits, and how to stop review becoming a rubber stamp.
MCP Servers: How Model Context Protocol Works
What is an MCP server, and should your AI tools use one? See how Model Context Protocol links models to systems such as GitHub, Jira and Xero safely.
embeddings
Embeddings is an Australian AI consultancy. We design, build and run AI systems inside the software, documents and data organisations already use, from offices in Perth and Melbourne.
About Embeddings