# Indirect Prompt Injection

> Hidden orders in a web page, email or file. The AI reads them while doing its job.

**Field:** Artificial Intelligence  
**Category:** Safety & Security  
**Also known as:** Indirect Injection, Cross-Prompt Injection, XPIA

## Think of it like

It is like a letter your helper reads for you. A hidden line in it tells the helper to rob you.

## Definition

Indirect prompt injection is when the hidden orders come from content the AI reads, not from the person using it. The text can sit in a web page, an email, a file or a tool result. When an AI agent reads it to do its job, it may follow the orders. They can tell it to leak data, send messages, or change what it tells the user. The user never sees the attack, which makes it so risky for agents.

## Example

Emma asks her AI agent to sum up a web page. The page hides white text that tells the agent to email her contacts to a stranger, and the agent tries to.

## Why it matters

Agents read lots of outside content and can take actions. That mix turns one bad page into a real breach.

## Common mistake

Trusting content because the user asked for it. The user chose the page, not every word on it.

## Three principles

- **From the content.** Not the user.
- **Unseen.** By the user.
- **Worst for agents.** That can act.

## Related terms

- [Prompt Injection](https://learn.benibix.com/term/ai/prompt-injection)
- [AI Agent](https://learn.benibix.com/term/ai/ai-agent)
- [Tool Use (Function Calling)](https://learn.benibix.com/term/ai/tool-use)
- [Guardrail (AI)](https://learn.benibix.com/term/ai/guardrail)
- [Tool Poisoning](https://learn.benibix.com/term/ai/tool-poisoning)
- [Data Exfiltration (AI)](https://learn.benibix.com/term/ai/ai-data-exfiltration)
- [AI Browser](https://learn.benibix.com/term/ai/ai-browser)

## Taught in

- [AI Search Engines and Browsers](https://learn.benibix.com/learn/ai-use-case/ai-search-engines-and-browsers): AI Assistants and Chatbots, 9/13

![A user asks an AI agent to sum up a web page. The page hides an instruction in white text. The agent reads it and sends the user's data away.](https://learn.benibix.com/diagrams/sf-indirect-prompt-injection.svg)

---

Source: https://learn.benibix.com/term/ai/indirect-prompt-injection
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
