Threat Modeling
Purpose
Build a practical threat model that helps an AI agent focus security work on the highest-risk paths.
Use it before implementation, during feature review, or when deciding which vulnerability classes and
tests deserve the most attention.
Core Questions
Always answer:
- What assets matter here?
- Who can interact with them?
- Where does trust change?
- How could an attacker abuse the feature?
- Which controls must exist before release?
Workflow
Step 1: Define Scope
Clarify the target:
- single endpoint or workflow
- feature or service
- whole repository or subsystem
List the important assets: credentials, tokens, money movement, files, PII, admin actions, internal services, signed data, and audit logs.
Step 2: Map Actors and Entry Points
Identify:
- anonymous users
- authenticated users
- admins/support/internal operators
- third-party systems and webhooks
- scheduled jobs, queues, and background workers
Then list the entry points they can influence: HTTP routes, message queues, uploads, config, headers, mobile deep links, admin tooling, and internal RPC calls.
Include serialized state channels such as cookies, session blobs, cache objects, queue payloads, and import/export formats.
Step 3: Draw Trust Boundaries
Mark every boundary where data becomes more trusted or more powerful, for example:
- browser to server
- public API to internal service
- user tenant to shared resource
- webhook sender to processing pipeline
- app server to database, cache, filesystem, or cloud metadata service
Step 4: Enumerate Abuse Cases
For each boundary, ask:
- Can identity be spoofed?
- Can an object/action be accessed without proper authorization?
- Can untrusted input reach code execution, queries, templates, files, or outbound network calls?
- Can untrusted input reach deserializers, object mappers, YAML/XML parsers, or state restore mechanisms?
- Can state transitions be raced, replayed, or skipped?
- Can the feature leak secrets, tokens, or cross-tenant data?
- Can cheap requests trigger expensive work?
Step 5: Map Abuse Cases to Scan Priorities
Turn each abuse case into:
- likely vulnerability class
- likely source
- likely sink
- files/modules worth scanning first
- controls/tests that should exist
When eresus-sast-scanner is available, select the matching vulnerability knowledge files that should be loaded next.
Step 6: Produce an Actionable Threat Model
End with a prioritized output the user can immediately use:
- top attack paths
- required preventative controls
- required detective controls or logging
- targeted SAST scan plan
- targeted test ideas
Threat Modeling Guardrails
- Distinguish confirmed facts from assumptions.
- Do not treat a threat model as proof of exploitability; it is a prioritization tool.
- Do not focus only on injection bugs; include auth, logic, tenancy, workflow, and abuse-economics risks.
- Do not ignore internal systems; many critical bugs cross "trusted" service boundaries.
- Do not recommend vague controls. Name the precise guard, check, or invariant that should exist.
Output Format
Use:
# Threat Model — <scope>
## Assets
<flat list>
## Actors
<flat list>
## Trust Boundaries
<flat list>
## Priority Attack Paths
1. <attack path + impact>
2. <attack path + impact>
3. <attack path + impact>
## Required Controls
<flat list>
## Targeted SAST Plan
<which modules/files to scan and which vulnerability classes to prioritize>
## Test Ideas
<flat list>
1---2name: eresus-threat-modeler3description: Threat modeling skill for new features, services, endpoints, or repositories. Trigger when the user asks to: "threat model this", "analyze attack surface", "find abuse cases", "map trust boundaries", "prioritize security review", or wants a structured security design review before or alongside coding. Complements eresus-sast-scanner by turning architecture into a prioritized scan plan.4---5
6# Threat Modeling
7
8## Purpose
9
10Build a practical threat model that helps an AI agent focus security work on the highest-risk paths.
11Use it before implementation, during feature review, or when deciding which vulnerability classes and
12tests deserve the most attention.
13
14## Core Questions
15
16Always answer:
17
181. What assets matter here?
192. Who can interact with them?
203. Where does trust change?
214. How could an attacker abuse the feature?
225. Which controls must exist before release?
23
24---
25
26## Workflow
27
28### Step 1: Define Scope
29
30Clarify the target:
31
32- single endpoint or workflow
33- feature or service
34- whole repository or subsystem
35
36List the important assets: credentials, tokens, money movement, files, PII, admin actions, internal services, signed data, and audit logs.
37
38### Step 2: Map Actors and Entry Points
39
40Identify:
41
42- anonymous users
43- authenticated users
44- admins/support/internal operators
45- third-party systems and webhooks
46- scheduled jobs, queues, and background workers
47
48Then list the entry points they can influence: HTTP routes, message queues, uploads, config, headers, mobile deep links, admin tooling, and internal RPC calls.
49Include serialized state channels such as cookies, session blobs, cache objects, queue payloads, and import/export formats.
50
51### Step 3: Draw Trust Boundaries
52
53Mark every boundary where data becomes more trusted or more powerful, for example:
54
55- browser to server
56- public API to internal service
57- user tenant to shared resource
58- webhook sender to processing pipeline
59- app server to database, cache, filesystem, or cloud metadata service
60
61### Step 4: Enumerate Abuse Cases
62
63For each boundary, ask:
64
65- Can identity be spoofed?
66- Can an object/action be accessed without proper authorization?
67- Can untrusted input reach code execution, queries, templates, files, or outbound network calls?
68- Can untrusted input reach deserializers, object mappers, YAML/XML parsers, or state restore mechanisms?
69- Can state transitions be raced, replayed, or skipped?
70- Can the feature leak secrets, tokens, or cross-tenant data?
71- Can cheap requests trigger expensive work?
72
73### Step 5: Map Abuse Cases to Scan Priorities
74
75Turn each abuse case into:
76
77- likely vulnerability class
78- likely source
79- likely sink
80- files/modules worth scanning first
81- controls/tests that should exist
82
83When `eresus-sast-scanner` is available, select the matching vulnerability knowledge files that should be loaded next.
84
85### Step 6: Produce an Actionable Threat Model
86
87End with a prioritized output the user can immediately use:
88
89- top attack paths
90- required preventative controls
91- required detective controls or logging
92- targeted SAST scan plan
93- targeted test ideas
94
95---
96
97## Threat Modeling Guardrails
98
99- Distinguish confirmed facts from assumptions.
100- Do not treat a threat model as proof of exploitability; it is a prioritization tool.
101- Do not focus only on injection bugs; include auth, logic, tenancy, workflow, and abuse-economics risks.
102- Do not ignore internal systems; many critical bugs cross "trusted" service boundaries.
103- Do not recommend vague controls. Name the precise guard, check, or invariant that should exist.
104
105---
106
107## Output Format
108
109Use:
110
111```markdown
112# Threat Model — <scope>
113
114## Assets
115<flat list>
116
117## Actors
118<flat list>
119
120## Trust Boundaries
121<flat list>
122
123## Priority Attack Paths
1241. <attack path + impact>
1252. <attack path + impact>
1263. <attack path + impact>
127
128## Required Controls
129<flat list>
130
131## Targeted SAST Plan
132<which modules/files to scan and which vulnerability classes to prioritize>
133
134## Test Ideas
135<flat list>
136```