What is prompt injection?

Prompt injection is a type of attack that hides instructions in the input a language model reads, in order to override its original instructions and make it do something unintended. The instruction can be typed into the chat box, or planted in an email, web page or document. When the model can use tools, the result can be a data leak or an unauthorised action, not just a wrong answer.

Definition

Prompt injection is a type of attack that hides instructions in the input a language model reads, in order to override its original instructions and make it do something unintended.

How does prompt injection work?

A language model cannot strictly separate instructions from data. Both arrive in the same stream of text. In a direct attack, the user types something like “ignore the previous instructions” into the chat box. In an indirect attack, the instruction is hidden in a web page, an email or a document that the model reads.

If the model treats that text as a command, it can step outside the rules in its system prompt. OWASP includes prompt injection in its list of top risks for large language model applications.

When does the risk grow?

If the model only produces text, the damage is usually limited to a wrong or inappropriate answer. Tools change this. An AI agent that can send email, delete records or start a payment can be made to do so on an attacker’s behalf.

The risk is highest when three conditions meet: access to private data, exposure to untrusted content, and a way to send data out.

How do you defend against it?

No single measure is enough. Keep the agent’s permissions as narrow as the task allows. Require human approval for irreversible actions. Check inputs and outputs with a guardrails layer and log every tool call.

In an assistant with access to personal data, a successful attack can become a personal data breach. Plan for that scenario with your legal counsel, under GDPR and, for data processed in Türkiye, under KVKK, Türkiye’s data protection law. Testing with known attack patterns before release should be part of the plan.

Further reading

Related terms

Frequently asked questions

Can prompt injection be fully prevented?

No method known today gives complete protection. The aim is to limit the damage even when an attack succeeds: narrow permissions, human approval for irreversible actions, input and output checks, and logging, all used together.

Is prompt injection the same as jailbreaking?

They are close but not identical. Jailbreaking tries to get around the model's own safety rules. Prompt injection targets the instructions of an application, and often arrives through content prepared by a third party.

Is it enough to write 'never change these instructions' in the system prompt?

No. Such sentences make simple attempts harder, but they are not a security boundary. Real protection sits outside the model: restricted permissions, checks on tool calls and an approval step for sensitive actions.

Let’s talk about your transformation

Tell us which work repeats every week. We will tell you honestly whether it is worth automating.

How we start

  1. A free first callWe pin down the problem and the goal together.
  2. A 2-week discovery sprintWe look at the data, the process and the tools, and decide where to start.
  3. A written proposalScope, architecture and timeline, in writing.

Example questions

Go straight to

CorrAI answers with AI from the content of this site and can be wrong. Please do not enter personal details. Privacy

Book a free call