Indirect Prompt Injection in AI Agents: How a Hidden Instruction Becomes an Authorized API Call

Indirect Prompt Injection

Table of Contents

Share Article

Key Takeaways
Indirect prompt injection is an attack where malicious instructions hide inside content an AI agent reads, such as an email, document or web page. When the agent can call tools and APIs, that hidden text can trigger a real action. The final request often comes from a valid, authorized session, so traditional security controls treat it as normal.

The AI Agent Security Shift: From Protecting Requests To Protecting Actions

Traditional application security follows a simple flow: request in, response out, with security tools inspecting the traffic.
AI agents break that flow apart. An agent talks to a large language model (LLM), retrieves information, connects to tools and calls APIs. Each connection adds a capability, and each one adds a place where something can go wrong.
That is why security teams are no longer protecting one application. They are protecting a chain of interactions, and every link in that chain can be steered by text the agent reads.

Direct Vs. Indirect Prompt Injection

Prompt injection is LLM01 in the OWASP Top 10 for LLM Applications 2025. It comes in two forms:
The indirect form was first shown at scale by Greshake et al. in Not what you’ve signed up for (ACM AISec 2023). The researchers showed attackers could exploit LLM-integrated apps, including Bing Chat, without any direct access. They simply planted prompts in data the app was likely to retrieve.
The instruction doesn’t even need to be visible. White-on-white text, HTML comments, document metadata and calendar invites are all read by the model. The attack surface is everything the agent can retrieve, not everything the user can see. For the fundamentals, see our Learning Center guide, what is prompt injection.

Why LLMs Can't Separate Instructions From Data

In SQL injection, parameterized queries fixed the problem by putting data in a channel the database never executes. LLMs have no such channel.
The system prompt, the user’s request and any retrieved document are joined into one stream of tokens. Role markers are just more tokens. Whether the model respects them is learned behavior, not an enforced boundary.
The UK National Cyber Security Centre put it plainly in Prompt injection is not SQL injection (December 2025): because there is no inherent distinction between data and instruction, prompt injection “may never be totally mitigated” the way SQL injection can be. OpenAI said the same month that prompt injection is “unlikely to ever be fully ‘solved’.”
Training-based fixes help but stay probabilistic. OpenAI’s Instruction Hierarchy research (Wallace et al., 2024) teaches models to rank system instructions above tool output.

How Indirect Prompt Injection Becomes A Harmful Action

An indirect prompt injection attack on an AI agent usually unfolds in five steps:
This chain is measurable. In InjecAgent (Zhan et al., ACL Findings 2024), a ReAct-prompted GPT-4 agent was hijacked in 24% of test cases, and a reinforced “hacking prompt” nearly doubled that rate.In January 2025, NIST’s U.S. AI Safety Institute (now CAISI) reported that new attacks raised hijacking success on an upgraded Claude 3.5 Sonnet from 11% to 81%. Repeating each attack 25 times raised average success from 57% to 80%.
A single test run understates the risk. An attacker only needs one success.

A Real-World Example: Echoleak

In 2025, researchers disclosed EchoLeak (CVE-2025-32711) in Microsoft 365 Copilot. According to the academic write-up (Reddy and Gujral, 2025), a single crafted email allowed remote, unauthenticated data exfiltration with zero clicks. The chain bypassed Microsoft’s injection classifier and leaked data through auto-fetched images. Microsoft patched it server-side.
Note the exit route. EchoLeak didn’t need an “exfiltration tool.” Any output a client renders, such as a Markdown image or link, can carry data out in its URL.

How To Defend AI Agents: API Security For The Action Layer

No single control stops prompt injection. The NCSC advises buyers to be wary of anyone who claims otherwise. The aim is to reduce what a successful injection can do.

Seeing Indirect Prompt Injection End To End

Indirect prompt injection is hard to spot because every step looks harmless on its own. The risk only shows when you watch the whole chain, from hidden instruction to authorized API call.
The Prophaze webinar on securing AI agents shows exactly that. It walks through the attack chain and the attacker’s playbook, then runs a live account takeover on a test banking assistant, with Prophaze WAAP off and then on. Watch for where the threat is detected, what control is applied and how the action is handled.
Watch the Prophaze webinar on indirect prompt injection and AI agent security, now on demand Access your recording now.

Frequently Asked Questions (FAQ)

1. Can prompt injection be fully prevented?
No. The UK NCSC and OpenAI both stated in December 2025 that prompt injection may never be fully solved, because LLMs don’t separate instructions from data. Organizations should focus on limiting what an injected agent can do, through least privilege, policy checks on every action and human approval for high-risk steps.
Jailbreaking is when a user tricks a model into breaking its own safety rules. Prompt injection is when third-party content subverts what the user or developer intended. A jailbreak mainly harms the platform’s policy, while an injection can harm the user and the organization.
A traditional WAF looks for known attack patterns in requests. An indirect injection usually produces a well-formed API call from an authorized user, so pattern matching alone won’t catch it. Controls that combine AI traffic inspection, identity context and action-level policy cover much more of the chain.
Excessive agency is OWASP LLM06:2025. It describes AI systems that can take damaging actions because they have too much functionality, too many permissions or too much autonomy. OWASP’s fixes include minimum privileges, authorization in downstream systems and human approval for high-impact actions.
Look for actions that don’t match the user’s request, such as a summary task followed by an outbound email or data export. Attribute every agent action to a user and token so unusual patterns stand out. Watch rendered outputs, such as links and images, because they can carry data out.

You May Also Like

Indonesia Bank Cyberattack

Indonesia Bank Cyberattack: What OJK Told Banks to Do

Attempts against Indonesia’s financial sector passed 1.2 million in 24 hours. No bank has confirmed

AI Security Risk Assessment

AI Security Risk Assessment: How to Measure AI Risk Across the Enterprise

Key Takeaways Most enterprises cannot see all their AI. HiddenLayer’s 2026 AI Threat Landscape Report

Weekly Threat Report November 5–11, 2026

Weekly Threat Report, November 5–11, 2026: AI Secret Exposure, OpenSSH Bypass and Refrigeration Sabotage Follow-Up

Key Takeaways Secrets in agent settings and cloud environments create persistent exposure beyond the original

Scroll to Top