9 lessons

AI & Agent Security

Prompt injection, untrusted tool output, over-privileged tools, poisoned retrieval and memory — and the one rule: the model is never the authorization layer.

Asset→Threat→Attack Surface→Trust Boundary→Vulnerability→Exploit Path→Impact→Mitigation→Defense in Depth→Residual Risk

Every lesson below identifies the asset, attacker capability and boundary before naming the vulnerability. Controls are split into prevention, detection and recovery; residual risk is explicit.

AI and Agent Security
▶ lab

Agents combine untrusted language, retrieved data, memory, models and tools; capability boundaries—not model obedience—control the outcome.

Boundary · Untrusted context → model proposal → privileged tool
Agent Trust Boundaries
▶ lab

User, model, retrieval, memory, tools and external content have different trust and privilege; mark every flow explicitly.

Boundary · User/RAG/memory/tool output → model context → tool request
Direct and Indirect Prompt Injection
▶ lab

A user or retrieved document supplies language that the model may confuse with authority; the robust defense is to constrain capabilities and decisions outside it.

Boundary · Untrusted language → model instruction-following behavior
Agent Tool Capability Security
▶ lab

A tool schema is a capability interface: make it narrow, bind it to a principal, enforce policy outside the model and record the result.

Boundary · Model-generated arguments → deterministic privileged operation
The Model Is Not the Authorization Layer
▶ lab

The agent proposes an action; deterministic code evaluates principal, action, resource and policy. Natural-language confidence is never permission.

Boundary · Probabilistic model output → deterministic authorization decision
Human Approval for High-Risk Agent Actions
▶ lab

Money transfer, deletion, external communication and permission changes should pause at an explicit risk gate with a comprehensible diff.

Boundary · Agent proposal → external side effect
Tool Output Is Untrusted
▶ lab

A website, API or integration can return text that is false or malicious; tool data must not become higher-priority authority simply because a tool fetched it.

Boundary · External tool result → model context
RAG and Agent Memory Security
▶ lab

Retrieval and memory add durable, searchable copies of data where poisoning, tenant-filter mistakes, retention and sensitive recall become security boundaries.

Boundary · Document/memory write → retrieval → another decision or user
Agent Sandboxing
▶ lab

Code execution gets limited files, network, CPU, memory and scoped credentials; the sandbox must constrain the capability, not just the process tree.

Boundary · Agent-generated workload → host and infrastructure