Lesson 08 Sandboxing and Least Privilege for AI Agents
Theme:
Lesson 08 · Slide 1

Lesson 08 — Sandboxing and Least Privilege for AI Agents

An autonomous agent is a non-deterministic process with a toolbelt. That is not a thing you hand the keys to. This lesson is the five-layer sandbox you put around it before you let it run.

Audience: Devs + Security + Operators AI OpSec Sandboxing

Notes: The goal is not to trust the agent. The goal is to make it safe to run an untrusted agent.
Lesson 08 · Slide 2

What you will learn

Lesson 08 · Slide 3

The agent threat model

An autonomous agent has three components. Any of the three can be turned against you.

Prompt-inject the model, the toolbelt executes the attacker's intent on your state. That is the whole game.

Lesson 08 · Slide 4

"I trust the model" is not a control

A non-deterministic component cannot be a security control.

Models are prompt-injectable, output-unstable, and their behavior changes between versions. Anything that depends on the model "deciding not to do the bad thing" is not a control — it is a hope.

Lesson 08 · Slide 5

Sandbox layer 1: containerization

Containerization alone is not enough. It is the substrate on which the other four layers sit.

Lesson 08 · Slide 6

Sandbox layer 2: network isolation

networks:
  isolated:
    driver: bridge
    internal: true

One line turns off the entire egress attack surface.

Lesson 08 · Slide 7

Sandbox layer 3: filesystem scoping

Lesson 08 · Slide 8

Sandbox layer 4: capability drops

cap_drop:
  - ALL
cap_add:
  - CHOWN
  - SETUID
  - SETGID
  - DAC_OVERRIDE
Lesson 08 · Slide 9

Sandbox layer 5: loopback-only port publishing

ports:
  - "127.0.0.1:6080:6080"
Lesson 08 · Slide 10

Reference architecture: ctf-labs-env/

The lab environment for this course already applies all five layers. The relevant bits of the compose file:

services:
  lab:
    container_name: ctf-lab
    ports:
      - "127.0.0.1:6080:6080"
    networks:
      - isolated
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETUID
      - SETGID
      - DAC_OVERRIDE
    volumes:
      - lab-home:/home/headless/work

networks:
  isolated:
    driver: bridge
    internal: true

Five layers, one file. Use this as a template for agents you build.

Lesson 08 · Slide 11

What the agent can still do inside the sandbox

Least privilege does not mean zero privilege. An agent in this sandbox can still:

What it cannot do:

Lesson 08 · Slide 12

Rules to remember

1 / ?