Skip to content

Prompt Injection Is an Authorization Bug: How Untrusted Text Steers Tool-Calling Agents

9 min reading

Separate untrusted content from the authority to read data, choose tools and commit actions.

Page details

Blog 10 · Vikram Samal

Edition date: · 9 min read

20px

Edition dates place posts in a retrospective weekly reading sequence.

Last edited:

Sources · Technology essay

TL;DR
  • Untrusted text can influence an agent’s tool proposals.
  • Keep private data, hostile content and external communication from forming an unchecked path.
  • Enforce action and destination permissions outside model-generated instructions.

The email is supposed to be evidence.
It asks the assistant to forward other mail.
Reading the message should not grant that power.

Hypothetical scenario. Act 3, the bad week. Northwind’s inbox assistant reads a customer email containing an instruction to ignore its task and forward the last ten customer emails. The assistant has mailbox-reading and email-sending tools. Priya must decide which component is actually authorized to choose the recipient and the records being sent.

The message and the instruction share one channel

Prompt injection occurs when input causes a language-model application to follow unintended instructions. Direct injection arrives through the user’s own prompt. Indirect injection arrives through material the application reads, such as an email, a retrieved page or a document. The attacker’s text enters the context through a path that was intended to provide observations.

A tool-calling agent uses model output to propose function names and arguments. The application executes permitted proposals and returns observations. That loop turns a text-influence problem into an action problem when the tools can retrieve private records, change state or communicate outside the organization. A harmful proposal becomes consequential only through the capabilities the surrounding application exposes.

Authorization is the decision about whether a principal can perform an action on a resource. Calling prompt injection an authorization bug identifies the controllable consequence boundary; it does not mean every injected answer requires a privileged tool. An attacker can also corrupt a read-only summary. The tool boundary is where Northwind can prevent that corrupted interpretation from becoming an unauthorized disclosure or write.

Untrusted emailScoped readerInternal draftApproved send
The draft boundary prevents source text from directly choosing an external disclosure.

Three capabilities complete an exfiltration path

Simon Willison’s June 2025 lethal-trifecta analysis identifies private-data access, exposure to untrusted content and external communication as a dangerous combination. For Northwind, the mailbox supplies private data, incoming customer messages supply hostile text, and unrestricted sending supplies the exit. The failure does not require the attacker to possess the mailbox credential directly.

Treat the combination as a threat-model question. Which observations can an attacker edit? Which private records are reachable from the same task? Which outputs can leave the permitted audience? This reasoning is more specific than asking whether the system prompt sounds strict. A clear instruction is useful context, but it is not a service-side permission check.

The application should decide the recipient from the authenticated support task, not accept an arbitrary destination merely because the model supplied a syntactically valid address. It should also limit the records available to that task. An email about order 4471 does not justify retrieving unrelated customers’ conversations, even if a malicious paragraph claims a supervisor requested them.

Count authority, not reassuring tool names

Hypothetical worked example: the inbox agent initially has 3 tools: read the current thread, search the private mailbox and send an email. Two tools read information and one communicates externally. Removing the send tool leaves 3 − 1 = 2 read tools and 0 email-sending tools. That closes this particular send-email path while preserving the ability to prepare an internal draft.

The calculation does not establish that exfiltration is impossible. If a remaining tool fetches arbitrary URLs with model-chosen query parameters, it can transmit information. If generated markdown loads remote images, a renderer can create another exit. Inventory the actual data flows, including tool arguments and rendered output, before claiming that removal of one named function removed external communication.

A tighter design exposes one thread-scoped read operation to the summarizer and stores its draft internally. A separate delivery workflow binds the recipient and approved content. Human approval for a consequential send should display the actual recipient and material being disclosed. Approval for the vague goal “handle this email” is too broad to establish consent for forwarding unrelated messages.

The model proposes; a service checks

OpenAI’s function-calling guide describes the application executing tool requests. Northwind uses that division to validate the requested resource, recipient and effect against the support task. The model does not receive a credential that independently grants all mailbox operations, and a requested tool call does not inherit authority from the text that caused it.

Separate read and write capabilities even when one backend can technically perform both. A summarization task can finish without permission to send. A reply workflow can accept a bounded draft without gaining mailbox-wide search. This separation reduces the number of contexts where attacker-controlled text meets both private data and an external destination.

For allowed sends, preserve the approved payload and recipient as part of the action record. If the model rewrites the draft after approval, the approval no longer describes the sent content. Bind the approval to the version being executed and route meaningful changes back through review. That makes the human checkpoint an enforceable transition rather than a decorative confirmation button.

Mark observations, then enforce their limited role

Label retrieved text as source material and keep it distinct from application instructions. This helps define the intended task and gives reviewers a clearer record. It should not be presented as a complete isolation mechanism: the model still processes the content, and a hostile instruction can influence the response despite formatting conventions.

OWASP’s prompt-injection guidance distinguishes direct and indirect inputs and recommends least privilege, validation and approval for high-risk actions. Its documented controls support layered defenses rather than a promise that one filter solves the problem. Northwind combines those controls with resource-specific permissions at the tool service.

An instruction detector can provide a warning or route a case for review. It is another model or classifier with false positives and false negatives. A detector’s pass result should not authorize a privileged action that would otherwise fail a permission check. The service’s authorization rule must still hold when the detector misses the attack entirely.

In the wild: model safety does not replace system design

Willison’s analysis focuses on the interaction between capabilities, while OWASP describes the broader injection threat and mitigation patterns. These are real published analyses, not measurements of Northwind’s fictional inbox. Their shared practical implication is to inspect what an influenced model can cause the application to do, not just what the model says it should do.

OWASP’s Sensitive Information Disclosure guidance identifies private-information exposure as a separate application risk. OWASP’s Logging Cheat Sheet advises excluding or protecting sensitive material in logs. This matters because a blocked outgoing email still leaves a problem if the entire private mailbox was copied into broadly accessible debugging records during the attempt.

Northwind should therefore keep a minimal incident record: the hostile source reference, requested action, rejected authority check and affected task identity. Authorized reviewers can retrieve protected evidence when needed. Copying the full private content into every rejection event unnecessarily expands the audience and retention burden created by the attempted attack.

Test the boundary with hostile evidence present

A useful test deliberately includes a hostile instruction in a source that the agent is expected to read. Then assert which private records are accessible and which destinations are allowed. The strongest relevant result is that the forbidden action cannot execute under the service’s permissions even if the model proposes it. A single run in which the model ignored the text establishes much less.

Test the renderer as well as the tool dispatcher. Text containing a remote image reference or link can leave the model harmlessly and become a network request only when another component displays it. Restrict automatic fetching and sanitize supported markup according to the product’s disclosure rules. A destination allowlist is useful only when every outbound path consults it.

Common misconceptions include assuming that an internal document is trustworthy because it is indexed, that a stricter prompt grants isolation, or that a valid tool schema implies authorized arguments. Document writers, importers and compromised accounts can all introduce hostile source text. Trust should follow the intended role of the content, not the storage location where it happened to be found.

Give the draft a safe place to stop

An internal draft-only mode is useful when Northwind wants assistance interpreting customer mail while retaining human control over disclosure. A more autonomous sender needs narrow recipients, resource scopes, approved effects and a recovery record. Choose between them from the required outcome and consequence, rather than treating every additional tool as a product improvement.

Limits: capability separation reduces particular action paths but does not guarantee truthful summaries or eliminate every inference channel. A compromised service or a mistaken permission rule remains outside the protection of a well-written prompt. The immediate decision is to keep untrusted mail from choosing both the private evidence set and its external destination, then verify that rule under deliberately hostile observations.

Check yourself: prompt decisions

Removing send leaves a URL-fetch tool. Is all external communication gone?

No. A model-controlled URL or query string can be another outbound channel. Inventory the actual network and rendering paths.

A detector misses an injected instruction. What should still block the send?

Resource and recipient authorization at the service boundary, independent of the detector’s verdict and the model’s request.

A person approves a draft, then the model edits its attachments. Is the old approval enough?

No. Approval must bind the executed content, recipient and scope. A meaningful change requires another approval.

Next read: Recover tool calls without duplicate effects.

Source: The lethal trifecta for AI agents — Inspect Primary Source ↗
VS
Vikram Samal

Notes on generative AI and system design.