02Chapter 2: Mapping trust boundaries in an LLM applicationThis chapter assumes you can read basic Python and have called a chat-style LLM API. It also assumes you know the web security idea that user input is untrusted. You will build an inventory of everything that enters a model's context, label each input by how far you trust it, and find the places whe4 min read
03Chapter 3: What prompt injection is and why it worksThis chapter assumes you can write basic Python, have called a chat-style LLM API, and know the web security idea that untrusted input must never be treated as trusted code. It covers the core mechanism of prompt injection. Later chapters cover the direct and indirect variants and the defenses in de5 min read
04Chapter 4: Direct prompt injectionThis chapter assumes you can call a chat-style LLM API from Python and know the idea of untrusted input from web security. It also assumes you have read the earlier chapters on how instructions and data share one context window and on what prompt injection is.4 min read
05Chapter 5: Indirect prompt injection through documents, web pages and emailThis chapter assumes you have read the earlier chapters on how instructions and data share one context window, on trust boundaries, and on direct prompt injection. You should be able to read short Python and call a chat-style LLM API.4 min read
06Chapter 6: Jailbreaking compared with prompt injectionThis chapter assumes you know how instructions and data share one context window, what direct and indirect injection are, and that a chat API separates system and user roles. The two terms are often used as if they meant the same thing. They describe different problems, and the difference decides wh4 min read
07Chapter 7: Tools and agents expand the attack surfaceThis chapter assumes you have called a chat-style LLM API in Python and know the idea of untrusted input from web security. Earlier chapters showed that a model reads instructions and data as one stream of text. Here you will see what changes when that model can act.4 min read
08Chapter 8: Excessive agency and the confused deputyThis chapter assumes you can call an LLM through a chat-style API, that you write basic Python, and that you know why untrusted input is dangerous in web applications. Earlier chapters showed that a model reads instructions and data as one stream of text, and that tools let a model act. Here we look4 min read
09Chapter 9: Data exfiltration through links, images and tool callsThis chapter assumes you know how to call a chat-style LLM API, can read Python, and understand untrusted input and XSS. It covers how an injected instruction can move private data out of an application, and which controls stop that.5 min read
10Chapter 10: Treating model output as untrustedThis chapter assumes you know how a chat-style LLM API returns text, and that you know XSS and SQL injection from web security. The model's reply is a string chosen by a system that read attacker-controlled text. Your code must treat that string like any other untrusted input.4 min read
11Chapter 11: System prompt leakage and why prompts are not secretsThis chapter assumes you can call a chat-style LLM API in Python, know that instructions and data share one context window, and understand direct prompt injection from the earlier chapters. It covers why a system prompt can be extracted, what that exposes, and how to design so that extraction does l4 min read
12Chapter 12: Poisoned retrieval sources and knowledge basesThis chapter assumes you know how a chat-style LLM API works, what a context window is, and the difference between direct and indirect prompt injection. It also assumes basic web security ideas such as untrusted input. Retrieval-augmented generation (RAG) is a pattern where the application searches 5 min read
13Chapter 13: Defense in depth: assume the injection succeedsThis chapter assumes you can read Python and have called a chat-style LLM API. You should also know the web security basics of untrusted input and XSS. It also assumes you have met direct and indirect prompt injection, data exfiltration, excessive agency and insecure output handling in earlier chapt5 min read
14Chapter 14: Input and output filtering and its weaknessesThis chapter assumes you can call a chat-style LLM API from Python and know why untrusted input and XSS matter on the web. It also assumes you know that a model reads instructions and data as one stream of text. Filtering is the most familiar defense, because it resembles input validation. It helps,4 min read
15Chapter 15: Structuring prompts and delimiting untrusted contentThis chapter assumes you can call a chat-style LLM API from Python and know the basic idea of untrusted input from web security. You should also know from earlier chapters that a model reads instructions and data as one stream of text. Prompt structure is one defense layer. It makes injection less l3 min read
16Chapter 16: Least privilege, scoped credentials and isolationThis chapter assumes you can call an LLM through a chat-style API, read Python, and know basic web security ideas such as untrusted input. It also assumes you have read the chapters on excessive agency and defense in depth.5 min read
17Chapter 17: Human approval for high-impact actionsThis chapter assumes you can call a chat-style LLM API and have read the earlier chapters on tools, excessive agency, and least privilege. Least privilege limits what an agent can do. Human approval covers the actions that must stay available but are too risky to run without a person confirming them4 min read
18Chapter 18: Testing and red teaming with injection payloadsThis chapter assumes you can call a chat-style LLM API from Python, and that you know the earlier chapters' attack paths: direct injection, indirect injection, exfiltration, and tool abuse. Here you will learn how to test an application against them. Testing will not prove the application is safe. I5 min read
19Chapter 19: Logging, monitoring and incident responseThis chapter assumes you have read the earlier chapters on trust boundaries, tools and agents, and defense in depth. You should be comfortable reading Python and know what a structured log line is.4 min read
20Chapter 20: Why no defense is complete yetThis chapter assumes you know how an LLM receives a prompt as one stream of text, what direct and indirect prompt injection are, and the defenses covered earlier: filtering, structured prompts, least privilege, human approval and testing. Here you look at where each of them fails, and how to design 5 min read
21Chapter 21: Using the OWASP Top 10 for LLM Applications as a checklistThis chapter assumes you know the earlier material: prompt injection, indirect injection, excessive agency, output handling, and the defenses in this tutorial. It shows how to turn the OWASP Top 10 for LLM Applications into a working review tool, and it explains what a checklist can't do.4 min read