PioneerQ Start free

Assuren guide · Updated 2026-11-25

Prompt injection to data exfiltration: how agents leak data and how to prove the fix

A prompt injection becomes data exfiltration when untrusted text reaches an agent that can both read sensitive data and send data out. You test for it by tracing that path end to end, and you prove a fix by replaying the original attack and showing the data can no longer leave.

What prompt injection to exfiltration means

The OWASP Top 10 for Large Language Model (LLM) Applications 2025 lists Prompt Injection as LLM01, Sensitive Information Disclosure as LLM02 and Excessive Agency as LLM06.[1] Data exfiltration through an agent is where those three entries meet.

OWASP describes prompt injection as input that alters a model's behavior or output in unintended ways, and notes the input does not have to be visible to a person as long as the model parses it.[2] It separates two forms. In a direct injection, the user's own prompt changes the behavior. In an indirect injection, the model takes in outside content, such as a web page or a file, that carries instructions.[2]

Among the listed impacts of prompt injection, OWASP names disclosure of sensitive information, including data exfiltration, and unauthorized access to functions available to the LLM.[2] The National Institute of Standards and Technology (NIST) Generative AI Profile makes the same point: it says security researchers have shown indirect prompt injections stealing proprietary data or running malicious code remotely.[5]

For a chat window, an injection mostly produces bad text. For an agent with tools, it produces actions. That is why the question to ask about an agent is not "can it be injected?" (OWASP says prompt injection cannot be fully prevented given how generative models work[2]) but "if it is injected, what can it reach?"

How the attack path forms: three legs

An exfiltration path through an agent needs three things to be true at once. Remove any one and the path breaks.

  1. An untrusted input leg. Something an outsider can write reaches the model's context: an inbound email, a support ticket, a shared document, a retrieved web page, a code comment, or a tool result.
  2. A sensitive read leg. The same agent can call a tool that returns data it should protect: customer records, source code, credentials, health or financial data. OWASP's LLM02 entry lists personal data, financial details, health records, security credentials and confidential business data among the information at risk.[3]
  3. An egress leg. The agent can move data somewhere an attacker can see: a send-email tool, an outbound HTTP fetch, a ticket comment on a public project, a file write to a shared bucket, or even a rendered link or image URL.

The injected instruction simply asks the agent to fetch the sensitive item and pass it to the egress tool. Nothing is "hacked" in the traditional sense. Every call is one the agent was permitted to make.

This is where Excessive Agency matters. OWASP traces it to three root causes: excessive functionality (tools the application does not need), excessive permissions (tools with more downstream access than the task requires) and excessive autonomy (high-impact actions with no independent check).[4] Each one widens a leg of the path.

MITRE ATLAS, a living knowledge base of adversary tactics and techniques involving AI, catalogs this pattern directly. Its matrix includes an LLM Prompt Injection technique and an Exfiltration tactic with a technique named Exfiltration via AI Agent Tool Invocation.[6]

Why input filters alone do not close the path

Teams often respond to injection risk by adding a classifier in front of the model. Filtering helps, and OWASP lists input and output filtering among its mitigations.[2] But a filter is a detection control. It lowers the odds that a given payload works. It does not change what the agent can reach if a payload gets through, and payloads can be phrased in endless ways.

The stronger mitigations in OWASP's guidance are structural:

  • Enforce least privilege, give the application its own scoped tokens, and handle privileged functions in code rather than through the model.[2]
  • Require human approval for high-risk or privileged actions.[2][4]
  • Clearly separate and label untrusted content.[2]
  • Avoid open-ended tools such as arbitrary shell or URL fetch in favor of narrow ones, and enforce authorization in downstream systems instead of relying on the model's judgment.[4]

Each of these removes or narrows a leg. That gives you something you can verify. "The agent has no tool that can send data to an arbitrary domain" is a fact you can check. "The classifier will catch it" is not.

How to test for it and prove a fix

A useful test has two halves: show the path exists, then show it is gone.

1. Map the agent. List every input source, every tool and the credential behind it, every data store those tools reach, and every way data can leave. Mark which inputs an outsider can influence. NIST's Generative AI Profile suggests enumerating generative AI systems into the organization's AI inventory as a governance action (GV-1.6-001).[5]

2. Compute the paths. For each untrusted input, ask which sensitive reads and which egress tools are reachable in the same session. Do this from the configuration, not from guesswork. A path is a concrete chain of edges, and you should be able to name each one.

3. Replay the attack. Plant an injection in the untrusted source and run it against a sandbox or staging copy of the agent. Record whether the sensitive item reached the egress tool. NIST's profile lists AI red-teaming for resilience against prompt injection as a suggested Measure action (MS-2.7-007).[5] OWASP likewise recommends regular adversarial testing that treats the model as an untrusted user.[2]

4. Fix the structure. Cut a leg: remove the egress tool, restrict it to an allow-list, split the agent so the one that reads untrusted input cannot read sensitive data, or add a human approval step on the send.

5. Replay the same attack against the fixed system. The fix is proven only when the original path no longer reaches egress. A new alert that fires while data still leaves is not closure.

6. Keep checking. Agents change weekly. A new connector or tool can reopen a closed path. Security and privacy control catalogs already expect this: NIST SP 800-53 control SC-7(10) asks organizations to prevent exfiltration and to conduct exfiltration tests at a defined frequency.[7]

Practical checklist

  • Inventory every agent, its tools, its credentials and its data stores.
  • Mark every input an outsider can write to, including tool results and retrieved documents.
  • For each agent, list every path from an untrusted input to a sensitive read to an egress tool.
  • Remove tools the task does not need; replace open-ended tools with narrow ones.
  • Scope every tool credential to the minimum the task requires.
  • Put egress behind an allow-list or a human approval step.
  • Separate agents that read untrusted content from agents that touch sensitive data.
  • Replay a planted injection before and after each fix, and keep the results as evidence.
  • Re-run the path analysis whenever a tool, connector or permission changes.
  • Treat detection-only controls as defense in depth, not as closure.

How Assuren does it

Assuren is built around this exact failure. It builds a trust graph of an AI system: agents, identities, credentials, tools, MCP servers, data stores and egress, with untrusted-input paths marked. Over that graph it runs deterministic computations, including injection-to-exfiltration reachability, excess privilege and egress exposure.

Every finding is a deterministic verdict that carries the exact contributing edges as evidence, so a reviewer can see which input, which read and which send make up the path. A model never decides a verdict.

Closure works the way the test above describes. Assuren replays the original injection, in a sandbox stand-in or against your staging agent, and accepts a fix only when re-evaluating the path against the fixed architecture shows the data can no longer leave. A detection-only control is refused as closure. If a later change brings the path back, the finding reopens on its own.

For runtime defense, an optional inline gateway can block injection and redact secrets and personal data, enforced by deterministic rule. Findings map to the OWASP Top 10 for LLM Applications, MITRE ATLAS and the NIST AI Risk Management Framework; see our guide to AI risk management evidence.

Assuren runs read-only inside your boundary, and most of the analysis needs no source code: a declared intake, the agent's configuration, and runtime telemetry are enough. You can create a free workspace and run it on your own agent.

Run this check on your own agent

Create a free Assuren workspace, register an agent and Assuren maps its trust graph, traces injection-to-exfiltration paths and proves each fix by replay. It runs read-only inside your boundary.

Create your workspace How Assuren works

Questions

Can prompt injection be fully prevented?

No. OWASP states that prompt injection cannot be fully prevented given how generative models work, so its mitigations aim to reduce impact. The practical goal is to make sure an injected agent has no path from untrusted input to sensitive data to egress.

What is the difference between direct and indirect prompt injection?

A direct injection comes from the user's own prompt. An indirect injection arrives inside content the model ingests, such as a web page, a document, an email or a tool result. Indirect injection is the usual route to exfiltration because the attacker never needs access to the agent's interface.

Which OWASP entries cover agent data exfiltration?

In the OWASP Top 10 for LLM Applications 2025, LLM01 Prompt Injection covers the entry point, LLM02 Sensitive Information Disclosure covers the data at risk, and LLM06 Excessive Agency covers the over-broad tools and permissions that let the attack act. Testing for exfiltration means checking all three together, because a fix to any one of them can break the path.

What counts as proof that a fix works?

Replay the original injection against the fixed system and show the sensitive data no longer reaches any egress tool. An alert that fires while the data still leaves does not count as a fix. Keep the before and after results as evidence.

Does testing need access to our source code?

Not with Assuren. Path analysis works from the agent's configuration, a declared intake and runtime telemetry. It runs read-only inside your boundary, and only typed findings leave the analyzer.

Sources

  1. OWASP Top 10 for LLM Applications 2025. OWASP Gen AI Security Project. https://genai.owasp.org/llm-top-10/
  2. LLM01:2025 Prompt Injection. OWASP Gen AI Security Project. https://genai.owasp.org/llmrisk/llm01-prompt-injection/
  3. LLM02:2025 Sensitive Information Disclosure. OWASP Gen AI Security Project. https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/
  4. LLM06:2025 Excessive Agency. OWASP Gen AI Security Project. https://genai.owasp.org/llmrisk/llm062025-excessive-agency/
  5. NIST AI 600-1, Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile (July 2024). National Institute of Standards and Technology. https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.600-1.pdf
  6. MITRE ATLAS. MITRE. https://atlas.mitre.org/
  7. NIST SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations. National Institute of Standards and Technology. https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-53r5.pdf

More Assuren guides