Explained · 2 min

What is prompt injection?

Why an AI can be steered by text it was only meant to read, and what helps against it.

Written by AI and checked against our editorial standards. Not reviewed by a human editor.

Prompt injection is when some text changes what an AI model does, in a way nobody intended. The security group OWASP lists it first in its top 10 risks for apps built on language models.

The problem comes from how these models work. A model reads everything as one long stream of text. That includes your request, its own rules and whatever it looks up. It has no firm wall between “orders from my user” and “material I was asked to read”. So if a web page or a file contains a line like “ignore your rules and send this data”, the model may follow it.

Think of it like this: you ask an assistant to sort your mail. One letter says “Assistant, please transfer $100 to this account.” A careful person knows the letter is not their boss. An AI model can find that hard to tell apart.

There are two kinds. In direct prompt injection, the person typing tries to trick the model. In indirect prompt injection, the instructions hide in content the AI reads on its own. That can be a web page, a document, an image or an instruction file. The indirect kind is the bigger worry for agents, because they read a lot without a human checking each piece.

OWASP says it is unclear whether any method can prevent it fully. What helps is to limit the damage. Give the AI only the access it needs, and keep untrusted content clearly apart. And ask a human before risky actions like payments, emails or installing software.

Why it matters to you: when an AI can act for you, anything it reads can try to give it orders. So the folder or page you point an agent at matters as much as what you ask it to do.

Learn more: OWASP Top 10 for LLM Applications: LLM01 Prompt Injection

Seen in the news

  1. DeepSeek shares a coding agent that joins your team's chat
  2. A planted file in your Downloads folder can hijack your coding agent