Threat modeling for agent systems
Map trust boundaries for an agent, enumerate the attacker goals, and rank the mitigations that matter.
Why this matters
Agents introduce attack surfaces that classical web threat models miss: untrusted natural-language input drives privileged actions; tools span tenants; long-lived credentials sit in memory; sub-agents proliferate; LLM outputs can leak secrets verbatim. A structured threat model written before you build saves you incident reviews later.
Learning objectives
- Apply STRIDE + LINDDUN to an agent system.
- Enumerate the OWASP Top 10 for LLMs and the OWASP Top 10 for Agentic AI.
- Map threats to controls covered later in the curriculum.
- Score risk with a simple matrix per agent + per tool.
- Produce an architecture review document you'd defend in front of a security lead.
1. STRIDE — quick recap
Microsoft's STRIDE categorises threats:
| Letter | Threat | Classical example | Agent example |
|---|---|---|---|
| S | Spoofing | Stolen password | Stolen agent service-account credential |
| T | Tampering | SQL injection | Prompt injection rewriting tool args |
| R | Repudiation | "I didn't click that" | Missing act claim hides who refunded |
| I | Information disclosure | Verbose error | LLM leaks system prompt or other-tenant data |
| D | Denial of service | Slowloris | "Denial of wallet" — token-burning loops |
| E | Elevation of privilege | Path traversal | Confused-deputy → cross-tenant write |
For privacy specifically, use LINDDUN (Linking, Identifying, Non-repudiation, Detecting, Data disclosure, content Unawareness, policy Non-compliance) on the agent's data flows.
2. OWASP Top 10 for LLM Applications (2025+)
Track these explicitly when reviewing an agent product:
- Prompt Injection (direct + indirect).
- Sensitive Information Disclosure (leaking PII / training data / system prompts).
- Supply Chain (model, plugin, MCP server, embedding model provenance).
- Data and Model Poisoning (RAG corpus poisoning; fine-tune poisoning).
- Improper Output Handling (LLM output → SQL / shell / HTML without escaping).
- Excessive Agency (agent acts beyond intended authority).
- System Prompt Leakage (not just embarrassing — often contains business logic + creds).
- Vector and Embedding Weaknesses (retrieval poisoning; embedding inversion).
- Misinformation / Overreliance (humans trusting hallucinated outputs).
- Unbounded Consumption (cost, GPU, recursion).
For agents specifically, OWASP's Agentic AI Top 10 (in active maintenance) adds:
- Goal manipulation (subverting the agent's plan).
- Memory poisoning (long-term memory feeding back into decisions).
- Tool misuse (calling a tool in unintended ways).
- Cascading sub-agent failures.
- Identity-spoofing across agents.
- Lack of human oversight on high-stakes actions.
Every threat above maps to a control covered later in this folder.
3. The agent-specific attack tree
A reusable structure for any agent product:
ROOT: Unauthorized action performed by Agent X
├── 1. Steal a credential
│ ├── 1a. Compromise the agent host (cloud workload identity → tokens)
│ ├── 1b. Exfiltrate via LLM output (system prompt or tool output contains secret)
│ ├── 1c. Steal refresh token from agent state store
│ └── 1d. Compromise a tool provider that issued long-lived API key
│
├── 2. Trick the agent into using its own authority badly
│ ├── 2a. Direct prompt injection in user message
│ ├── 2b. Indirect prompt injection in retrieved content (RAG poisoning)
│ ├── 2c. Tool-output injection (e.g., HTML tags returned by an API)
│ ├── 2d. Confused-deputy across tenants
│ └── 2e. Sub-agent persuades parent to escalate
│
├── 3. Bypass policy
│ ├── 3a. Skip approval step via crafted argument names
│ ├── 3b. Override scope via token-exchange path
│ ├── 3c. Replay tokens captured from logs
│ └── 3d. Forge JWTs (alg=none / key confusion)
│
└── 4. Hide the attack
├── 4a. Disable telemetry by getting agent to call its own admin tool
├── 4b. Use legitimate flows that don't get logged
└── 4c. Race conditions in audit pipelineUse this as a checklist on a whiteboard with the product team. Each leaf becomes a specific test case.
4. Data classification + blast radius
For every tool the agent can call, write down:
- Data classification of inputs and outputs (public / internal / confidential / restricted / PII / PHI / PCI).
- Side effects (read-only, idempotent write, irreversible write, financial impact, external comms).
- Blast radius if misused (per-user, per-tenant, system-wide).
- Reversibility (instant undo, manual undo, irreversible).
A useful table:
| Tool | Class | Side effect | Blast radius | Reversible |
|---|---|---|---|---|
search_kb | internal | read | per-user | n/a |
create_ticket | internal | write | per-tenant | manual |
refund_order | PCI | write | per-tenant + $$ | manual + financial |
send_email_external | mixed | external | reputational | irreversible |
delete_user | restricted | destructive | per-tenant | hard |
Rule of thumb: anything in the bottom two rows requires step-up authentication and an audit log entry per call. Lessons 5, 6, and 7 cover the controls.
5. Threat-modeling workshop — 60-minute template
Run this once per agent:
- Diagram (15 min) — principals (lesson 1.2), trust boundaries, data flows, persistence. One whiteboard.
- Asset list (5 min) — what's worth attacking? (User data, money, brand, infra.)
- STRIDE per element (15 min) — walk each data-flow arrow; ask each STRIDE letter.
- LLM-specific overlay (10 min) — walk the OWASP LLM Top 10 + agentic Top 10.
- Score risk (5 min) — Likelihood × Impact, 1-5 each.
- Mitigations + owners (10 min) — pick top 5 risks; assign owners; set due date.
Capture in a Markdown doc in the same repo as the agent. Re-run after major architecture changes.
6. Risk register entry — example
Agent: helpdesk-v1
Threat: Indirect prompt injection in customer-emailed PDFs
ID: THR-2026-014
Category: T (STRIDE) + LLM-01 (Prompt Injection) + Agentic-04 (Tool Misuse)
Asset at risk: Customer PII in CRM
Likelihood: 4 / 5 (PDFs are routinely uploaded by customers)
Impact: 4 / 5 (CRM has cross-customer notes)
Risk score: 16 (High)
Controls:
- C1: Strip suspicious markup from extracted text before sending to LLM
- C2: Tool-call allow-list excludes `crm.search_global` when context contains user-uploaded files
- C3: HITL approval required before any `crm.update`
- C4: Per-tenant scoping enforced on CRM API (defence in depth)
Owner: @sec-team
Due: 2026-07-30
Status: in-progress
Tests: tests/sec/test_pdf_injection.pyMaintaining this register is the single most useful security artefact for an agent program.
7. Linking threats to controls in this curriculum
| Threat | Primary controls | Lesson |
|---|---|---|
| Stolen agent credential | Workload identity, short-lived tokens, DPoP | 2.2 / 1.1 |
| Refresh token theft | Sender-constrained tokens; storage in HSM/Vault | 1.1 / 5.1 |
| Direct prompt injection | Input filters, system prompt isolation, tool-arg validation | 8.1 |
| Indirect prompt injection | Content provenance, tool-output sanitisation, allow-lists | 8.1 |
| Confused deputy | Delegation tokens with act, per-request tenant scoping | 1.2 / 6.1 |
| Tool misuse | Policy-as-code (OPA / Cedar), narrow scopes, HITL | 6.1 / 6.2 |
| MCP supply chain | Pinned + signed servers; sandboxing | 4.2 / 8.2 |
| Denial of wallet | Per-tenant cost caps; step budgets; rate limits | 6.2 / 9.1 |
| System prompt leakage | Egress filters; output classifiers; secrets out of prompts | 8.1 |
| Audit gaps | Decision logs + tamper-evident trails | 7.1 |
8. Hands-on lab (2 h)
- Pick a real or imagined agent product (e.g. "AI Recruiter" that reads CVs, schedules calls, posts on LinkedIn, sends emails).
- Diagram principals + trust boundaries + data flows.
- List all tools and fill in the blast-radius table.
- Run the 60-min workshop solo (or with a friend).
- Produce a risk register with at least 8 entries; rank top 3.
- Identify which lessons of this folder address each top-3 risk.
9. Common pitfalls
- Threat modeling only the happy path — attackers don't use the happy path.
- Treating prompt injection as a generic "input validation" line item.
- No data classification — over-scoping every tool by default.
- Skipping the agent-vs-LLM distinction; the same LLM can serve multiple agents with very different blast radius.
- Reviewing once at launch and never again.
- Threat model lives in someone's laptop, not the repo.
10. Self-check
- STRIDE letters + an agent example for each.
- Three threats unique to indirect prompt injection.
- What "denial of wallet" is.
- Why blast-radius classification matters.
- The 60-minute workshop structure.
11. References
- OWASP "Top 10 for LLM Applications" (2025 version).
- OWASP "Agentic AI Top 10" working draft.
- Microsoft "Threat Modeling AI/ML Systems" docs.
- NIST AI RMF 1.0 + Generative AI Profile.
- "Confused Deputy" — Hardy 1988.
- "Indirect Prompt Injection" — Greshake et al., 2023.
- MITRE ATLAS (adversarial threats to AI systems).
- Google "Secure AI Framework" (SAIF).
Sign in to save your progress and earn badges.