Subject 01 / Course

AI security engineering

How AI systems are attacked and how they are defended, from the first threat model to a running agent.

5 modules22 lessons≈ 6 h reading
Start with lesson 1.a

Securing an AI application is ordinary security engineering plus one new fact: a language model cannot reliably tell the instructions it should follow from the text it was merely asked to read. No patch fixes that. Everything distinctive in this course follows from it, especially the working assumption that the model will sometimes be manipulated and that the system around it must make that survivable.

The course starts at “why is this different from web security?” and ends with a complete security design for a multi-tenant agent platform. It assumes you can read Python and know what an HTTP API and an access token are. It does not assume a security background.

The stages#

Security work attaches to the stages of an application’s life, and the course is organized the same way: attacks first, then the controls for each stage.

Where security work attaches
flowchart LR
  D["<b>Design</b><br/><small>threat model</small>"] --> DA["<b>Data</b><br/><small>provenance, privacy</small>"]
  DA --> MO["<b>Model</b><br/><small>supply chain, signing</small>"]
  MO --> B["<b>Build</b><br/><small>red team, eval gates</small>"]
  B --> DE["<b>Deploy</b><br/><small>isolation, secrets</small>"]
  DE --> R["<b>Runtime</b><br/><small>guardrails, policy</small>"]
  R --> A["<b>Agents</b><br/><small>identity, sandboxes</small>"]
  A --> O["<b>Operate</b><br/><small>detect, respond</small>"]
  O -.->|"incidents become tests"| D
  class D neutral
  class DA,MO memory
  class B queue
  class DE compute
  class R,A warn
  class O io
classDef neutral fill:#faf9f5,stroke:#5f5e55,color:#141413,stroke-width:1.5px
classDef compute fill:#e1e9f7,stroke:#2443b5,color:#141413,stroke-width:1.5px
classDef memory fill:#e1e9f7,stroke:#2443b5,color:#141413,stroke-width:1.5px
classDef queue fill:#e1e9f7,stroke:#2443b5,color:#141413,stroke-width:1.5px
classDef io fill:#e1e9f7,stroke:#2443b5,color:#141413,stroke-width:1.5px
classDef default fill:#e1e9f7,stroke:#2443b5,color:#141413,stroke-width:1.5px
classDef warn fill:#f9e2e9,stroke:#b3154f,color:#141413,stroke-width:2px,stroke-dasharray:5 3
classDef good fill:#e2efd8,stroke:#2b6a24,color:#141413,stroke-width:2px

How each lesson works#

Every lesson has the same shape, so you always know where to look:

  1. The idea in one minute. The claim, before the detail.
  2. A picture of the attack or the defense.
  3. How it really works. The mechanism, precisely, with the tools named.
  4. Code, where a mechanism is worth running: a small Python program using only the standard library. Attacks run against simulated models inside the program; nothing targets a real system.
  5. Where it breaks. The limits of the control and what it does not prove.
  6. Remember this, Try it, and Check yourself, with answers you can reveal after you have tried.

Attacks come before defenses, because a defense makes sense only once you can see what it stops, and what it does not.

What you need#

  • Python 3.10 or newer and a terminal. Every program runs offline.
  • No GPU, no API key, no lab environment.

Names, versions, and dates#

Framework editions, incident references, specification versions, and legal dates change. Lessons that depend on them list their sources and the date they were checked. The principles underneath (untrusted input, least privilege, isolation, defense in depth) are far older than any model and will outlast the current ones.

The modules

1

The threat landscape

Before controls, a map: what makes AI systems a distinct security problem, how to threat-model one, and which public frameworks to map your work to.

  1. 1.aWhy AI security is different11 min
  2. 1.bThreat modeling an AI system16 min
  3. 1.cFrameworks and maps14 min
2

How attacks work

The four families of attack on AI systems at the level of mechanism: injection, exfiltration, poisoning and supply chain, and abuse of the model as a resource.

  1. 2.aPrompt injection16 min
  2. 2.bData exfiltration and leakage14 min
  3. 2.cPoisoning and supply chain15 min
  4. 2.dAbuse and resource attacks14 min
3

Securing each stage

An AI application passes through seven stages, from design to operation. Each has controls that are cheap there and expensive anywhere else.

  1. 3.aThe lifecycle map15 min
  2. 3.bData and training14 min
  3. 3.cModels and supply chain15 min
  4. 3.dBuild and test16 min
  5. 3.eDeployment and infrastructure18 min
  6. 3.fRuntime guardrails15 min
  7. 3.gMonitoring and response15 min
4

Securing agents

An agent turns a fooled model into actions. This module covers the threats agents add, the identity they act under, designs that hold when the model is fooled, containment for the code they run, and the security of the tools they are given.

  1. 4.aAgent threats16 min
  2. 4.bIdentity and authorization19 min
  3. 4.cArchitectural defenses18 min
  4. 4.dSandboxing and egress17 min
  5. 4.eMCP and tool security17 min
5

Governance and practice

What regulators and standards ask of an engineering team, how to attack your own systems on purpose, and a complete security design for a multi-tenant agent platform.

  1. 5.aCompliance and regulation21 min
  2. 5.bThe red-team program20 min
  3. 5.cSecuring an agent platform25 min
← Back to the library