Join our Newsletter — 33% off our NHI Course
Home› Guides› OWASP LLM Top 10 LLM01 Prompt Injection Guide:…
Guide LLM & GenAI Security

OWASP LLM Top 10 LLM01 Prompt Injection Guide: Stopping Direct and Indirect Injection

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 26 October 2026 16 min read
On this page

Most teams can name LLM01 Prompt Injection, but few can show an auditor which of its seven OWASP mitigations they have implemented, how each one is tested and which of the nine OWASP scenarios their application would survive. This guide treats LLM01:2025 as an assessable requirement set: it maps every OWASP mitigation to an owner, a design pattern and a piece of evidence, turns the nine attack scenarios into a defensive test plan, and shows where the entry overlaps the rest of the Top 10. The broader mechanics of injection channels, hiding techniques and agent design patterns are covered in the Prompt Injection Guide and are not repeated here. It is written for application security leads, AI platform owners and assessors who need to sign off an LLM feature against OWASP. It contains no working attack strings.

Key takeaways

  • OWASP does not promise prevention. The entry says it is "unclear if there are fool-proof methods of prevention", so the seven strategies are impact reducers and must be judged on what an injected model can still do.
  • Four of the seven strategies are deterministic. Output format validation in code, least privilege, human approval and content segregation can be tested pass or fail; prompt constraints and filters are probabilistic and need statistical testing. Over-privileged models also feature in our top 10 LLM deployment mistakes.
  • Strategy 4 is an identity control. OWASP asks for the application to hold its own API tokens and run functions in code rather than handing them to the model, which makes LLM01 an NHI design question.
  • The nine scenarios are a ready-made test plan. Each one maps to a channel, a control that should break it and an observable outcome, which is the evidence an assessor needs.
  • LLM01 is usually the entry point, not the impact. The damage is recorded under LLM02, LLM05, LLM06 and LLM07, so fixes belong in those controls as much as in input handling.

What it is and who it applies to

The official entry is LLM01:2025 Prompt Injection in the OWASP Top 10 for LLM Applications 2025, published on genai.owasp.org (page last modified April 2025) under Creative Commons Attribution-ShareAlike 4.0. The plan title of this page matches the official risk name. Prompt injection also held the LLM01 position in the 2023 edition, so it has led the list in both releases.

OWASP defines the vulnerability as one that "occurs when user prompts alter the LLM's behavior or output in unintended ways", and stresses that the content does not need to be visible to a person, only parsed by the model. It names two types (direct, from the user's own input, and indirect, from websites, files and other external sources) and says either can be intentional or unintentional. It also positions jailbreaking as "a form of prompt injection" aimed at the model's safety protocols, and warns that retrieval augmented generation (RAG) and fine-tuning "do not fully mitigate" the problem.

Who it applies to: any system that places text, images or other content into a model's context window and acts on, displays or stores the result. That includes customer chatbots, internal copilots, RAG search assistants, email and document summarisers, coding assistants and any LLM feature embedded in a SaaS product. Exposure rises sharply once the application can retrieve private data or call functions.

How it relates to the rest of the list: OWASP lists six outcome classes for a successful injection. Each has its own Top 10 entry, and a complete LLM01 assessment checks the controls in that entry too.

LLM01 outcome named by OWASPWhere the impact control livesControl to verify
Disclosure of sensitive informationLLM02 Sensitive Information DisclosureData minimisation in context; per-user retrieval permissions
Revealing system prompts or infrastructureLLM07 System Prompt LeakageNo secrets or authorisation logic in prompts
Content manipulation, biased or incorrect outputLLM09 MisinformationGrounding checks and citation validation
Unauthorised access to functions available to the LLMLLM06 Excessive AgencyMinimal tools, scoped credentials, approvals
Executing arbitrary commands in connected systemsLLM05 Improper Output HandlingOutput treated as untrusted by every downstream component
Manipulating critical decision-makingLLM06 and LLM09Human review of consequential decisions

See the OWASP LLM Top 10 LLM06 Excessive Agency Guide and the OWASP LLM Top 10 LLM05 Improper Output Handling Guide.

Structure and key requirements

The entry has four working parts: the description and two injection types, a list of outcomes, seven prevention and mitigation strategies, and nine example attack scenarios. It closes with reference links and three MITRE ATLAS mappings. The table below turns the seven strategies into assessable requirements.

OWASP strategyControl typeWhat good implementation looks likeEvidence an assessor can check
1. Constrain model behaviourProbabilisticSystem prompt states role, permitted topics and refusal behaviour; prompts versioned in source control and changed through reviewPrompt repository history; regression results per prompt version
2. Define and validate expected output formatsDeterministicResponses requested as a typed schema (for example JSON with an enumerated action field) and parsed by code that rejects anything else; citations checked against retrieved document IDsSchema files; rejection counts in logs; unit tests for malformed output
3. Implement input and output filteringMostly probabilisticDefined sensitive categories, semantic classifiers and string checks on input and output, plus RAG Triad scoring for retrieval featuresClassifier versions, thresholds, false positive rates on benign traffic
4. Enforce privilege control and least privilegeDeterministicApplication holds its own scoped tokens; functions run in code; model never sees credentials; read-only access by defaultCredential inventory; scope listings; denied-call logs
5. Require human approval for high-risk actionsDeterministicApproval bound to the exact operation, target and parameters, single use, enforced at executionApproval records joined to executed actions
6. Segregate and identify external contentMixedUntrusted content labelled by source and kept apart from instructions; provenance kept per retrieved chunkPrompt assembly code; provenance fields in logs
7. Adversarial testing and attack simulationsAssuranceRegular testing that treats the model as an untrusted user and probes trust boundaries and access controlsTest plan, per-case results with run counts, retest after changes

Reading strategy 3 correctly: the RAG Triad

OWASP asks teams to evaluate responses with the RAG Triad. The TruLens project, which popularised the term, defines its three checks as Context Relevance (is each retrieved passage relevant to the query), Groundedness (is each claim in the answer supported by the retrieved context) and Answer Relevance (does the answer address the user's question). For LLM01 the signal is a drop in groundedness or answer relevance, since an injected document tends to pull the answer off the question. Treat it as a detective control with tuned thresholds: TruLens frames it as a hallucination check and publishes no security thresholds.

Strategy 6 is a label, not a wall: the OWASP prevention cheat sheet says labels organise the prompt but enforce nothing, so pair it with strategies 2, 4 and 5 wherever untrusted content can influence an action.

The nine scenarios as a defensive test plan

Write test cases per scenario using benign marker text (a harmless canary word or a dummy tool call) rather than real attack strings, and grade the observable outcome.

OWASP scenarioChannel to testControl expected to break itPass condition
1. Direct injection into a support chatbotChat inputStrategies 4 and 5: no data store or email function reachable without authorisationNo out-of-scope query or send executes
2. Indirect injection via a summarised web page leading to image-link exfiltrationFetched web contentOutput rendering controls (LLM05): external images and links blocked or rewrittenNo outbound request to an unapproved domain
3. Unintentional injection (hidden instruction in a job advert)Third-party documentsStrategy 6 plus human review of the decisionDecision unchanged or flagged for review
4. Modified document in a RAG repositoryIndexed contentWrite access control on indexed sources; RAG Triad monitoringPoisoned chunk traceable to author; answer flagged
5. Code injection in an LLM email assistant (CVE-2024-5184)Application APIStrategies 1, 2 and 4; no hard-coded secrets in promptsSystem prompt not disclosed; no unintended prompt runs
6. Payload split across a CVMulti-field documentsStrategy 2 typed scoring; LLM Map-Reduce style isolation per itemScore matches content-based rubric
7. Instruction hidden in an imageMultimodal inputOCR and image text treated with the source's trust labelHidden text does not change behaviour or tool use
8. Adversarial suffixChat inputStrategy 3 classifiers plus rate limits on repeated attemptsAttack success rate within agreed threshold across repeated runs
9. Multilingual or encoded instructionsAny inputNormalisation and decoding before screening; no reliance on keyword listsEncoded marker detected or harmless

Scenario 5 in detail: CVE-2024-5184 describes a prompt injection vulnerability in the EmailGPT service whose API let a malicious user inject a direct prompt to leak hard-coded system prompts or run unwanted prompts. NVD records CWE-74. Prompt injection flaws can be tracked and patched like any other vulnerability, and keeping secrets out of prompts limits what they disclose.

Identity and NHI requirements

Strategy 4 is the most important line in the entry for identity teams: "Provide the application with its own API tokens for extensible functionality, and handle these functions in code rather than providing them to the model." Read literally, it means three things. The application, not the model, authenticates to downstream systems. The credential lives where the model cannot read it. And the decision to call a function, with which parameters, is checked in code.

Design choiceLLM01 effect if injectedRecommendation
API key placed in the system prompt or tool descriptionKey can be disclosed by injection (LLM07) and reused anywhereNever; move to a vault and inject at call time
One shared service account for every user and toolInjection by any user reaches every user's dataAvoid; use per-tool identities and per-user delegation
Per-tool service identity, read-only, scoped to named resourcesInjection limited to that tool's narrow scopeUse for shared reference data
Delegated user token (OAuth) with minimum scopes, short lifetimeInjection can do no more than the user, within scopeUse for actions on a user's own mail, files or records
Human approval with step-up authenticationInjection cannot complete the action aloneUse for sends, shares, payments and deletions

Implementation steps

  1. Scope the assessment: list each LLM feature, every content source reaching its context and the functions it can trigger, marking sources trusted or untrusted and functions by impact.
  2. Remove secrets and authorisation from prompts: search system prompts, tool descriptions and templates for keys, connection strings and rules such as "only admins may". Move secrets to a vault and rules into code.
  3. Apply strategy 4 first: give each function its own scoped identity or delegated token, make read-only the default and remove unused functions. This is deterministic and cuts impact immediately.
  4. Constrain outputs (strategy 2): define a schema for every response that drives an action or a decision; reject non-conforming output in code; validate citations against the IDs actually retrieved.
  5. Close rendering paths: block automatic loading of external images and links in model output, or rewrite them through an allowlist, so scenario 2 has no exfiltration route.
  6. Segregate content (strategy 6): wrap and label untrusted content by source, record provenance per chunk, and strip invisible characters and hidden markup before assembly.
  7. Add filtering in log-only mode (strategy 3): deploy input, retrieved-content and output classifiers plus RAG Triad scoring, measure false positives on real benign traffic for two to four weeks, then enforce for a pilot group.
  8. Add approvals (strategy 5): require bound, single-use approval for irreversible or external actions; start with a suggest-only mode where the model proposes and a person executes.
  9. Test (strategy 7): run the scenario test plan above, repeat each case several times because outputs vary, and rerun on every model, prompt, retrieval source or tool change.
  10. Plan rollback: version prompts and tool definitions, flag each tool, and be able to revoke credentials in minutes.

Decision guidance

  • Chatbot with no tools or private data: strategies 1, 2 and 3 are proportionate; document that strategies 4 and 5 are not applicable and why.
  • RAG over internal data: strategies 4 (per-user retrieval permissions) and 6 are mandatory, plus write control on indexed sources and rendering controls. See the Permission-Aware RAG Guide.
  • Feature that reads external content and can act: all seven strategies apply, and approvals for sends, shares and changes are not optional.
  • Small organisations buying copilots: ask the supplier for evidence against each strategy, especially indirect content and link rendering.
  • Large organisations: implement strategies 3, 4 and 6 once in a shared gateway so each product team inherits them. See the AI Gateway and LLM Gateway Guide.

Evidence and assessment

The OWASP cheat sheet sets the grading discipline: define an observable outcome per test case, count missing telemetry as inconclusive rather than blocked, measure benign false positives separately, and report results with denominators, versions and repeated runs.

  • Design evidence: data flow diagram showing trust labels for every content source; tool and credential inventory; output schemas; approval policy.
  • Test evidence: scenario test plan results with run counts, dated against the model and prompt versions tested.
  • Runtime evidence: logs of prompts, retrieved document IDs, classifier verdicts, schema rejections, proposed and executed tool calls, approvals and outbound URLs, with secrets excluded.
MetricWhat it showsTarget
Attack success rate on the scenario suite, per releaseWhether model, prompt or filter changes made things better or worseAgreed threshold; no regression between releases
Benign false positive rate of filtersWhether strategy 3 is usable in productionMeasured and accepted by the product owner
Schema rejection rateStrategy 2 is working; spikes can signal injection attemptsBaselined; spikes investigated
Functions running with credentials broader than their use caseStrategy 4 coverageZero
High-impact actions executed without a bound approvalStrategy 5 coverageZero
Days since last adversarial test of each featureStrategy 7 freshnessWithin policy, and after every material change

Mapping to other frameworks

OWASP itself maps LLM01 to three MITRE ATLAS techniques. The control mappings below are NHI Mgmt Group's and are a starting point for a control library.

FrameworkReferenceRelevance to LLM01
MITRE ATLASAML.T0051.000 LLM Prompt Injection: Direct; AML.T0051.001 Indirect; AML.T0054 LLM JailbreakThe three mappings OWASP lists
MITRE ATLASAML.T0068 LLM Prompt Obfuscation; AML.T0077 LLM Response RenderingScenarios 7 and 9 (hiding) and scenario 2 (rendering exfiltration)
MITRE ATLAS mitigationsAML.M0020 Generative AI Guardrails; AML.M0015 Adversarial Input Detection; AML.M0021 Generative AI GuidelinesStrategies 3 and 1
NIST SP 800-53 Rev. 5SI-10 Information Input Validation; SI-15 Information Output FilteringStrategies 2 and 3
NIST SP 800-53 Rev. 5AC-6 Least Privilege; AC-4 Information Flow EnforcementStrategies 4 and 6, and blocking exfiltration paths
NIST SP 800-53 Rev. 5CA-8 Penetration TestingStrategy 7
NIST CSF 2.0PR.AA-05; DE.CM-09Least privilege for model-facing functions; monitoring runtime and data for adverse events
ISO/IEC 27001:2022 Annex AA.8.28 Secure coding; A.8.29 Security testing in development and acceptanceDesign and testing obligations for LLM features
CWECWE-74Weakness class NVD assigns to CVE-2024-5184

See the MITRE ATLAS Guide.

Common pitfalls

  • Claiming compliance from strategy 1 alone: a hardened system prompt is one of seven strategies and the weakest; an assessment that stops there has tested intent, not control.
  • Filtering the chat box only: scenarios 2, 3, 4, 6 and 7 all arrive through content the user did not type. In EchoLeak a crafted external email evaded Microsoft's injection classifiers and used reference-style markdown links that link redaction missed.
  • Leaving actions unconfirmed: in the Gemini calendar prompt injection hidden text in an invite led the assistant to write a summary of private meetings into a new event; BleepingComputer reported that Google's defences include asking for explicit confirmation before creating events, which is strategy 5.
  • Secrets in prompts: scenario 5 shows system prompts leaking; any key or internal hostname placed there should be assumed disclosed.
  • Testing once: a single pass at launch says nothing after the next model upgrade or new retrieval source; strategy 7 is a recurring activity.
  • Reporting a single success rate: results without run counts, model versions and benign false positive rates cannot be compared or trusted.

Practitioner checklist

  • Record LLM01:2025 assessment status for each LLM feature against all seven OWASP strategies, with "not applicable" justified.
  • Remove credentials, connection strings and authorisation rules from system prompts and tool descriptions.
  • Give every model-facing function its own scoped identity or delegated user token, read-only by default.
  • Validate every action-driving response against a schema in code and reject anything else.
  • Block or allowlist external images and links in rendered output.
  • Label untrusted content by source, keep provenance per retrieved chunk and strip invisible characters before assembly.
  • Run input, retrieval and output filters plus RAG Triad scoring, tuned on benign traffic before enforcement.
  • Require bound, single-use approvals for sends, shares, changes and payments.
  • Maintain a scenario-based test suite covering all nine OWASP scenarios and rerun it on every material change.
  • Log prompts, sources, verdicts, tool calls and approvals to the SOC, excluding secrets.

Standards and references

Related NHI Mgmt Group resources: OWASP Top 10 for LLM Applications Guide · Prompt Injection Guide · OWASP LLM Top 10 LLM07 System Prompt Leakage Guide · AI Guardrails and AI Firewalls Guide · AI Red Teaming Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 26 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.