LLM Security
My notes on attacking and defending LLM applications, following the OWASP Top 10 for LLM Applications 2025. It starts with how an LLM actually works, then the threat model, then each vulnerability class with a local lab you can break and patch.
Everything here is for learning, CTFs, authorized red teaming, and defending your own systems. Payloads are only meant for the local labs or systems you have written permission to test.
Chapter 1: Foundations
Part 00 · Intro to LLM Security
| # | Lesson |
|---|---|
| 0.1 | What AI attacks are and how they differ |
| 0.2 | Legal and ethical ground rules |
| 0.3 | Building a safe lab with Ollama |
| 0.4 | Threat model of an LLM app |
Part 01 · LLM Foundations
| # | Lesson |
|---|---|
| 1.1 | How an LLM works |
| 1.2 | Anatomy of a prompt |
| 1.3 | Embeddings and RAG |
| 1.4 | Tool calling, agents and MCP |
| 1.5 | Why LLMs cannot separate instructions from data |
Part 02 · The Toolkit
| # | Lesson |
|---|---|
| 2.1 | The Ollama lab environment |
| 2.2 | A proxy to observe prompts |
| 2.3 | Automated red teaming |
| 2.4 | Guardrails for defense |
Chapter 2: OWASP Top 10 for LLM
Part 03 · LLM01 Prompt Injection
| # | Lesson |
|---|---|
| 3.1 | Direct prompt injection |
| 3.2 | System prompt leak |
| 3.3 | Indirect prompt injection |
| 3.4 | Lab: prompt leak and indirect injection |
Part 04 · LLM05 Improper Output Handling
| # | Lesson |
|---|---|
| 4.1 | Improper output handling |
Part 05 · LLM06 Excessive Agency
| # | Lesson |
|---|---|
| 5.1 | Excessive agency |
Part 06 · LLM04 & LLM08 RAG
Part 07 · LLM03 Supply Chain
| # | Lesson |
|---|---|
| 7.1 | Supply chain |
Part 08 · LLM10 Unbounded Consumption
| # | Lesson |
|---|---|
| 8.1 | Unbounded consumption |
Part 09 · LLM09 Misinformation
| # | Lesson |
|---|---|
| 9.1 | Misinformation |
Chapter 3: New techniques and practice
Part 10 · New Techniques
| # | Lesson |
|---|---|
| 10.1 | A map of jailbreaks |
| 10.2 | Many-shot jailbreak |
| 10.3 | Encoding and token manipulation |
| 10.4 | Multimodal attacks |
| 10.5 | Agent and MCP attacks |
Part 11 · Hands-on
| # | Lesson |
|---|---|
| 11.1 | CTF practice and resources |