What is prompt injection?

Prompt injection is an attack in which text hidden in a web page, an email or a document tricks an AI system into following the attacker's instructions and not yours.

Key takeaways

  • A model cannot always tell your instructions from instructions inside content it reads.
  • The risk grows when an AI agent can browse, read email or take actions.
  • The defense is limited access and human approval, not a cleverer prompt.

How it works

An AI agent reads outside content as part of its work. An attacker places a sentence in that content, such as an instruction to send the user's contact list to an address. The agent may treat the sentence as a command, because all the text arrives in the same context window.

Example

You ask an AI assistant to summarize your unread email. One message contains hidden white text that tells the assistant to forward your latest invoice to a stranger. An assistant with permission to send email could do it.

Why it matters

As you connect AI to your inbox, your files and your accounts, anything it reads becomes a possible way in. This is the main security question for AI agents today.

Common mistake

No prompt makes a model immune. Give agents the least access they need, keep approval on for sending, paying and deleting, and be careful with content from unknown sources.

Related terms

See all terms in the AI Encyclopedia, the numbers on the AI statistics pages, or build a prompt with the prompt builder.