OWASP LLM01

LLM Prompt Injection Classifier: Detection, Tests & Latency

OWASP LLM Top 10 · 2025 edition · Updated 25 November 2026 · Independent educational guide

New to LLMs, classifiers or RAG? Read the beginner FAQ and terminology.

Building an action-taking agent? Read the full agent runtime security guide for execution-time boundaries, safe tests and OWASP mapping.

Read the dated field-test post.

What is prompt injection in LLM applications?

Prompt injection happens when text supplied by a user, a web page, a document or a tool result changes how a language model behaves, overriding its instructions. No single filter stops it. Effective defence layers input screening, privilege separation, output checks and human approval for high-impact actions.

What is an LLM prompt injection classifier?

An LLM prompt injection classifier is a detection model that scores text for attempts to override application instructions. Apply it to user input and untrusted retrieved or tool content. A threshold decides what to flag or block. It can miss attacks, so enforce permissions and tool restrictions independently of its verdict.

How should I test prompt injection detection?

Create labelled examples of normal requests, direct injections and indirect injections embedded in documents or tool results. Measure missed attacks and false positives separately, then test the chosen threshold under realistic load. Verify that flagged requests cannot trigger privileged actions, and retain held-out examples for regression checks after model updates.

What is the difference between direct and indirect prompt injection?

Direct injection is typed by the user, such as "ignore previous instructions". Indirect injection hides instructions inside content the model reads later: a web page, email, PDF, retrieved document or tool output. Indirect attacks are harder to spot because the person using the app may never see the malicious text.

How much latency does a prompt injection classifier add?

There is no universal latency figure for a prompt injection classifier. Measure your chosen model with representative input lengths, deployment hardware, network distance and load. Record both typical and tail latency. Our calculator uses illustrative fixed gate delays for planning, not measured performance or a benchmark of any detector.

How do I audit my app for OWASP LLM01?

List every source of text that reaches the model, including retrieved and tool content. Confirm untrusted input is screened, clearly separated from system instructions, and cannot trigger privileged actions without checks. Then run known injection test prompts and record whether each one is blocked, flagged or succeeds.

What does this OWASP LLM risk look like in practice?

Illustrative scenario: A support assistant reads a help document containing an instruction to send private records to an external address.

How can I test it safely?

In staging, add a fictional malicious instruction to a retrieved document. Ask a normal support question, then check that the model cannot access or transmit records outside the user's permissions—even if the classifier misses the text.

What evidence should I keep?

Record detector verdicts, legitimate-request false alarms, missed attacks, tool authorisation results and measured p50/p95 latency at a stated threshold.

LLM01 audit checklist

Control to consider: Input injection classifier. Some controls run outside the request path; model inline checks, then measure your own deployment.

General guidance only, written with AI assistance and human oversight. Verify against your own system and the official OWASP project before relying on it.

Sources and scope

Examples and checklists are our explanatory guidance, not an official OWASP audit, endorsement or a test of your application. Calculator values are modelled assumptions, not detector benchmarks.

Other OWASP LLM risks