Prompt Injection Detection: What Works and Where It Fails
How prompt injection detection works, why hidden instructions slip past detectors, and how to layer it with enforced controls and audit evidence in sensitive work.
You must now demonstrate that every prompt injection detector in your workflow has an enforced action when it fires, a false-positive rate your staff can work with, and an auditable record of what it flagged and why. A detector that only scores text and triggers nothing protects no one.
An analysis of 26 November 2026 of prompt injection detection methods and their failure modes argues that detection accuracy on benchmark datasets masks three harder questions: whether the false-positive rate lets your workflow function, what the system does when it fires, and what record an auditor can later read. The case it examines is an assistant that retrieves a web page to summarise for a litigation team, with hidden instructions embedded in that page. In our assessment, the distinction between a detector that classifies text and a detector paired with enforced action is the difference between appearing to have a control and actually having one.
How do prompt injection attacks reach a model when the user's request is innocent?
Prompt injection is the practice of embedding instructions in external content—retrieved documents, web pages, emails, tool outputs—that steer a model away from the task its operator set. A detector that reads only the typed request misses the route entirely. Indirect injection arrives through channels your application consumes without the user typing anything hostile. A witness statement uploaded as a file, a web page fetched to answer a question, an email thread pulled into context—each is untrusted once it reaches the model's reasoning layer.
The harder case is an attack with no recognisable command inside it. Intent spread across a long context, carried in wording the eye can't resolve, or embedded in an image defeats phrase matching completely. The cost lands on teams whose documents legitimately contain imperative language: a clinical note carries an instruction to a colleague, a contract reproduces a notice clause, a witness statement quotes a demand. A filter that blocks on imperative text produces false positives that make the tool unusable in exactly the workflows holding the most sensitive material.
Which failure modes does a detector need to catch?
- Direct instruction injection — hostile commands typed directly into the user prompt or system message.
- Indirect injection via retrieval — malicious instructions embedded in documents, web pages or emails the application fetches and supplies to the model.
- Implicit instruction attacks — intent spread across context or worded so obliquely that phrase matching misses it entirely.
- Encoding and perturbation attacks — instructions hidden in character encoding, whitespace, or imperceptible text variations that defeat string-based detection.
- Tool-parameter injection — instructions that cause the model to call a permitted tool with parameters that exceed its intended scope.
- False positives on legitimate content — benign quotations, clinical instructions and contractual language that a classifier misreads as attack.
What does a detector actually measure, and what does it hide?
A single accuracy score conceals three separate questions. First, the false-positive rate your workflow can absorb before staff route around the tool. Second, the action that follows a positive flag—does the system block, quarantine, escalate or only log? Third, the record that shows why the flag fired and who decided what to do next.
Published results show strong scores on single benchmarks and sharp losses across datasets. A detector reporting 99.6% accuracy in-domain and 96.9% out-of-domain tells you nothing about the false-positive rates a legal or clinical workflow can absorb. Tighten that budget and the picture changes. Cross-dataset results can be worse than any single benchmark implies. In our assessment, a high score on one dataset is not protection in a different tool, domain or attack style.
Reporting practice matters as much as the number. A detector should report precision, recall, false-positive rate and attack-family coverage separately, on held-out examples that vary wording, placement, encoding and context, with results broken out by the channel an instruction arrived on. Direct user text, retrieved documents, emails, web pages, tool outputs and conversation history are all untrusted under that model. A score without the enforced action and without a trail of which segment was flagged and what the system did next cannot be audited later.
Which concrete controls must you be able to demonstrate?
- Segment external content before it reaches the model's reasoning context — mark retrieved passages with source metadata so the model knows which text came from which channel.
- Run detection at the tool-input stage, not only at ingestion — check what the model is about to do with the content, not only what the text says, so you catch the moment it decides to act.
- Enforce an action when detection fires — block the operation, quarantine the content, escalate to a named person or trigger a deterministic check; a flag that nothing acts on protects no one.
- Restrict model-facing functionality to application code rather than unrestricted API credentials — so a successful injection stays inside a small blast radius instead of inheriting every system the model can reach.
- Record the detection event with source, timestamp, decision and owner — log which segment was flagged, what the detector said, which policy applied, who decided and what changed as a result.
- Test the deployed configuration on data the detector wasn't trained on — re-run the corpus whenever the system prompt, the tool set or the retrieval settings change, and keep results comparable between runs.
What does an auditable record look like when an agent acts on retrieved content?
When a regulator, client or court asks why an action was permitted, the answer has to reconstruct the event. A text classifier might have missed an instruction if it were worded implicitly, threaded across multiple passages, or embedded in an image. In this scenario the action gate carried the protection, and the detector was helpful rather than decisive. The honest limit matters: a weaker detector with an inspectable trail and a named human escalation suits high-impact work better than a stronger detector nobody can interrogate.
Placement changes what there is to record. Moving detection to the model's tool-input stage changes what a record can capture, so the record has to show who checked what, not only what a model scored. The tension is between reconstructing an event and creating a second copy of confidential material. Store references or pseudonymised content where the workflow allows, and keep raw input only for as long as the retention rule requires. Logs also test the system itself: if the same passage is blocked on one run and allowed on another, the record shows where the threshold or the policy drifted.
A worked case shows which layer does the work. A litigation team uploads a witness file and asks an assistant to summarise a public web page about the case. The page carries hidden text instructing the assistant to list every name in the file and send it to an external address. Without layers, the attack is comfortable: the typed request is innocuous, a keyword filter finds nothing, and the model holds both in the same context. With layers, the sequence runs differently. The source tag marks the page as untrusted before it enters context. The detector flags the passage and quarantines it. A reviewer notes that listing names and sending them conflicts with the task. The action check blocks any outbound transfer because the destination sits outside permitted scope. Every decision is written to the record with a timestamp and an owner. The control that mattered was the one that stopped the outbound transfer, not the one that read the words.
Tooling can report what it sees and enforce what you tell it to enforce. It cannot decide which actions matter, which false positives your workflow can absorb, or which records your audit process requires. Those remain your own professional judgement, and they are the only questions that separate a control from a classifier.
Sources: This article draws on reporting and guidance from arXiv, Proceedings of the Fifteenth ACM Conference on Data and Application Security and Privacy, ar5iv and Aclanthology.
Written by
Tobias Lindqvist
Adversarial machine learning and the security properties of retrieval systems.