Security Glossary

What Is Indirect Prompt Injection in AI Agents?

March 30, 2026Last Updated: August 13, 20262 min read
Focus
Indirect Prompt Injection
Risk
High
Stack
Supabase/Next.js
Detection
Ubserve Runtime Simulation
Agent pipeline wireframe showing malicious content flowing into model context.

Indirect prompt injection hides malicious instructions inside external content — one of the highest-impact risk classes in the OWASP LLM taxonomy.

Indirect prompt injection occurs when malicious instructions hidden in external data are executed by an agent as trusted context.

Secure your vibe-coded app with Ubserve

  • Takes less than 60 seconds
  • 100+ security checks run through your app
  • Plain English explanations for each issue
  • AI fix prompts for every issue
Scan my app free

Indirect prompt injection is an agent exploit where attacker-controlled external content becomes part of model context and overrides intended instructions. The model treats hostile context as operational guidance and executes unauthorized behavior.

This matters because the dangerous input may not come from the user chat box at all. It can come from a synced document, ticket, knowledge-base page, or scraped URL that looks harmless but includes hidden instructions that alter agent decisions.

Think of it like a manager forwarding a legitimate-looking memo that secretly contains a fraudulent payment instruction. The employee follows the memo because it arrived through a trusted channel, not because the instruction was actually safe.

Start free scan | See sample audit

How It Chains Into Bigger Failures

Indirect prompt injection is rarely the whole story — it's usually the entry point for a bigger failure class from the OWASP LLM Top 10:

  • Injected content instructs the agent to call a tool it wasn't meant to use, which is excessive agency / goal hijacking in practice.
  • If the agent is fooled into trusting a spoofed tool identity in the process, that's a MCP impersonation attack.
  • The common root cause across all three: context and instructions aren't separated by trust level before the model acts on them.

Agentic Risk (Cursor, v0, Bolt)

Ubserve 2026 agent assessments showed 16.3% of tool-enabled agent flows lacked context provenance filtering before execution. This creates exploitable instruction precedence inversion.

Wrong vs. Right

// WRONG: pass raw page/db content directly to agent tool planner
agent.run({ context: fetchedContent });
// RIGHT: classify + sanitize + isolate untrusted context
agent.run({
  trustedContext,
  untrustedContext: sanitize(fetchedContent),
  allowToolCalls: policyValidated,
});

Copy-Paste Fix Prompt for Cursor/Claude

Patch my agent workflow against indirect prompt injection.
1. Identify all external content ingestion points (web pages, docs, DB notes, tickets).
2. Add untrusted-context labeling and instruction filtering.
3. Gate tool calls behind explicit policy checks, not model confidence.
4. Add regression tests with malicious hidden instructions.
Return minimal patch set + test fixtures.

Run a free URL scan. If it finds issues, paid plans unlock the full report, exact AI fix prompts, PDF export, and deeper audit coverage.

About the author

Samuel, Founder & maker of Ubserve
Samuel
Founder & maker of Ubserve

I'm Samuel, known online as Mr. Ballaz. I build Ubserve, a security scanner for apps built with AI tools like Cursor, Bolt, Lovable, and Supabase. Before Ubserve, I did manual security audits by hand — checking auth, exposed keys, and RLS policies one by one. Ubserve is that manual audit, automated, running in under 60 seconds instead of days.

Related resources

How Ubserve Applies This in Real Scans

Ubserve treats What Is Indirect Prompt Injection in AI Agents? as a production risk, not a theory term. Our runtime simulation maps this control to attacker paths in auth, data access, and API behavior, then returns fix-ready guidance tied to your stack. OWASP-style principles are used as the baseline, but we prioritize what is actually exploitable in your live flow.

Detection

Runtime exploit simulation + behavioral authorization checks.

Evidence

Clear proof path showing where trust boundaries fail.

Remediation

AI-ready fix prompts and implementation-level patch guidance.

FAQs

How is indirect prompt injection different from direct injection?+
Direct injection targets the prompt directly; indirect injection hides payloads in fetched data the agent later consumes — a document, ticket, or scraped web page — so the attacker never has to touch your chat interface at all.
Why is this critical in production apps?+
Agents can trigger real side effects such as tool calls, data writes, or permission changes. A successful injection isn't just a weird chat response — it can mean an unauthorized file write, email sent, or record deleted.
Where does this fit in the OWASP LLM Top 10?+
It's one of the highest-impact categories in the taxonomy. See our full OWASP LLM Top 10 breakdown for how it relates to excessive agency and tool impersonation, the other two risk classes that compound with it.
What's the single highest-leverage fix?+
Label every piece of fetched content as untrusted by default, and gate tool calls behind explicit policy checks that don't depend on model confidence or the model's own judgment about whether an instruction looks legitimate.
Glossary to action

Want Ubserve to test this risk in your app?

Run a scan and get attacker-first validation, exploit evidence, and fix guidance mapped to what is indirect prompt injection in ai agents?.