Skip to main content

AI glossary Responsibility

What is prompt injection?

← All glossary terms
In short

An attack that hijacks a language model's instructions through untrusted input, from a user or from content the model reads.

Explained

Prompt injection is an attack in which text crafted by an attacker makes a language model ignore its original instructions, leak data or take actions it should not. The malicious instructions can be typed directly by a user or hidden in content the model processes, such as a retrieved document, an email or a web page. It works because a model receives instructions and data in the same channel and cannot reliably tell them apart. Defences include isolating untrusted content, filtering outputs, allowlisting tools and keeping the model's permissions strictly scoped.

Direct and indirect injection

In a direct injection, the user writes instructions meant to override the system prompt: asking the model to ignore its rules, reveal its configuration or adopt another role. Jailbreaking is a form of direct injection aimed at bypassing safety rules.

In an indirect injection, the attacker never talks to the model. They plant instructions in content the system will read later: a web page, a shared document, a calendar invite, a field in a database. When the model retrieves that content, it may follow the hidden instructions as if they came from the user or the developer.

Why it matters more with agents

A chatbot that only answers can be manipulated into saying the wrong thing. An agent that can send emails, query systems or run code can be manipulated into doing the wrong thing, with the permissions it holds.

The risk grows when the same agent reads untrusted content, has access to private data and can communicate outwards. That combination lets injected instructions turn into data exfiltration or unauthorised actions.

How to reduce the risk

  • Treat all external content as data, never as instructions, and mark it clearly in the prompt.
  • Give the model the least privilege it needs: scoped credentials, allowlisted tools, read-only where possible.
  • Require human approval for sensitive or irreversible actions.
  • Validate and filter outputs before they reach users or other systems.
  • Log prompts, retrieved content and tool calls so that incidents can be traced.
  • Test the system with adversarial inputs (red teaming) before and after launch.

Frequently asked questions

What is an example of prompt injection?

A user asks a support assistant to summarise a web page, and the page contains hidden text telling the model to reveal its system prompt or send the conversation to an external address. If the assistant follows that text, it has been injected. The user did nothing malicious; the attack came from the content.

What is the difference between prompt injection and jailbreaking?

Jailbreaking is a type of prompt injection whose goal is to make the model disregard its safety rules. Prompt injection is the broader category: any input that changes the model's behaviour in unintended ways, including indirect attacks hidden in documents or web pages.

Can prompt injection be fully prevented?

Not with current techniques, because models process instructions and data in the same text stream. Filters and better training reduce the risk but do not remove it. The practical approach is to limit what a successful injection can do: narrow permissions, human approval for sensitive actions and monitoring.

Where does prompt injection rank among LLM security risks?

OWASP lists prompt injection as LLM01, the first entry in its Top 10 for large language model applications. The list covers both direct and indirect injection.

Does RAG make prompt injection worse?

It adds a new entry point. Every document a retrieval system can return is content the model will read, so a poisoned document can carry instructions. Controlling what gets indexed, delimiting retrieved text and limiting the model's permissions all help.

Decision guides that use this term

How to put it to work

Where it shows up at Thinkia

Products

Further reading

Sources

Updated: 2026-10-21

Want to see how this applies to your organisation?

Talk to an AI Expert