Comparison

Direct vs indirect prompt injection and the runtime controls that stop each

Direct prompt injection arrives through the prompt interface from the user or caller. Indirect prompt injection is hidden in content the agent retrieves, such as documents, web pages, emails, or tool and MCP outputs. No single filter stops both. Layered runtime enforcement, especially at the tool-call and permission boundary, limits the impact of either.

Two entry points, two trust boundaries

Prompt injection can reach an AI agent by two different paths. The paths differ in where the malicious instruction enters and in which trust boundary it crosses, and that difference determines which controls apply.

Direct prompt injection

A direct injection arrives through the prompt interface. The user or caller supplies the instruction, so the entry point is the interface through which the model receives its prompt.

Indirect prompt injection

An indirect injection is hidden in content the agent retrieves. Documents, web pages, emails, and tool or MCP outputs can all carry instructions that enter the context as untrusted content, even though the agent fetched them as part of its normal work.

Because the two paths cross different boundaries, no single filter stops both.

Direct and indirect injection side by side

Attack path and trust boundary for each injection type
DimensionDirect prompt injectionIndirect prompt injection
Attack pathThe user or caller prompt reaches the model through the interface.Untrusted documents, web pages, emails, or tool outputs enter the context.
Source of the instructionThe user or caller.Content the agent retrieves, including tool and MCP outputs.
Trust boundary crossedThe prompt interface.The point where retrieved content enters the agent context.
Stopped by a single filter?No.No.
ContainmentLayered runtime enforcement, especially at the tool-call and permission boundary.Layered runtime enforcement, especially at the tool-call and permission boundary.

Where each runtime control helps and where it stops

Runtime controls work in layers. Each layer addresses a different part of the path from input to action, and each has a limit.

Runtime controls and their scope
ControlWhat it doesWhere it stops
Input and output inspectionApplies probabilistic checks to what enters and leaves the model, on both the direct and indirect paths.The checks are probabilistic, so inspection alone does not guarantee that an injected instruction is caught.
Tool-call boundaryUses policy, identity, and permissions to decide whether an action runs.It governs actions rather than what the model reads, so it limits impact instead of preventing the injection itself.
Audit trailRecords link each action to the content and policy decision behind it.It documents what happened and why; it does not decide whether an action runs.

Why the tool-call boundary carries the most weight

Whether an instruction came from the user or from a retrieved document, the harm usually depends on what the agent is allowed to do next. The tool-call and permission boundary is the point where policy, identity, and permissions decide whether an action runs. Enforcement there applies to both attack paths, which is why it limits the impact of either.

  1. Direct pathUser or caller prompt reaches the model through the interface.
    Indirect pathUntrusted documents, web pages, emails, or tool outputs enter the context.
  2. Input and output inspectionProbabilistic checks on what enters and leaves the model.
  3. Tool-call boundaryPolicy, identity, and permissions decide whether an action runs.
  4. Audit trailRecords link each action to the content and policy decision behind it.
Two attack paths, one enforcement boundary.

Criteria for evaluating a runtime enforcement approach

Use the following questions to assess whether an approach addresses both injection paths:

  • Does it cover both the direct path (the prompt interface) and the indirect path (retrieved content and tool or MCP outputs)?
  • Does it avoid depending on a single filter, and layer enforcement instead?
  • Does policy, identity, and permission enforcement happen at the tool-call boundary?
  • Does it treat retrieved documents, web pages, emails, and tool outputs as untrusted content?
  • Do audit records link each action to the content and policy decision behind it?

Review your agent enforcement boundary

Discuss how runtime policy, agent identity, and audit logging apply to the agents in your environment.

Request a Demo