AssayAssay
01 / 09

Lesson 01 · The attack surface · 13 min

The agent attack surface

Scope

This is a defensive-security course. The attacks here run only against the course's sandboxed practice agent, to teach the controls that stop them. Do not run these techniques against systems you are not authorised to test.

A chatbot that says something wrong is embarrassing. An agent that does something wrong has tools, so it can leak data, spend money, delete records, or email a stranger — the failure has hands. Security for agents is the study of that difference, and it starts with one idea that explains most of the attacks in this course.

The idea is a trust boundary. There is exactly one source of instructions the operator controls end to end: the system prompt. Everything else the model reads — the user's message, a document it retrieves, the output of a tool, another tenant's data — arrives from outside that boundary. It can be read, but it must never be obeyed.

The trust boundary an agent actually hasInside — trustedSystem promptthe policy you authoredThe agentmodel + toolsSecrets proxyholds credentials, agent never sees themOutside — untrusted (data only)User messageRetrieved documentsTool outputsAnother tenant's dataread as data
Only the system prompt is inside the boundary. Everything else the model reads — the user, retrieved documents, tool outputs, another tenant's data — arrives from outside and is data, never instructions. Most injection is the failure to hold this line.

Almost every attack in the next eight lessons is the same move: get instructions to cross that boundary while dressed as data. Prompt injection is untrusted text the model treats as a command. Exfiltration is a secret that was inside the boundary escaping through a channel. Tenant leakage is one customer's data reachable from another's session. Name the boundary and the attacks stop looking like a grab-bag and start looking like one failure with variations.

The risks themselves are not exotic. Agents are software on top of language models, so they inherit ordinary vulnerabilities — injection, broken access control, secret mishandling — and the LLM-specific ones. What changes is the blast radius: the same class of bug that leaked a string from a web form now leaks it through an agent that also had a database credential and an email tool.

The mental model to keep: assume the agent will be compromised, and design so that when it is, it cannot reach much. Every structural control in this course — least privilege, egress allowlists, tenant scoping, keeping secrets out of context — is a bet on that assumption rather than on the model never being fooled.

In the lab, you classify what reaches the agent before a model does: which inputs are trusted instructions, which are untrusted data, and which are secrets that should never be in the context at all. Getting these three categories right is most of the discipline; the rest is enforcing them.

Checkpoint

For an agent you know, list everything that reaches the model's context. How many of those sources can an outsider influence?

The rubric — you and the model both apply this

Classify each thing that reaches the agent. 'Trusted instruction' is content the operator authored and controls — the system prompt's own policy. 'Untrusted data' is anything whose text came from outside that trust boundary: the user, a retrieved document, a tool's output, another party's message; the model may read it but must never obey instructions inside it. 'Secret' is a credential or another tenant's private data that should be structurally kept out of the context, because anything in the context can be leaked.

Classify all six inputs, then compare with the model. The line between 'untrusted data' and 'secret' is the one worth arguing about — a tool output is data; a credential is a secret even though both are just strings.

How should the agent treat this input? Decide for all 6 before running — going first is the point.

The customer's support message

The free-text ticket the customer typed.

from outsideattacker-controlledthe primary injection surface

A retrieved help-centre article

Text returned by search_docs, some of it community-edited.

editable by outsiderslooks authoritativeindirect-injection surface

A tool's returned data

The record an order- or account-lookup tool returns.

can be tampered upstreamthe model tends to trust it

The system prompt's policy

The operator-authored instructions defining the agent's role and limits.

you wrote itinside the trust boundary

An internal admin credential

A privileged key the agent might need to call an internal system.

high valueirreversible if leakedanything in context can be exfiltrated

Another tenant's account data

Globex's records, when the agent is serving Acme.

not this caller's dataisolation boundary