performing-threat-modeling-with-owasp-threat-dragon

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Performing Threat Modeling with OWASP Threat Dragon

使用OWASP Threat Dragon进行威胁建模

Overview

概述

OWASP Threat Dragon is an open-source threat modeling tool that enables security teams and developers to create threat model diagrams, identify threats using established methodologies (STRIDE, LINDDUN, CIA, DIE, PLOT4ai), and generate comprehensive reports. Threat Dragon runs as both a web application and desktop application (Windows, macOS, Linux), supporting distributed teams working collaboratively on threat models. Version 2.x provides drag-and-drop diagram creation, an auto-generation rule engine for threats and mitigations, and PDF report output for documentation and GRC compliance.
OWASP Threat Dragon是一款开源威胁建模工具,支持安全团队和开发者创建威胁模型图,使用成熟的方法论(STRIDE、LINDDUN、CIA、DIE、PLOT4ai)识别威胁,并生成全面的报告。Threat Dragon可作为网页应用和桌面应用(Windows、macOS、Linux)运行,支持分布式团队协作开展威胁建模工作。2.x版本提供拖拽式图创建功能、用于威胁和缓解措施的自动生成规则引擎,以及用于文档记录和GRC合规的PDF报告输出。

When to Use

使用场景

  • When conducting security assessments that involve performing threat modeling with owasp threat dragon
  • When following incident response procedures for related security events
  • When performing scheduled security testing or auditing activities
  • When validating security controls through hands-on testing
  • 当开展涉及使用OWASP Threat Dragon进行威胁建模的安全评估时
  • 当遵循相关安全事件的事件响应流程时
  • 当执行定期安全测试或审计活动时
  • 当通过实操测试验证安全控制措施时

Prerequisites

前置条件

  • OWASP Threat Dragon desktop application or web instance
  • Understanding of data flow diagram (DFD) notation
  • Familiarity with STRIDE or LINDDUN threat classification
  • Application architecture documentation and network diagrams
  • Stakeholder access for design review sessions
  • OWASP Threat Dragon桌面应用或网页实例
  • 了解数据流图(DFD)符号
  • 熟悉STRIDE或LINDDUN威胁分类方法
  • 应用架构文档和网络图
  • 设计评审会议的干系人访问权限

Threat Modeling Methodologies

威胁建模方法论

STRIDE

STRIDE

CategoryThreat TypeDescriptionExample
SSpoofingImpersonating a user or systemStolen session tokens
TTamperingModifying data in transit or at restSQL injection altering records
RRepudiationDenying an action occurredMissing audit logs
IInformation DisclosureExposing sensitive dataAPI returning excessive fields
DDenial of ServiceMaking a service unavailableResource exhaustion attack
EElevation of PrivilegeGaining unauthorized accessBroken access control
分类威胁类型描述示例
SSpoofing(冒充)冒充用户或系统被盗的会话令牌
TTampering(篡改)修改传输中或静态存储的数据SQL注入篡改记录
RRepudiation(抵赖)否认曾执行某操作缺失审计日志
IInformation Disclosure(信息泄露)暴露敏感数据API返回过多字段
DDenial of Service(拒绝服务)使服务不可用资源耗尽攻击
EElevation of Privilege(权限提升)获取未授权访问权限访问控制失效

LINDDUN (Privacy-Focused)

LINDDUN(隐私聚焦)

CategoryThreat TypeDescription
LLinkabilityAssociating data items across contexts
IIdentifiabilityIdentifying an individual from data
NNon-repudiationInability to deny an action (privacy risk)
DDetectabilityDetermining if data about a subject exists
DDisclosureExposing personal information
UUnawarenessUser unaware of data collection
NNon-complianceViolating privacy regulations
分类威胁类型描述
LLinkability(关联性)在不同场景下关联数据项
IIdentifiability(可识别性)从数据中识别出个人身份
NNon-repudiation(不可抵赖)无法否认操作(隐私风险)
DDetectability(可检测性)判断是否存在关于某主体的数据
DDisclosure(泄露)暴露个人信息
UUnawareness(不知情)用户未察觉数据被收集
NNon-compliance(不合规)违反隐私法规

Workflow

工作流程

Step 1 --- Install Threat Dragon

步骤1 --- 安装Threat Dragon

Desktop Application: Download the installer from the OWASP Threat Dragon releases page for Windows (.exe), macOS (.dmg), or Linux (.AppImage/.deb/.rpm).
Web Application (Docker):
bash
docker run -p 3000:3000 \
  -e ENCRYPTION_JWT_SIGNING_KEY=$(openssl rand -hex 32) \
  -e ENCRYPTION_JWT_REFRESH_SIGNING_KEY=$(openssl rand -hex 32) \
  -e ENCRYPTION_KEYS='[{"isPrimary":true,"id":0,"value":"'$(openssl rand -hex 16)'"}]' \
  -e NODE_ENV=production \
  owasp/threat-dragon:latest
桌面应用:OWASP Threat Dragon发布页面下载适用于Windows(.exe)、macOS(.dmg)或Linux(.AppImage/.deb/.rpm)的安装程序。
网页应用(Docker):
bash
docker run -p 3000:3000 \
  -e ENCRYPTION_JWT_SIGNING_KEY=$(openssl rand -hex 32) \
  -e ENCRYPTION_JWT_REFRESH_SIGNING_KEY=$(openssl rand -hex 32) \
  -e ENCRYPTION_KEYS='[{"isPrimary":true,"id":0,"value":"'$(openssl rand -hex 16)'"}]' \
  -e NODE_ENV=production \
  owasp/threat-dragon:latest

Step 2 --- Define the Scope

步骤2 --- 定义范围

Before creating diagrams, document the scope:
  • System name and description
  • Assets being protected (user data, credentials, payment info)
  • External dependencies (third-party APIs, cloud services)
  • Compliance requirements (GDPR, HIPAA, PCI DSS)
  • Trust boundaries (network segments, authentication zones)
在创建图之前,记录范围:
  • 系统名称和描述
  • 受保护的资产(用户数据、凭证、支付信息)
  • 外部依赖(第三方API、云服务)
  • 合规要求(GDPR、HIPAA、PCI DSS)
  • 信任边界(网络段、认证区域)

Step 3 --- Create Data Flow Diagrams

步骤3 --- 创建数据流图

In Threat Dragon, create a new threat model and add diagrams using the following DFD elements:
Processes: Applications, microservices, API endpoints that transform data. Represented as circles/rounded rectangles.
Data Stores: Databases, file systems, caches, message queues that persist data. Represented as parallel lines.
External Entities: Users, external systems, third-party services outside the trust boundary. Represented as rectangles.
Data Flows: Communication channels between elements showing data direction. Represented as arrows with labels describing the data.
Trust Boundaries: Dashed lines separating zones of different trust levels (internet/DMZ/internal network, user/admin).
在Threat Dragon中,创建新的威胁模型,并使用以下DFD元素添加图:
流程:转换数据的应用、微服务、API端点。用圆形/圆角矩形表示。
数据存储:持久化数据的数据库、文件系统、缓存、消息队列。用平行线表示。
外部实体:信任边界外的用户、外部系统、第三方服务。用矩形表示。
数据流:元素间的通信通道,显示数据方向。用带有数据描述标签的箭头表示。
信任边界:分隔不同信任级别区域(互联网/DMZ/内部网络、用户/管理员)的虚线。

Step 4 --- Identify Threats

步骤4 --- 识别威胁

For each DFD element, apply the STRIDE methodology:
Element TypeApplicable STRIDE Categories
External EntitySpoofing, Repudiation
ProcessSpoofing, Tampering, Repudiation, Information Disclosure, DoS, Elevation of Privilege
Data StoreTampering, Information Disclosure, DoS
Data FlowTampering, Information Disclosure, DoS
Threat Dragon's rule engine automatically suggests threats based on element types. Review each suggestion and mark as:
  • Mitigated: Existing controls address the threat
  • Not Applicable: Threat does not apply to this context
  • Open: Threat needs to be addressed (assign priority and owner)
对每个DFD元素应用STRIDE方法论:
元素类型适用的STRIDE分类
外部实体Spoofing、Repudiation
流程Spoofing、Tampering、Repudiation、Information Disclosure、DoS、Elevation of Privilege
数据存储Tampering、Information Disclosure、DoS
数据流Tampering、Information Disclosure、DoS
Threat Dragon的规则引擎会根据元素类型自动建议威胁。审核每个建议并标记为:
  • 已缓解:现有控制措施可应对该威胁
  • 不适用:该威胁不适用于此场景
  • 未处理:威胁需要解决(分配优先级和负责人)

Step 5 --- Define Mitigations

步骤5 --- 定义缓解措施

For each open threat, document:
  • Mitigation strategy (prevent, detect, respond, transfer)
  • Specific technical controls (encryption, authentication, rate limiting)
  • Owner responsible for implementation
  • Priority and timeline for remediation
对每个未处理的威胁,记录:
  • 缓解策略(预防、检测、响应、转移)
  • 具体技术控制措施(加密、认证、速率限制)
  • 负责实施的人员
  • 修复的优先级和时间线

Step 6 --- Generate Reports

步骤6 --- 生成报告

Threat Dragon produces PDF reports containing:
  • Executive summary of the threat model
  • Data flow diagrams with annotations
  • Threat inventory with severity ratings
  • Mitigation status and recommendations
  • Compliance mapping where applicable
Threat Dragon生成的PDF报告包含:
  • 威胁模型的执行摘要
  • 带注释的数据流图
  • 带有严重性评级的威胁清单
  • 缓解状态和建议
  • 适用的合规映射

Step 7 --- Integrate into SDLC

步骤7 --- 集成到SDLC中

  • Conduct threat modeling during the design phase of new features
  • Update threat models when architecture changes occur
  • Review threat models during security design reviews
  • Store threat model files in version control alongside code
  • Reference threat model findings in security acceptance criteria
  • 在新功能的设计阶段开展威胁建模
  • 当架构发生变化时更新威胁模型
  • 在安全设计评审期间审核威胁模型
  • 将威胁模型文件与代码一起存储在版本控制系统中
  • 在安全验收标准中引用威胁模型的发现结果

Threat Model File Format

威胁模型文件格式

Threat Dragon uses JSON format for threat models, enabling version control and programmatic manipulation:
json
{
  "version": "2.2.0",
  "summary": {
    "title": "E-Commerce Application",
    "owner": "Security Team",
    "description": "Threat model for the checkout flow"
  },
  "detail": {
    "contributors": [
      {"name": "Security Architect"}
    ],
    "diagrams": [
      {
        "id": 0,
        "title": "Checkout Flow",
        "diagramType": "STRIDE",
        "cells": []
      }
    ]
  }
}
Threat Dragon使用JSON格式存储威胁模型,支持版本控制和程序化操作:
json
{
  "version": "2.2.0",
  "summary": {
    "title": "E-Commerce Application",
    "owner": "Security Team",
    "description": "Threat model for the checkout flow"
  },
  "detail": {
    "contributors": [
      {"name": "Security Architect"}
    ],
    "diagrams": [
      {
        "id": 0,
        "title": "Checkout Flow",
        "diagramType": "STRIDE",
        "cells": []
      }
    ]
  }
}

CycloneDX TMBOM Integration

CycloneDX TMBOM集成

Threat Dragon participates in the CycloneDX Threat Model Bill of Materials (TMBOM) effort, enabling export to a common format that can be consumed by other threat modeling tools and GRC platforms, preventing vendor lock-in.
Threat Dragon参与CycloneDX威胁模型物料清单(TMBOM)项目,支持导出为通用格式,可供其他威胁建模工具和GRC平台使用,避免供应商锁定。

Best Practices

最佳实践

  1. Start simple: Begin with high-level DFDs (Level 0) before decomposing into detailed diagrams
  2. Involve developers: Include development team members in threat modeling sessions for realistic threat assessment
  3. Time-box sessions: Limit initial sessions to 90 minutes; iterate in follow-up sessions
  4. Prioritize by risk: Use severity ratings (Critical, High, Medium, Low) to prioritize mitigations
  5. Living documents: Treat threat models as living documents that evolve with the system
  6. Automate where possible: Use the rule engine for initial threat generation, then refine manually
  1. 从简开始:先从高层DFD(0级)入手,再分解为详细图
  2. 让开发者参与:邀请开发团队成员参与威胁建模会议,进行更贴合实际的威胁评估
  3. 限定会议时长:初始会议限制在90分钟内,后续会议逐步迭代
  4. 按风险优先级处理:使用严重性评级(Critical、High、Medium、Low)确定缓解措施的优先级
  5. 活文档:将威胁模型视为随系统演进的活文档
  6. 尽可能自动化:使用规则引擎生成初始威胁,再手动细化

References

参考资料