# Indirect prompt injection

> Canonical: https://skillalmanac.com/glossary/indirect-prompt-injection | Last verified: 2026-11-25 | Index status: index-eligible

Indirect prompt injection is a form of prompt injection in which the malicious instructions sit in content the model fetches or is given, such as a web page, email or file, instead of being typed by the user.

Also called: indirect injection, prompt injection via documents, indirect prompt injection attack, IPI.

## In plain language

Indirect prompt injection does not require the attacker to interact directly with the AI. Its defining route is instructions planted in external material the application processes. Imagine you ask an assistant to summarise a web page, and the page contains hidden text telling the assistant to send your private notes to a stranger. The page content can influence the model's context, and the assistant may treat the malicious line as an order. The main limitation of any defence is that nobody has a complete fix, so the safer habit is to limit what the assistant can do. The risk grows with its access: an assistant that can only summarise can embarrass you, while one that can send email or run commands can cause real loss.

## Technical definition

In indirect prompt injection, adversary-written instructions arrive through a data channel the application retrieves, such as a web page, document, email or tool result, not through the user's own input. Greshake and colleagues, in a paper first submitted to arXiv in February 2023, describe attackers strategically injecting prompts into data likely to be retrieved, which lets them attack LLM-integrated applications remotely. OWASP's LLM01 entry says indirect injections occur when an LLM accepts input from external sources such as websites or files. Its mitigations include segregating and identifying external content, least-privilege access, human approval for high-risk actions, input and output filtering, and adversarial testing.

## How it shows up when you use agents

Every time a coding agent reads something you did not write, indirect prompt injection is possible. That includes a README in a cloned repository, a web page fetched during research, an issue comment, a tool result from an [MCP server](/glossary/mcp-server), or a third-party skill file. Untrusted external content can influence the model's context, whether supplied directly, through multimodal inputs or through a tool-produced summary. It need not arrive as one undifferentiated text stream. IBM describes the attack as hackers hiding payloads in the data the LLM consumes.

This is why the damage depends on access. A model that only returns text can mislead you. An [agent](/glossary/ai-agent) with [tool calling](/glossary/tool-calling) can act on the injected line: read a secret, run a command, send a message. Anthropic's Claude Code documentation advises reviewing suggested commands before approval and avoiding piping untrusted content directly to Claude.

What breaks when this is misunderstood: people assume that a message from the user is the only source of instructions, and approve actions without asking where the idea came from. Next action: before an agent processes outside content, decide what it could do if that content lied, and remove that access or require approval. The guide [Check a Claude skill from GitHub before installing](/learn/check-a-claude-skill-from-github-before-installing) applies this to skills. See also [prompt injection](/glossary/prompt-injection) for the general concept.

## Common confusions

- **Indirect versus direct prompt injection.** In direct injection, the person using the model types the manipulating input. In indirect injection, the instructions come from external content the model reads. OWASP treats both under LLM01.
- **Indirect injection versus jailbreak.** A [jailbreak](/glossary/jailbreak) is a user trying to get the model to break its own rules. Indirect injection delivers malicious instructions through external content; the user may or may not see them.
- **Visible versus hidden.** Injected text does not have to be visible to a person. IBM notes that malicious prompts can also be embedded in images that an LLM scans.
- **Myth: a filter solves it.** IBM says input filters can block known injections but new malicious prompts can evade them, and OWASP lists filtering as one mitigation among several.

## Worked examples in this catalogue

### [Check a Claude Skill From GitHub Before Installing It](https://skillalmanac.com/learn/check-a-claude-skill-from-github-before-installing)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A step-by-step review of a GitHub skill before it runs, including searching for injected shell commands, hooks and pre-approved tools, and reading scripts before you install.

Why it exercises the concept: A skill file is text an agent will read and may follow. Reviewing it first is a hands-on way to treat outside content as untrusted before the agent sees it.

### [skill-safety-audit](https://skillalmanac.com/skills/skill-almanac/skill-safety-audit)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A scan of a third-party agent skill folder that returns a JSON risk table with evidence lines before you install it.

Why it exercises the concept: It checks one common channel for planted instructions, a third-party skill, before an agent is allowed to load it.

### [prompt-writing](https://skillalmanac.com/skills/skill-almanac/prompt-writing)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A skill that writes and lints LLM prompts with a fixed structure, injection rules and a numeric test plan.

Why it exercises the concept: It covers injection rules at the prompt-writing stage.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code's security page lists best practices for untrusted content, including avoiding piping untrusted content directly to Claude and reviewing suggested commands before approval.

Why it exercises the concept: Claude Code reads files, web pages and tool results, so those are the channels through which indirect injection could arrive. Its documentation describes the safeguards.

## Related terms

- [Prompt injection](https://skillalmanac.com/glossary/prompt-injection.md)
- [AI agent](https://skillalmanac.com/glossary/ai-agent.md)
- [Tool calling (function calling)](https://skillalmanac.com/glossary/tool-calling.md)
- [LLM security](https://skillalmanac.com/glossary/llm-security.md)
- [Guardrails](https://skillalmanac.com/glossary/guardrails.md)
- [OWASP Top 10 for LLM Applications](https://skillalmanac.com/glossary/owasp-llm-top-10.md)

## Sources

- [Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection](https://arxiv.org/abs/2302.12173), arXiv (Greshake et al.) (accessed 2026-11-24)
- [LLM01:2025 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/), OWASP GenAI Security Project (accessed 2026-11-24)
- [What is a prompt injection attack?](https://www.ibm.com/think/topics/prompt-injection), IBM (accessed 2026-11-24)
- [Security](https://code.claude.com/docs/en/security), Anthropic (Claude Code Docs) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
