What is indirect prompt injection?
Indirect prompt injection hides instructions in content an AI system reads, such as a web page, email or file, so the model follows the attacker instead of its user.
Also called: cross-prompt injection, XPIA
How it works
Many AI tools read outside content: a browser agent loads web pages, an email assistant reads the inbox, and a retrieval-augmented generation system pulls in documents. A model cannot reliably tell data apart from instructions, so text in that content can act like a command.
An attacker plants instructions where the AI will find them. They can be hidden in white text, HTML comments, image alt text, metadata or a long document. When the model reads the content, it may follow those instructions with the user's access and tools.
Why it matters for fraud and trust
The risk grows with what the AI can do. A model that only writes text can be tricked into a wrong summary. An agent that can send email, make payments or read private files can be tricked into sending data or money to the attacker. The real user may never see the hidden text.
Example
A hypothetical shopping agent compares prices for a user. One product page contains hidden text that tells any AI reading it to add a gift card to the cart and ship it to a new address. If the agent has checkout access and no confirmation step, it may follow the instruction.
How teams defend against it
No single fix exists. Teams give agents the least access they need, treat all outside content as untrusted, and keep a human in the loop for payments, data sharing and account changes. Output checks and guardrails catch some attacks, and logs make it possible to trace what content the agent read before an action.
Related terms
- Prompt injectionPrompt injection is an attack in which text given to an AI model contains instructions that override what its developer or user intended, so the model leaks data or takes unwanted actions.
- Browser agentA browser agent is an AI agent that uses a web browser like a person, reading pages, clicking, typing and filling forms to complete tasks for a user.
- Guardrails (AI guardrails)AI guardrails are checks placed around a model that limit what it accepts, says or does, such as input filters, output filters and limits on tool use.
- Retrieval-augmented generation (RAG)Retrieval-augmented generation (RAG) is a method where an AI system first finds relevant documents or records, then gives them to a language model to use when it writes its answer.
- AI agentAn AI agent is software that uses a language model to plan and take actions toward a goal, such as browsing sites, calling APIs or filling in forms, with little or no human input at each step.