mcpField
A
analyzing-threat-actor-ttps-with-mitre-attack

analyzing-threat-actor-ttps-with-mitre-attack

github.com/mukul975安全35.2k314 次安装8 周前更新
代码仓库

关于 analyzing-threat-actor-ttps-with-mitre-attack

该技能为安全分析人员提供将威胁行为映射到 MITRE ATT&CK 的流程。它涵盖技术映射、Navigator 热图、检测缺口分析及跨威胁组织的 TTP 比较。

主要功能

  1. 01查询 MITRE ATT&CK 数据
  2. 02将威胁组织映射到攻击技术
  3. 03生成 ATT&CK Navigator 图层
  4. 04识别检测覆盖缺口
  5. 05比较不同组织的 TTP

适用场景

  1. 01分析威胁组织的行为与技术
  2. 02确定检测工程的优先级
  3. 03比较多个组织共用和独有的 TTP

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-threat-actor-ttps-with-mitre-attack

安装后在 Claude Code 中输入/analyzing-threat-actor-ttps-with-mitre-attack确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

详细介绍

使用 MITRE ATT&CK 分析威胁行为者 TTP

概述

MITRE ATT&CK 是一个全球可访问的知识库,基于真实世界的观察记录,涵盖对手的战术、技术和过程(TTP)。本技能涵盖将威胁行为者行为系统性地映射到 ATT&CK 框架、使用 ATT&CK Navigator 构建技术覆盖热力图、识别检测盲区,以及生成可操作的情报报告,将观察到的 IOC 与 Enterprise、Mobile 和 ICS 矩阵中特定对手技术相关联。

何时使用

  • 当调查安全事件需要分析威胁行为者 ttps 与 mitre attack 时
  • 当为该领域构建检测规则或威胁狩猎查询时
  • 当 SOC 分析师需要针对此类分析的结构化流程时
  • 当验证相关攻击技术的安全监控覆盖范围时

前提条件

  • Python 3.9+,以及 mitreattack-python、attackcti、stix2 库
  • MITRE ATT&CK Navigator(基于 Web 或本地部署)
  • 理解 ATT&CK 矩阵结构:战术、技术、子技术
  • 可访问威胁情报报告或 MISP/OpenCTI 以获取威胁行为者数据
  • 熟悉 STIX 2.1 Attack Pattern 对象

关键概念

ATT&CK 矩阵结构

ATT&CK Enterprise 矩阵将对手行为组织为 14 个战术(“为什么”),其中包含技术(“如何”)和子技术(具体实现)。每项技术都关联有数据源、检测方法、缓解措施,以及来自已观察威胁组织的真实世界过程示例。

威胁组织画像

ATT&CK 收录了超过 140 个威胁组织(例如 APT28、APT29、Lazarus Group、FIN7),并记录了其技术使用情况。每个组织画像包括别名、目标行业、相关行动、使用的软件,以及具有过程级细节的技术映射。

ATT&CK Navigator

ATT&CK Navigator 是一个基于 Web 的工具,用于创建自定义 ATT&CK 矩阵可视化。分析师创建层(JSON 文件),用分数、颜色、注释和元数据标注技术,以可视化威胁行为者覆盖范围、检测能力或风险评估。

工作流

步骤 1:以编程方式查询 ATT&CK 数据
from attackcti import attack_client
import json

# Initialize ATT&CK client (queries MITRE TAXII server)
lift = attack_client()

# Get all Enterprise techniques
enterprise_techniques = lift.get_enterprise_techniques()
print(f"Total Enterprise techniques: {len(enterprise_techniques)}")

# Get all threat groups
groups = lift.get_groups()
print(f"Total threat groups: {len(groups)}")

# Get specific group by name
apt29 = [g for g in groups if 'APT29' in g.get('name', '')]
if apt29:
    group = apt29[0]
    print(f"Group: {group['name']}")
    print(f"Aliases: {group.get('aliases', [])}")
    print(f"Description: {group.get('description', '')[:200]}")
步骤 2:将威胁行为者映射到 ATT&CK 技术
from attackcti import attack_client

lift = attack_client()

# Get techniques used by APT29
apt29_techniques = lift.get_techniques_used_by_group("G0016")  # APT29 group ID

technique_map = {}
for entry in apt29_techniques:
    tech_id = entry.get("external_references", [{}])[0].get("external_id", "")
    tech_name = entry.get("name", "")
    description = entry.get("description", "")
    tactic_refs = [
        phase.get("phase_name", "")
        for phase in entry.get("kill_chain_phases", [])
    ]

    technique_map[tech_id] = {
        "name": tech_name,
        "tactics": tactic_refs,
        "description": description[:300],
    }

print(f"\nAPT29 uses {len(technique_map)} techniques:")
for tid, info in sorted(technique_map.items()):
    print(f"  {tid}: {info['name']} [{', '.join(info['tactics'])}]")
步骤 3:生成 ATT&CK Navigator 层
import json

def create_navigator_layer(group_name, technique_map, description=""):
    """Generate ATT&CK Navigator layer JSON for a threat group."""
    techniques_list = []
    for tech_id, info in technique_map.items():
        techniques_list.append({
            "techniqueID": tech_id,
            "tactic": info["tactics"][0] if info["tactics"] else "",
            "color": "#ff6666",  # Red for observed techniques
            "comment": info["description"][:200],
            "enabled": True,
            "score": 100,
            "metadata": [
                {"name": "group", "value": group_name},
            ],
        })

    layer = {
        "name": f"{group_name} TTP Coverage",
        "versions": {
            "attack": "16.1",
            "navigator": "5.1.0",
            "layer": "4.5",
        },
        "domain": "enterprise-attack",
        "description": description or f"Techniques attributed to {group_name}",
        "filters": {"platforms": ["Windows", "Linux", "macOS", "Cloud"]},
        "sorting": 0,
        "layout": {
            "layout": "side",
            "aggregateFunction": "average",
            "showID": True,
            "showName": True,
            "showAggregateScores": False,
            "countUnscored": False,
        },
        "hideDisabled": False,
        "techniques": techniques_list,
        "gradient": {
            "colors": ["#ffffff", "#ff6666"],
            "minValue": 0,
            "maxValue": 100,
        },
        "legendItems": [
            {"label": "Observed technique", "color": "#ff6666"},
            {"label": "Not observed", "color": "#ffffff"},
        ],
        "showTacticRowBackground": True,
        "tacticRowBackground": "#dddddd",
        "selectTechniquesAcrossTactics": True,
        "selectSubtechniquesWithParent": False,
        "selectVisibleTechniques": False,
    }

    return layer


# Generate and save layer
layer = create_navigator_layer("APT29", technique_map, "APT29 (Cozy Bear) TTP analysis")
with open("apt29_navigator_layer.json", "w") as f:
    json.dump(layer, f, indent=2)
print("[+] Navigator layer saved to apt29_navigator_layer.json")
步骤 4:识别检测盲区
from attackcti import attack_client

lift = attack_client()

# Get all techniques with data sources
all_techniques = lift.get_enterprise_techniques()

# Build data source coverage map
data_source_coverage = {}
for tech in all_techniques:
    tech_id = tech.get("external_references", [{}])[0].get("external_id", "")
    data_sources = tech.get("x_mitre_data_sources", [])

    for ds in data_sources:
        if ds not in data_source_coverage:
            data_source_coverage[ds] = []
        data_source_coverage[ds].append(tech_id)

# Compare threat actor techniques against available detections
detected_techniques = {"T1059", "T1071", "T1566"}  # Example: techniques you can detect
actor_techniques = set(technique_map.keys())

covered = actor_techniques.intersection(detected_techniques)
gaps = actor_techniques - detected_techniques

print(f"\n=== Detection Gap Analysis for APT29 ===")
print(f"Actor techniques: {len(actor_techniques)}")
print(f"Detected: {len(covered)} ({len(covered)/len(actor_techniques)*100:.0f}%)")
print(f"Gaps: {len(gaps)} ({len(gaps)/len(actor_techniques)*100:.0f}%)")
print(f"\nUndetected techniques:")
for tech_id in sorted(gaps):
    if tech_id in technique_map:
        print(f"  {tech_id}: {technique_map[tech_id]['name']}")
步骤 5:跨组织技术比较
from attackcti import attack_client

lift = attack_client()

# Compare techniques across multiple groups
groups_to_compare = {
    "G0016": "APT29",
    "G0007": "APT28",
    "G0032": "Lazarus Group",
}

group_techniques = {}
for gid, gname in groups_to_compare.items():
    techs = lift.get_techniques_used_by_group(gid)
    tech_ids = set()
    for t in techs:
        tid = t.get("external_references", [{}])[0].get("external_id", "")
        if tid:
            tech_ids.add(tid)
    group_techniques[gname] = tech_ids

# Find common and unique techniques
all_groups = list(group_techniques.keys())
common_to_all = set.intersection(*group_techniques.values())
print(f"\nTechniques common to all {len(all_groups)} groups: {len(common_to_all)}")
for tid in sorted(common_to_all):
    print(f"  {tid}")

for gname, techs in group_techniques.items():
    unique = techs - set.union(*[t for n, t in group_techniques.items() if n != gname])
    print(f"\nUnique to {gname}: {len(unique)} techniques")

验证标准

  • 已通过 TAXII 服务或本地副本成功查询 ATT&CK 数据
  • 已将威胁行为者映射到具体技术并附有过程示例
  • ATT&CK Navigator 层 JSON 有效且可正确渲染
  • 检测盲区分析识别出未被监控的技术
  • 跨组织比较揭示共享和独特的 TTP
  • 输出可用于检测工程优先级排序

参考资料

评论

支持 Markdown