Threat Modeling (Deep Workflow)
Threat modeling turns architecture into attack scenarios and mitigations before code hardens incorrectly. It is team-facing—security is a collaborative exercise, not a gate at the end.
When to Offer This Workflow
Trigger conditions:
- - New service, major data flow change, public API, partner integration
- Compliance asks for “threat model” artifact
- Post-incident “how do we prevent class of issues”
Initial offer:
Use six stages: (1) scope & assets, (2) diagram & trust boundaries, (3) threats (STRIDE), (4) mitigations & controls, (5) prioritize & owners, (6) validate & iterate. Confirm time box (1–2 hour workshop vs async).
Stage 1: Scope & Assets
Goal: Agree what we model and what we protect.
Questions
- 1. In scope: apps, infra, data stores, admin tools, CI/CD?
- Crown jewels: data (PII, keys), money, availability, reputation
- Adversaries: script kiddies, malicious insiders, nation-state (usually pick realistic tiers)
Output
Scope paragraph + asset list with sensitivity.
Exit condition: Shared understanding of what hurts if lost.
Stage 2: Diagram & Trust Boundaries
Goal: Visual model with boundaries where trust changes.
Practices
- - DFD-ish diagram: external actors, services, data stores, queues
- Mark trust boundaries: internet boundary, partner VPC, employee laptop, CI system
- Note auth mechanisms crossing boundaries (mTLS, JWT, API keys)
Pitfalls
- - Missing CI/CD and admin paths—attackers love them
- Over-detailed diagram—keep level consistent
Exit condition: Diagram everyone in the room recognizes as their system.
Stage 3: Threats (STRIDE)
Goal: Systematic brainstorm—not exhaustive fantasy.
STRIDE prompts
- - Spoofing: impersonation of user/service
- Tampering: data/code/config changed in transit or at rest
- Repudiation: actions not attributable—audit gaps
- Information disclosure: leaks to unauthorized
- Denial of service: resource exhaustion, dependency attacks
- Elevation of privilege: user becomes admin, lateral movement
Technique
- - Walk each boundary + each asset with STRIDE columns—rapid ideation, defer judgment
- Capture threats as short scenarios: “Attacker with leaked API key calls admin endpoint”
Exit condition: Threat list with assumptions stated (e.g., “requires MITM”).
Stage 4: Mitigations & Controls
Goal: Map threats to controls—prevent, detect, respond.
Control types
- - Prevent: authZ checks, input validation, encryption
- Detect: logging, alerts, IDS, anomaly detection
- Respond: kill switches, incident playbooks
Avoid
- - Control theater—checkbox without real enforcement
Exit condition: Each high threat has at least one planned control or accepted risk with owner.
Stage 5: Prioritize & Owners
Goal: Ruthless prioritization—fix what matters.
Factors
- - Impact × likelihood (even qualitative MoSCoW)
- Ease of exploitation vs cost to fix
Tracking
- - Tickets per mitigation; link to threat ID
- Residual risk explicitly accepted by appropriate authority when not fixed
Exit condition: Roadmap of mitigations with dates.
Stage 6: Validate & Iterate
Goal: Model ages—revisit on major changes.
Triggers for refresh
- - New data flow, new integration, auth redesign
- Pen test findings that contradict assumptions
Light validation
- - Red team scenarios for top threats if mature org
Final Review Checklist
- - [ ] Assets and scope agreed
- [ ] Trust boundaries diagram current
- [ ] STRIDE pass completed for boundaries
- [ ] Mitigations mapped; owners assigned
- [ ] Residual risk explicit where unmitigated
Tips for Effective Guidance
- - Facilitate, don’t lecture—engineers own the system facts.
- Prefer scenarios over abstract “Tampering risk.”
- Link to requirements (“every admin action audited”) for traceability.
Handling Deviations
- - No time workshop: async diagram + STRIDE spreadsheet review.
- Tiny feature: mini threat model—still document trust boundary with external API.
威胁建模(深度工作流)
威胁建模在代码硬化错误之前,将架构转化为攻击场景和缓解措施。它面向团队——安全是一项协作工作,而非终点的关卡。
何时提供此工作流
触发条件:
- - 新服务、重大数据流变更、公开API、合作伙伴集成
- 合规要求提供威胁模型产物
- 事件后如何预防同类问题
初始提供:
使用六个阶段:(1) 范围与资产、(2) 图表与信任边界、(3) 威胁(STRIDE)、(4) 缓解措施与控制、(5) 优先级排序与负责人、(6) 验证与迭代。确认时间盒(1-2小时工作坊或异步)。
阶段1:范围与资产
目标: 就建模内容和保护对象达成一致。
问题
- 1. 范围内:应用、基础设施、数据存储、管理工具、CI/CD?
- 核心资产:数据(PII、密钥)、资金、可用性、声誉
- 对手:脚本小子、恶意内部人员、国家级(通常选择现实层级)
输出
范围段落 + 带敏感度的资产列表。
退出条件: 对丢失后会造成损害的内容达成共识。
阶段2:图表与信任边界
目标: 带有信任变化边界的可视化模型。
实践
- - 类DFD图表:外部参与者、服务、数据存储、队列
- 标记信任边界:互联网边界、合作伙伴VPC、员工笔记本电脑、CI系统
- 记录跨越边界的认证机制(mTLS、JWT、API密钥)
陷阱
- - 遗漏CI/CD和管理路径——攻击者偏爱它们
- 过度详细的图表——保持层级一致
退出条件: 房间内所有人都认可为其系统的图表。
阶段3:威胁(STRIDE)
目标: 系统性头脑风暴——而非穷尽式幻想。
STRIDE提示
- - 欺骗:冒充用户/服务
- 篡改:传输中或静态的数据/代码/配置被更改
- 抵赖:行为无法归因——审计缺口
- 信息泄露:泄露给未授权方
- 拒绝服务:资源耗尽、依赖攻击
- 权限提升:用户成为管理员、横向移动
技巧
- - 使用STRIDE列遍历每个边界 + 每个资产——快速构思,暂缓判断
- 将威胁记录为简短场景:攻击者利用泄露的API密钥调用管理端点
退出条件: 带有明确假设的威胁列表(例如需要中间人攻击)。
阶段4:缓解措施与控制
目标: 将威胁映射到控制措施——预防、检测、响应。
控制类型
- - 预防:授权检查、输入验证、加密
- 检测:日志记录、告警、入侵检测系统、异常检测
- 响应:紧急开关、事件响应手册
避免
退出条件: 每个高威胁至少有一个计划中的控制措施,或带有负责人的已接受风险。
阶段5:优先级排序与负责人
目标: 无情的优先级排序——修复重要事项。
因素
- - 影响 × 可能性(甚至定性MoSCoW)
- 利用难度 vs 修复成本
追踪
- - 每个缓解措施对应工单;链接到威胁ID
- 未修复时由适当权限明确接受的剩余风险
退出条件: 带有日期的缓解措施路线图。
阶段6:验证与迭代
目标: 模型会老化——在重大变更时重新审视。
刷新触发条件
- - 新数据流、新集成、认证重新设计
- 与假设矛盾的渗透测试发现
轻量验证
最终审查清单
- - [ ] 资产和范围已达成一致
- [ ] 信任边界图表为最新
- [ ] 已完成边界的STRIDE遍历
- [ ] 缓解措施已映射;负责人已分配
- [ ] 未缓解处的剩余风险已明确
有效指导技巧
- - 引导而非说教——工程师掌握系统事实。
- 偏好场景而非抽象的篡改风险。
- 链接到需求(每个管理操作均被审计)以实现可追溯性。
处理偏差
- - 无时间工作坊:异步图表 + STRIDE电子表格审查。
- 微小功能:迷你威胁模型——仍记录与外部API的信任边界。