What Is Indirect Prompt Injection in AI Agents?
- Focus
- Indirect Prompt Injection
- Risk
- High
- Stack
- Supabase/Next.js
- Detection
- Ubserve Runtime Simulation

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
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

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.
Runtime exploit simulation + behavioral authorization checks.
Clear proof path showing where trust boundaries fail.
AI-ready fix prompts and implementation-level patch guidance.
FAQs
How is indirect prompt injection different from direct injection?+
Why is this critical in production apps?+
Where does this fit in the OWASP LLM Top 10?+
What's the single highest-leverage fix?+
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?.
