Kinetic Gain · AI Security
Pillar guide

Prompt injection defense: reduce the blast radius you cannot fully close

By Kinetic Gain, AI Security Last updated

Prompt injection is the class of attack where adversary-controlled text is read by a large language model as instructions to follow rather than data to process. OWASP ranks it LLM01, the top risk in its Top 10 for LLM Applications, and there is no complete fix today. This page goes deep on injection as its own discipline: the direct and indirect attack surface, the confused-deputy problem that makes AI agents dangerous, and the layered defenses that shrink the blast radius. The retrieval-specific channel, poisoned documents and vector stores, is covered in the RAG security pillar.

Prompt injection: untrusted content enters one LLM context that has no boundary between instructions and data, and the model then acts through tools that run with the agent's own privilege, the confused-deputy problem. Untrusted content web, email, tool output One LLM context no instruction / data boundary Tools act with the agent's privilege confused deputy: send, pay, delete
The attack path: untrusted text becomes an instruction because the model cannot tell instructions from data, then executes through tools that carry the agent's authority, not the attacker's.

What prompt injection actually is

Prompt injection is a class of attack in which adversary-controlled text is interpreted by a large language model as instructions to follow rather than as data to process. The core insight is architectural: an LLM receives one flat token stream and has no reliable, enforced boundary between the developer's instructions and the content it is asked to operate on. Whatever channel the words arrive through, the model weighs them as candidate instructions. There is no built-in privilege bit that marks some tokens as trusted commands and others as inert data.

Prompt injection comes in two shapes. Direct injection is when the attacker submits the malicious instruction straight into the prompt, for example typing an override into a chat box. Indirect, or cross-domain, injection is when the malicious instruction is planted in third-party content the model later reads, a web page, an email, a document, or a tool result, so the attacker never interacts with the model directly and the payload rides in on content the application trusts. OWASP ranks this whole class as LLM01, its top LLM application risk.

Why it is not "just input validation"

The model is the parser, and natural language has no escape character

Classic injection attacks like SQL or shell injection have a formal grammar, so you can parameterize, canonicalize, and escape the payload before it reaches the interpreter. Natural language has no escape character and no grammar you can normalize against, and the model is simultaneously the parser and the executor, so there is no separate stage where you can neutralize the instruction before it takes effect.

The second reason it is hard is the source problem. Injected instructions can arrive from any content the model reads, and in an agent that means web pages, emails, PDFs, retrieved documents, and the outputs of other tools. You cannot enumerate that input space, and much of it is attacker-controllable. Any filter you add is a probabilistic classifier that raises the attacker's cost, not a parser that closes the hole. Plan on defense in depth, not a single gate.

The attack surface

The concrete surfaces map to how untrusted text reaches the model and what the model can do next. System-prompt override is the direct case: user text that instructs the model to ignore prior instructions, reveal its system prompt, or drop its guardrails. Indirect injection via retrieved or browsed content is the higher-leverage case, where the payload is embedded in a page, email, or document the model ingests. The retrieval and vector-store specifics of that channel are covered in the RAG security guide, so treat it here as one more untrusted input that can carry instructions.

Tool-call hijacking is the agent-specific surface: injected text steers the agent into calling a tool, often with attacker-chosen arguments, turning a read task into a write, send, or delete. Multi-turn and memory poisoning plant instructions in conversation history or persistent memory so they fire on a later turn, past whatever review happened at ingestion.

Underneath all of these sits the confused-deputy pattern: the agent holds credentials, scopes, and tool access that the attacker does not, so an injected instruction executes with the agent's authority rather than the attacker's. The privilege gap is what converts a text trick into real impact.

DimensionDirect injectionIndirect injection
Source of instructionThe user's own prompt input, submitted straight to the modelThird-party content the model ingests later, such as a web page, email, document, or tool output
Attacker access neededMust interact with the application directly as a userOnly needs to control content the target will later read, no direct access to the app
Typical targetThe app's own system prompt, guardrails, or a single sessionAny user or agent that consumes the poisoned content, potentially at scale
Hardest challengeYou cannot reliably separate natural-language instructions from data in one contextUntrusted content enters through channels you do not control and can look completely benign
Example vectorA chat message that says to ignore prior instructions and reveal the system promptA hidden instruction embedded in a web page or email that an assistant reads while summarizing

Defenses that actually help

There is no complete fix for prompt injection today. The realistic goal is defense in depth plus blast-radius reduction, so a successful injection does something small and recoverable instead of something catastrophic. Start with privilege separation and least-privilege tools: give the agent the narrowest set of scopes and actions it needs, so hijacking a tool yields little. Consider dual-LLM or quarantined-LLM patterns, where a privileged planning model never sees raw untrusted content and a separate quarantined model processes untrusted content but cannot call side-effecting tools, with only structured, validated data passing between them.

Put deterministic allow-lists in front of side-effecting actions, so the permitted operations and targets are enforced in code rather than decided by the model. Parse and validate all model output, and treat every token the model emits as untrusted: never pass it straight into eval, exec, a shell, a SQL string, or another tool without checking it. Finally, require human confirmation for irreversible actions, the ones that spend money, send communications, or cannot be undone. Each layer is imperfect, which is exactly why you stack them.

Reduce prompt injection blast radius in an AI agent

  1. Inventory side-effecting tool actions. Enumerate every tool the agent can call and label each as read-only or side-effecting, meaning it writes, sends, pays, deletes, or executes.
  2. Apply least-privilege and allow-lists. Scope each tool to the minimum data and actions it needs, and constrain side-effecting calls to a deterministic allow-list of permitted operations and targets enforced in code.
  3. Add human confirmation gates on irreversible actions. Require explicit human approval before any action that spends money, sends communications, or cannot be undone.
  4. Red-team with an injection test suite. Run a maintained battery of direct and indirect injection payloads against the live agent and gate releases on the results.
Illustrative pattern, not a claimed incidentAn email-reading assistant is asked to summarize a user's inbox. One incoming message contains hidden text instructing the assistant to forward recent emails to an external address and then delete the originals. Because the assistant treats email body text as instructions rather than data, it can act on the injected command using the mailbox access it was given.
Illustrative pattern, not a claimed incidentA browsing agent is told to research a topic and visits an attacker-controlled page. The page embeds instructions telling the agent to exfiltrate its current context or call a connected tool with attacker-chosen arguments. Reading the page as trusted input, the agent may follow those instructions with whatever privileges it holds.

What to measure

Measure exposure, not vibes. Stand up a red-team injection test suite, track which agent actions are side-effecting versus read-only, and measure how many of your irreversible actions actually sit behind a human-confirmation gate. MITRE ATLAS is a useful reference for framing the adversarial-ML tactics your test suite should cover.

Injection test coverage

A maintained battery of direct and indirect payloads run through the real agent, scored pass or fail so regressions surface and releases can gate on it.

Target: run every release, trend the pass rate

Side-effecting action ratio

Of all actions the agent can take, the share that write, send, pay, delete, or execute. That is where injection turns into damage.

Target: minimized and justified per action

Human-confirmation coverage

Share of money-moving, message-sending, and non-undoable operations that require an explicit human approval before running.

Target: full coverage of irreversible actions

Privilege scope per tool

The scopes and data each tool can reach. Tracking it alongside the others gives an auditable picture of blast radius, not a claim of safety.

Target: least privilege, reviewed

FAQ

Is prompt injection the same as jailbreaking?
No. Jailbreaking targets the model's own safety policy, trying to coax it into producing content the provider trained it to refuse. Prompt injection targets your application's trust boundary, hijacking the instructions the model follows so it misuses the tools and data your app granted it. The techniques overlap, but the asset at risk is different, and defending one does not defend the other.
Can input filtering stop prompt injection?
No, not completely. Natural language has no escape syntax, so any filter is a probabilistic classifier that raises the attacker's cost without closing the gap. Use it as one layer among several, never as the control you rely on.
Does a bigger or better model fix it?
No. A more capable model still receives one undifferentiated context and has no architectural boundary between instructions and data. Capability does not resolve the instruction versus data problem, and a smarter model can even widen the blast radius by carrying out an injected instruction more effectively.
Why are AI agents especially exposed to prompt injection?
Agents both read untrusted content and hold privileges to act, calling tools, sending messages, moving money, and writing to systems. That combination is the confused-deputy setup: injected text in content the agent reads can drive real side effects under the agent's authority. The answer is not a better prompt, it is least-privilege tools, deterministic allow-lists, and human confirmation on irreversible actions.