Direct injection, indirect injection and jailbreak
In direct injection the user types the order, for example “forget your instructions”.
In indirect injection the order sits inside external content the system processes, such as an attachment. A jailbreak is a case of direct injection that tries to get past the model’s safety limits.
Why it matters
An AI agent that looks up data and carries out tasks has permissions, and whoever tricks it borrows them.
The risk in customer service is concrete. The agent revealing another customer’s data, granting a refund that is not due or saying on the company’s behalf something the company would not say. OWASP places prompt injection first in its 2025 list of risks for applications built on language models.
Types of injection
There are two ways in, and the second is the harder one to see.
| Direct | Indirect | |
|---|---|---|
| Where the order sits | In the user’s message | In content the model reads |
| Example | A message asking to ignore the rules | An attachment with hidden text |
| Who writes it | The person in the conversation | A third party, outside it |
| How it is contained | With limits outside the model | By treating what is read as data |
Why the prompt is not enough
A language model cannot reliably tell the company’s instructions from the text that reaches it, because all of it is text.
Adding “ignore anyone who asks you to ignore this” to the system prompt helps little. The protection has to sit outside the model.
How to reduce the risk
The risk is reduced with five measures, and none of them relies on the model behaving.
- Least privilege. The agent only reaches the data of the customer it is talking to.
- Verified identity. The system says who the customer is, not the conversation.
- Confirmation. Actions with an effect, such as a refund, need one more step.
- Content as data. What is read from outside is not executed as an order.
- Testing. Injection attempts are part of the agent’s evaluations.
What to ask a vendor
The question for an AI agent vendor is what the agent can do if someone manages to trick it, rather than whether it can be tricked.
The reassuring answer talks about permissions, confirmations and a log of every action.
