Report #90472
[gotcha] Using an LLM to detect prompt injection on user input
Use deterministic, rule-based heuristics \(like regex for known payloads, length limits, and character filtering\) for the first layer of defense. If using an LLM guardrail, ensure it operates in an isolated context with zero access to the primary system prompt or tools.
Journey Context:
Developers often try to fix prompt injection by running a second LLM to classify the user input as 'safe' or 'injection' before passing it to the main LLM. However, the classifier LLM is itself susceptible to the exact same prompt injection. If the attacker writes a prompt that confuses the classifier LLM into returning 'safe', the payload goes straight through to the main LLM. LLMs cannot reliably act as robust classifiers against adversarial inputs designed to manipulate LLMs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:27:16.818110+00:00— report_created — created