Every few months a demo makes the rounds: an email that hijacks an assistant, a web page that redirects an agent, a document that quietly rewrites a summary. The reaction cycle is always the same. Someone calls it a bug, someone ships a filter, the filter gets bypassed by Tuesday, and the conversation moves on until the next demo. The cycle repeats because the industry keeps misfiling the problem. A bug is a defect in an otherwise sound design. Prompt injection is the design: a language model has exactly one channel, and everything arrives on it.

System prompt, user message, retrieved document, tool result, yesterday's memory: by the time the model sees them, they are all just tokens in one context. The labels we wrap around them are formatting conventions, not enforcement. The model follows instructions wherever persuasive instructions appear, because following instructions in natural language is the entire capability we bought. That is why this essay is not about eliminating injection. It is about building systems that remain safe while injection happens, which is a tractable engineering problem with real answers.

The Version That Matters Is Indirect

Direct injection, a user typing hostile instructions into your chat box, is the demo version. The user can only attack their own session, and the damage mostly bounds itself. The version that matters is indirect: instructions embedded in content your system processes on the user's behalf. The web page your agent reads. The email your assistant summarizes. The PDF in the support ticket. The repository file your coding agent opens. The attacker does not need access to your system; they need their content to pass through it, and processing third-party content is most of what we build these systems to do.

Three shifts turned this from curiosity to the top of the threat list. Retrieval pipelines now feed uncurated corpora into the context as a matter of course, so attacker-controlled text arrives pre-trusted, wearing your own citation format. Agents now hold tools, so a hijacked model does not just say something wrong, it does something wrong, with your credentials, through every connection MCP made easy to add. And memory gave injections persistence: a poisoned fact written today fires in sessions that never touched the hostile content, long after the original page is gone. An injected instruction in a stateless chat was a prank. The same instruction in a tool-wielding agent with memory is an intrusion with a foothold.

The Trifecta That Turns It Catastrophic

Not every injection is a disaster, and knowing which ones are is the most useful lens in this space. The catastrophic case needs three things at once: access to private data, exposure to untrusted content, and a channel to communicate outward. An agent with all three can be steered into reading something sensitive and smuggling it out, in a tool call, a generated link, a sent message, anywhere bytes leave the system.

Remove any leg and the attack degrades. No private data and there is nothing to steal. No untrusted content and there is no way in. No outbound channel and the stolen goods stay put. So the first security question for any agent design is not "how good is the filter," it is "which legs of the trifecta does this agent hold, and which one can I remove." Often one is removable at near-zero product cost: the research agent does not need send permissions; the email assistant does not need the whole mailbox; the summarizer does not need network access at all. The feature you decline to grant is the exfiltration you decline to enable.

What Does Not Work

The popular defenses share a property: they lower the hit rate without bounding the damage, and a lower hit rate against an adaptive attacker is a schedule, not a wall.

Instruction filters scan for "ignore previous instructions" and its cousins, and lose to paraphrase, other languages, encodings, and instructions that do not pattern-match as instructions. Delimiters and pleading, wrapping content in tags and telling the model to treat it as data, are worth doing as hygiene and fold under pressure, because the mechanism that reads the warning is the same one the attack is aimed at. Detection models are the strongest of the three and still probabilistic: they see yesterday's attacks, miss tomorrow's, and at any real false-positive rate they train your team to click through alerts. None of these are useless. All of them are seatbelts sold as brakes.

What Works: Bound the Blast Radius

The defenses that hold share the opposite property: they do not try to stop the injection, they cap what a successful one can do. This is the same argument I made about guardrails, gate actions rather than words, applied as architecture.

Scope capabilities to the task, not the product. The model can only call what you hand it, so hand it less: per-task tool lists, read-only variants by default, credentials scoped to the narrowest slice that works. Every tool the current step does not need is attack surface you are carrying voluntarily.

Put humans in front of consequences. Sending, deleting, publishing, paying, and anything else that is expensive to undo gets a confirmation step that shows what is about to happen. An injection that must march its stolen goods past a human approval loses most of its value. Reserve the friction for consequential actions and it stays tolerable.

Track taint. The discipline in one sentence: content-derived text never becomes an instruction to act outward. Once untrusted content enters a context, that context's outputs are tainted; tainted turns can summarize and extract, but requests for consequential tool calls that originate in tainted content get refused or escalated. Separating the reader from the actor, a quarantined model that touches the dirty content and a privileged one that never does, is the clean version of the same idea.

Constrain the output. A model that must emit a schema, an enum verdict, a bounded summary with no free-form URLs, has a dramatically narrower channel to smuggle anything through. Exfiltration needs an open output; do not provide one where the task does not require it.

Log the full context. When something goes wrong, you need to know what the model actually saw, which document carried the payload, and what fired after it arrived. Injection without context logging is a breach you cannot even reconstruct.

Social Engineering, Not SQL Injection

The comparison everyone reaches for is SQL injection, and it teaches the wrong lesson. SQL injection died because parameterized queries separated code from data at the protocol level, and the fix cost nothing: the database never needed to take instructions from query results. The LLM equivalent would be a model that takes instructions only from a privileged channel, and research keeps moving that way, but the capability we are buying, read this content and act sensibly on what it says, is the vulnerability. The instruction-following is the product. You cannot subtract it without subtracting the point.

The better analogy is social engineering. Nobody ships a patch that makes employees immune to persuasion. Instead: least privilege, approval chains for wire transfers, separation of duties, audit logs, and the assumption that some calls will get through. Mature organizations stay safe not because the con never lands but because the person who answers the phone cannot empty the vault alone. Build your agents the same way. Assume the model will, sometimes, believe a document that lies to it. Then arrange the system so that a deceived model, like a deceived employee, simply does not have the keys to do anything irreversible about it.

FAQ

What is prompt injection?
Text the model processes as data carrying instructions it follows as if legitimate. It works because everything, system prompt, user input, documents, tool results, arrives as tokens in one channel, with no hard boundary between obey and read.

Prompt injection vs. jailbreaking?
Jailbreaking is a user talking a model out of its own rules; the victim is the policy. Injection is third-party content hijacking a system that processes it; the victims are the user and the application. Injection is the system builder's problem, because it arrives through content you chose to process.

How do you defend against it?
Assume some injections land and bound what success buys: task-scoped capabilities, human approval on consequential actions, taint discipline on untrusted content, constrained outputs, and never all three trifecta legs in one agent. Filters lower the hit rate but bound nothing.

Can it be fully solved?
Not with current architectures. SQL injection died because code and data could be separated at the protocol level. An LLM's value comes from processing both in one natural-language channel. Treat it like social engineering: limit what the mark can hand over.