Suryanand/ Bootcamp
suryanand.com ↗Let's talk
← Safety and governanceAI guideBeginner#security#owasp#threat-modeling#llm
Frame · ai-engineering / safety-governance / 01-owasp-top-10-for-llm-apps.mdGuide 082 / 103

OWASP Top 10 for LLM applications

If you are shipping an LLM feature and need one checklist to start your threat model, the OWASP Top 10 for LLM Applications is it. It is maintained by the OWASP GenAI Security Project, written by practitioners, and maps neatly onto the controls you can actually build. This doc walks through the 2025 list, explains how the newer Top 10 for Agentic Applications fits alongside it, and turns both into an engineering plan.

Why it matters

Security reviewers, auditors and enterprise customers increasingly ask "how do you address the OWASP LLM Top 10?" in questionnaires. Having a clear answer, per risk, with a named control and an owner, shortens sales cycles and catches real bugs. More importantly, the list encodes lessons from production incidents: almost every item corresponds to something that has already happened to someone.

How it works

The 2025 edition reflected the shift toward RAG and tool-calling apps. Prompt injection kept the top spot, and two new entries appeared: System Prompt Leakage and Vector and Embedding Weaknesses.

IDRiskOne-line control
LLM01:2025Prompt InjectionTreat all model input as untrusted; constrain what the model can do after reading it
LLM02:2025Sensitive Information DisclosureMinimise data in context, redact, enforce access control before retrieval
LLM03:2025Supply ChainPin and verify models, datasets and plugins
LLM04:2025Data and Model PoisoningProvenance and validation for training and RAG data
LLM05:2025Improper Output HandlingEncode, validate and sandbox model output before it reaches other systems
LLM06:2025Excessive AgencyLeast-privilege tools, human approval for high-impact actions
LLM07:2025System Prompt LeakageNever put secrets or authorisation logic in prompts
LLM08:2025Vector and Embedding WeaknessesTenant isolation and permission filters in the vector store
LLM09:2025MisinformationGrounding, citations, uncertainty and human review
LLM10:2025Unbounded ConsumptionRate limits, token budgets, timeouts, cost alerts

In December 2025 the same project published the OWASP Top 10 for Agentic Applications for 2026, with identifiers ASI01 to ASI10. It focuses on failure classes specific to autonomous agents: goal and plan manipulation, tool misuse, identity and privilege abuse, agent supply chain, unexpected code execution, memory poisoning, insecure inter-agent communication, cascading failures, human-agent trust exploitation and rogue agents. If your system calls tools or runs multi-step plans, apply both lists.

The way I use these lists is to map each risk to where it lives in the request path:

Rendering diagram…

Reference architecture

A baseline secure architecture for an LLM feature puts deterministic controls around the model, because the model itself cannot be trusted to enforce policy.

Rendering diagram…

The key design rule: authorisation decisions are made in code using the user's identity, never by the model and never by instructions in the prompt. The model can request an action; the policy engine decides.

Code

Improper Output Handling (LLM05) is the risk teams most often forget, because it looks like ordinary web security. Model output is untrusted input to whatever consumes it. This TypeScript helper validates structured output with Zod and renders markdown safely instead of injecting raw HTML.

import { z } from "zod";
import { marked } from "marked";
import DOMPurify from "isomorphic-dompurify";

const TicketAction = z.object({
  action: z.enum(["reply", "escalate", "close"]),
  ticketId: z.string().regex(/^T-\d{6}$/),
  message: z.string().max(4000),
});

export function parseModelAction(raw: string) {
  // never eval, never pass to a shell, never trust ids without re-checking access
  const parsed = TicketAction.safeParse(JSON.parse(raw));
  if (!parsed.success) throw new Error("Model output failed schema validation");
  return parsed.data;
}

export function renderModelMarkdown(md: string): string {
  const html = marked.parse(md, { async: false }) as string;
  // strip scripts, event handlers and javascript: links that an injected prompt could produce
  return DOMPurify.sanitize(html, { FORBID_TAGS: ["img", "iframe", "form"] });
}

Blocking images matters more than it looks: a markdown image pointing at an attacker's URL with data in the query string is a classic exfiltration channel after prompt injection.

Trade-offs and pitfalls

  • Treating the list as a compliance tick-box. The value is in the threat model, not in having a row per item in a spreadsheet.
  • Relying on the system prompt for security. Assume it will leak (LLM07). Put secrets in the backend and enforce permissions in code.
  • Shared vector indexes. Multi-tenant RAG without per-tenant filtering (LLM08) leaks data between customers through retrieval.
  • Ignoring cost as a security issue. Unbounded consumption is how a scraper or a looping agent turns into a five-figure bill.
  • Agent risks are different. Memory poisoning and tool misuse do not show up in a chat-only threat model. Use the agentic list for agent features.
  • No owner per risk. Each item needs a named owner and a test, or it decays.

Checklist

  • Map each of LLM01 to LLM10 to a specific control and owner in your system.
  • Apply the Agentic Top 10 (ASI01 to ASI10) for any feature that calls tools.
  • Enforce authorisation in code with the end user's identity.
  • Validate and encode all model output before it reaches browsers, databases or shells.
  • Isolate tenants in retrieval and vector storage.
  • Set token budgets, rate limits and cost alerts.
  • Re-review when you add a tool, a data source or a new model.

Further reading

Why this exists README

I learn best by explaining things, so I record the explanations. Everything here is free, with no sign-up. If a lesson helps you ship something, I'd love to hear about it.