This book is licensed for the personal use of the buyer. Please do not share or resell the file. Short quotations with attribution are welcome.
The information in this book is provided for education. It is not legal, financial or other professional advice. Product and company names are used only to describe them and belong to their owners.
This is a free sample: the introduction and first chapter.
IntroductionIntroduction
AI systems add new attack surfaces to familiar software. Attackers no longer need to find a buffer overflow or a weak password if they can poison the data a model learns from, craft an input that fools it, extract its training data or slip instructions into a document that an AI assistant will read and obey. When AI systems can call tools, send messages or move money, these attacks have real consequences.
This book explains the threats and the defences that work. It covers threat modelling for AI, prompt injection and jailbreaks, data poisoning and backdoors, adversarial examples, model and data extraction, privacy attacks, supply-chain risks, and the special risks of agents with tools. Defensive chapters cover secure architecture, least privilege, input and output controls, monitoring, red teaming and incident response.
The focus is defensive and practical: understanding attacks so that you can design systems that resist them. No offensive exploitation recipes are included.
How the book is organised
Chapters 1 to 8: why AI security is different, threat modelling and the attack surface.
Chapters 9 to 20: attacks on language-model applications: prompt injection, jailbreaks, data leakage and agent risks.
Chapters 21 to 32: attacks on models and data: poisoning, backdoors, evasion, extraction and privacy.
Chapters 33 to 41: supply chain and infrastructure.
Chapters 42 to 55: defences in depth, monitoring, red teaming, incident response, governance and AI on both sides of security.
Chapters 56 to 62: a worked threat model, secure prompts, agent sandboxes, training security, multimodal inputs, logs and posture metrics.
Chapters 63 to 66: case studies and a checklist.
Chapter 1Why AI Security Is Different
Traditional security separates code (trusted instructions) from data (untrusted input). Language models blur this line: they take instructions written in natural language, and any text they read, whether a web page, an email or a document, can contain instructions. Models are also probabilistic, so defences that rely on the model "refusing" are never absolute.
Other differences:
Data is part of the attack surface: training data shapes behaviour.
Models are valuable assets that can be stolen or copied.
Outputs can leak information about training data.
Behaviour can change with model updates outside your control.
You have reached the end of the free sample. The full book continues with 65 more chapters, plus the appendices.