AI Security
Intermediate 12 min read AI Security

LLM Threat Models

Know the enemies

A threat model enumerates who can attack your LLM system and how: injection, data theft, tool abuse, denial of service, jailbreaks. Naming the threats is the first and most valuable security step.

threat modelattack surfaceinjectionjailbreakstrideddos
Prerequisites: Guardrails Overview
Before we start

What you will learn

  • Enumerate LLM-system attack surfaces
  • Map classes of LLM threats
  • Prioritize mitigations by risk
Introduction

What is this?

An LLM threat model identifies the asset (user data, tools, system instructions), the attacker (users, web content, RAG sources, insiders), and the paths: prompt injection, jailbreaks, exfiltration over tools, denial via cost/latency, and training-data leakage. Risk = impact × likelihood guides which mitigations ship first.

Motivation

Why do you need it?

  • You can't defend what you haven't named.
  • Attack surfaces multiply with tools, memory and RAG.
  • Threat modeling is cheap; remediating incidents is not.
  • The model is the least of the attack surface — pipes and tools are worse.
Think about it

Mental model

Imagine

A castle's defense plan

Think of

Threat model

Before building walls, the lord maps who attacks: sieges (jailbreaks), treasons (insiders), tunnels (injection), supply cutoffs (DoS). Each threat gets a wall, a gate, a moat sized to the risk. Building towers first and forgetting the moat is the classic LLM mistake.

Mechanics

How it works

  • Define assets: data, instructions, tool capabilities.
  • Enumerate entry points: user chat, doc uploads, web fetch, RAG.
  • List attacker classes: external, malformed content, insiders.
  • Map threats per surface: injection, exfil, DoS, abuse.
  • Rank by impact × likelihood; assign mitigations.

Threat map.

Assets
Entry
Threats
Rank
Mitigate
Real world

In production

  • Security review gates for any new tool or RAG source.
  • Red-team runbooks test the model's stated threats.
  • Risk registry tracks open mitigations for audit.
Guidelines

Best practices

  • Update the model whenever new tools/sources ship.
  • Treat every model-visible byte as attacker-controlled.
  • Focus on tools and pipes: they amplify damage.
  • Cost-control is part of the model (DoS by budget).
Watch out

Common mistakes

  • Threat models that ignore injected content (docs/pages).
  • Treating the model as 'secure because it's an API'.
  • Writing the model once and never re-gating new features.
Root cause analysis

Common issues

Error
Threat appeared not in the model
Root cause

Model stale

Fix

Tie threat review to the feature-launch gate.

Error
Mitigations untraceable to threats
Root cause

No mapping

Fix

Keep a 1:1 threat→control→test inventory.

When things break

Debugging tips

  • New tool → new threat; add to the model before launch.
  • Incident repeats → model missed the path; backfill.
  • Mitigations untested → red-team the named threats.
Interviews

Interview checkpoint

Practice

Hands-on lab

Mini Threat Model in Three Tables
25 min · intermediate
In progress
Objectives
  • Inventory assets, entry points and boundaries
  • Enumerate threats per entry point
  • Rank threats and assign mitigations

Mini Threat Model in Three Tables

25 min · intermediate

0/3 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

The largest attack surface in an agentic system is…

2

Fetched web content is trusted input.

Go deeper

Official documentation