What is Indirect Prompt Injection?

A procurement team uses an AI agent to review supplier documents. An incoming document contains instructions unrelated to the procurement task, and the agent treats those instructions as commands.

Indirect prompt injection is an attack in which an attacker places instructions inside external content that a large language model or AI agent processes, rather than submitting those instructions through the user’s prompt, potentially causing the system to disclose information, perform unauthorized actions or deviate from its intended task.

How does indirect prompt injection work?

An enterprise AI application may retrieve information from websites, emails, shared documents, databases or external tools. When the application passes retrieved content to a language model, the model processes that content alongside instructions describing its intended task. CUBIG’s article on AI agent permissions describes a related path without an attacker, where an approved action carried a value the user never chose to share.

An attacker can place instructions inside material that the application may retrieve. If the model interprets those instructions as authoritative rather than treating them as external data, the application may behave in ways that the user did not request.

Greshake et al. (2023) examined this problem in research on indirect prompt injection against LLM-integrated applications. The researchers demonstrated how instructions embedded in retrieved content could influence application behavior without requiring direct interaction between the attacker and the model.

Unlike direct prompt injection, indirect attacks originate in content that the application processes rather than in the user’s immediate request.

Why does indirect prompt injection matter for AI agents?

AI agents can retrieve information and use tools to perform business operations. When an agent follows instructions found in external content, the consequences may extend beyond an incorrect response to include unintended actions involving connected systems.

OWASP identifies prompt injection as LLM01 in its 2025 Top 10 for LLM Applications, distinguishing attacks that originate in user inputs from attacks that originate in external content.

Potential consequences depend on the information and capabilities available to the application. An agent with access to confidential records may expose sensitive information through unauthorized disclosure or data exfiltration. An agent with permission to modify business records may attempt actions outside the requested workflow.

How can teams reduce indirect prompt injection risks?

Teams should establish controls around how AI applications interpret external content, access information and perform actions. Relevant measures include:

  • Mark external content as data: Treat retrieved content as untrusted information rather than an authoritative source of commands.
  • Restrict permissions: Apply least privilege to limit the information and tools available to an agent.
  • Control data transfers: Restrict which information the application can send to external destinations.
  • Require approval: Introduce human authorization before sensitive or consequential actions.
  • Evaluate behavior: Test whether the application follows authorized instructions when external content contains conflicting directions.

Input filters can help identify suspicious content, but no single filter eliminates indirect prompt injection risk. Teams should evaluate how the complete application behaves when untrusted content enters a workflow and verify that independent controls constrain the resulting actions.

Frequently asked questions

What is an example of indirect prompt injection?

An attacker hides instructions in a supplier document, and an AI agent that retrieves the document during a business task follows them, for example by sending data to an outside address.

How does indirect prompt injection differ from direct prompt injection?

Indirect injection originates in external content, while direct injection originates in the user's input.

Can input filtering prevent all indirect prompt injection attacks?

No. Teams combine several controls to reduce the risk, including restricted permissions, controlled data transfers and approval requirements.