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