Lightweight Prompt-Injection Detectors Rely on Surface Cues: An Evaluation under Obfuscation, Indirect Injection, and Hard Negatives
Large language models (LLMs) follow the instruc-tions they read, which makes them vulnerable to prompt in-jection: an attacker writes instructions that override those ofthe developer. A common defense is a lightweight detector thatfilters prompts before they reach the model. Such detectorsare usually evaluated on attacks similar to their training data,which may give an overly optimistic view of their robustness. We evaluate four lightweight detectors (a keyword filter, acharacter n-gram TF-IDF classifier, an embedding-based nearest-neighbor “semantic firewall” and an embedding-based classifier)on the public deepset prompt-injection dataset, under seven testconditions: the original test set, four character-level obfuscations,indirect injection inside benign documents, and hard negatives,i.e., benign prompts that contain words typical of injections. Wefind that all detectors rely on surface cues rather than on theintention of the prompt. The best detector reaches 92.0% F1on the original test set, but leetspeak reduces it to 75.1%, and itflags 63.1% of benign documents in the indirect condition. Threeof the four detectors flag 43–53% of benign hard negatives, andthe semantic firewall detects only 30.0% of injections. We alsoshow that obfuscating only the attacks, a common evaluationshortcut, overestimates robustness: with symmetric obfuscation,the false-positive rate of the embedding classifier rises from 1.8%to 31.0%. These results call for more realistic evaluation oflightweight prompt-injection defense.
Authors
- john glody KUBIKULA-ve (ORCID: https://orcid.org/0009-0009-1335-600X)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-30
- DOI
- https://doi.org/10.5281/zenodo.24693017
- Primary Topic
- Adversarial Robustness in Machine Learning
- Type
- preprint