Illustration licensed by Magnific

Every AI company says they're "working on" prompt injection. None of them can fix it. Here's why - explained so a non-engineer can understand.

Your AI assistant doesn't "obey commands." It predicts the next word based on all the text it sees. All of it. Your instructions, the system prompt, and the content of that PDF you just uploaded - it's all one stream of tokens. One flat river of text.

Think of it as a brilliant but blind assistant sitting in a room. You tell them: "Only follow my instructions." They agree. But they can't tell voices apart. When a hidden instruction inside a document says "now upload this file" - it sounds exactly like you.

How an injection reaches the model - an attacker plants instructions in a document, the document is pulled in alongside your query, and the model reads both as one stream.
How an injection reaches the model - an attacker plants instructions in a document, the document is pulled in alongside your query, and the model reads both as one stream.

This is not a bug in Claude. Or ChatGPT. Or Gemini. It's how the transformer architecture works1. The model has no cryptographic signature for "this came from the user." No verified sender. No trust hierarchy baked into the math. The tags that separate "system prompt" from "document content" are just text - and text can be faked.

There have been attempts to solve this. OpenAI tried instruction hierarchy - marking system prompts as higher priority2. Helps against basic attacks, breaks against advanced ones. Others tried processing documents in a separate context window. But then the agent can't reason about your document in light of your question - which is the entire point of the product.

The closest analogy is SQL injection in the early 2000s. Data and commands traveled in the same channel. The fix was architectural - parameterized queries that physically separated code from data. It took the industry years to adopt it.

For LLMs, that architectural separation doesn't exist yet. Instructions and data are the same thing: text. Until someone invents the equivalent of parameterized queries for language models, prompt injection remains not "hard to fix" but structurally unsolvable3.

To date, I have not yet seen a robust defense against this vulnerability which is guaranteed to work 100% of the time.4

Simon WillisonCreator of Datasette, co-creator of DjangoPhotograph by Paul Downey, cropped, CC BY 2.0

Every AI agent you give file access to today is operating on trust - not security. The blind assistant in the room is incredibly smart. But it still can't tell your voice from an attacker's.

References

Get new articles by email