关于 Threat Hunting & IOC Analysis
面向威胁猎手的 Claude 技能,可将威胁报告和行为描述转化为标准化 IOC、ATT&CK 映射、狩猎假设及 SIEM 检测内容。它结合可重复的狩猎指导与 IOC 提取、技术映射脚本。
主要功能
- 01IOC 提取、标准化与置信度评分
- 02生成 STIX 格式指标
- 03MITRE ATT&CK 技术映射
- 04生成狩猎假设
- 05生成 Sigma、Splunk SPL、KQL 和 EQL 检测
适用场景
- 01从报告、邮件或日志提取并格式化 IOC
- 02将观察到的行为映射到 ATT&CK 技术
- 03为主动威胁狩猎制定假设
- 04创建 SIEM 查询和检测规则
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ masriyan/ claude-code-cybersecurity-skill --skill threat-hunting-&-ioc-analysis安装后在 Claude Code 中输入/threat-hunting-&-ioc-analysis确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
examples/example_usage.mdscripts/mitre_mapper.pyioc_extractor.py详细介绍
威胁狩猎与 IOC 分析
目的
让 Claude 能够协助威胁猎手主动检测威胁、提取和规范化 IOC、映射 MITRE ATT&CK、生成狩猎假设,并将威胁情报转化为适用于所有主流 SIEM 平台的可执行检测规则。
激活条件
用户询问以下内容时,此技能将激活:
- 从威胁报告、电子邮件或安全公告中提取 IOC
- 将行为或 TTP 映射到 MITRE ATT&CK 框架
- 针对特定威胁行为者或技术生成狩猎假设
- 创建 Sigma 规则、Splunk SPL 查询、KQL 或 EQL
- 将威胁情报转化为 SIEM 检测查询
- 兼容 STIX/TAXII 或 MISP 的指标格式
- 创建 ATT&CK Navigator 图层
- 跨多个来源关联威胁情报
- 在 SIEM 或 EDR 中主动进行威胁狩猎
先决条件
pip install requests pyyaml stix2 taxii2-client
可选平台:
- MISP — 威胁情报共享平台
- OpenCTI — 威胁情报平台
- YARA — 模式匹配(→ Skill 05)
- Sigma CLI — 规则转换工具
- SIEM 访问权限(Splunk、Elastic、QRadar、Microsoft Sentinel)
核心能力
1. IOC 提取与规范化
当用户提供威胁报告、文章、电子邮件或日志片段时:
Claude 执行以下提取步骤:
- 使用模式匹配解析所有文本,查找指标:
| IOC 类型 | 模式示例 |
|---|---|
| IPv4 | 192.0.2.1,去混淆格式:192[.]0[.]2[.]1 |
| IPv6 | 2001:db8::1 |
| 域名 | evil.example.com,evil[.]example[.]com |
| URL | hxxp://evil.com/path,https://malicious[.]io/c2 |
| 电子邮件 | [email protected],phish[at]evil.com |
| MD5 | 32 个十六进制字符 |
| SHA1 | 40 个十六进制字符 |
| SHA256 | 64 个十六进制字符 |
| CVE | CVE-2024-XXXXX |
| ATT&CK ID | T1059.001,TA0001 |
| 注册表项 | HKCU\Software\... |
| 文件路径 | C:\Windows\Temp\...,/tmp/... |
| Mutex | 命名互斥体模式 |
-
解除提取出的指标的混淆 — 使用前还原:
hxxp://→http://[.]→.[at]→@[:]→:
-
按类型分类:网络 / 文件 / 主机 / 身份 / 漏洞
-
按置信度评分:高(具体且有来源)、中(推断得出)、低(通用)
-
以多种格式输出:
python scripts/ioc_extractor.py --input threat_report.txt --output iocs.json
python scripts/ioc_extractor.py --input report.pdf --format stix --output iocs.stix.json
python scripts/ioc_extractor.py --input email.eml --defang --output iocs.csv
STIX 2.1 输出模板:
{
"type": "indicator",
"id": "indicator--[uuid]",
"created": "2025-05-28T00:00:00.000Z",
"name": "Malicious IP — C2 Infrastructure",
"pattern": "[ipv4-addr:value = '192.0.2.10']",
"pattern_type": "stix",
"valid_from": "2025-05-28T00:00:00Z",
"labels": ["malicious-activity", "c2"],
"confidence": 85
}
2. MITRE ATT&CK 映射
当用户提供 TTP、行为或恶意软件报告时:
python scripts/mitre_mapper.py --input techniques.txt --output attack_map.json
python scripts/mitre_mapper.py --technique T1059.001 --detection-query splunk
映射流程:
- 对照 ATT&CK 技术描述分析每种行为
- 映射到具体的战术 → 技术 → 子技术(T1059 → T1059.001)
- 根据证据质量分配置信度
ATT&CK 战术参考:
| 战术 | ID | 描述 |
|---|---|---|
| 侦察 | TA0043 | 攻击前的信息收集 |
| 资源开发 | TA0042 | 建立攻击资源 |
| 初始访问 | TA0001 | 进入目标环境 |
| 执行 | TA0002 | 运行恶意代码 |
| 持久化 | TA0003 | 维持立足点 |
| 权限提升 | TA0004 | 获取更高权限 |
| 防御规避 | TA0005 | 规避检测 |
| 凭证访问 | TA0006 | 窃取凭证 |
| 发现 | TA0007 | 了解环境 |
| 横向移动 | TA0008 | 在网络中移动 |
| 收集 | TA0009 | 收集感兴趣的数据 |
| 命令与控制 | TA0011 | 与受感染主机通信 |
| 外传 | TA0010 | 窃取数据 |
| 影响 | TA0040 | 干扰或破坏系统 |
ATT&CK Navigator 图层格式(用于可视化的 JSON):
{
"name": "Threat Hunt Layer — [Threat Actor/Campaign]",
"versions": {"attack": "14", "navigator": "4.9"},
"domain": "enterprise-attack",
"techniques": [
{
"techniqueID": "T1059.001",
"color": "#ff6666",
"comment": "Observed PowerShell download cradle",
"enabled": true,
"score": 100
}
]
}
3. 生成狩猎假设
当用户要求生成狩猎假设时:
使用以下结构化假设模板:
## Hunt Hypothesis — [ID]: [Short Name]
**Hypothesis Statement:**
"We believe [Threat Actor/TTPs] may be present in [Environment] based on
[Threat Intelligence / Recent Incidents / Industry Reports]."
**Rationale:**
[Why this threat is relevant to this organization — industry, exposure, recent news]
**ATT&CK Techniques Covered:**
- T1059.001 — PowerShell
- T1053.005 — Scheduled Task/Job
- T1021.001 — Remote Services: Remote Desktop Protocol
**Data Sources Required:**
- Windows Event Logs (Security, System, PowerShell/4104)
- EDR process execution telemetry
- DNS query logs
- Proxy/firewall logs
**Detection Logic:**
[SIEM query or pseudocode]
**Success Criteria:**
- POSITIVE: We find evidence of the technique → escalate to IR (Skill 07)
- NEGATIVE: No evidence after thorough search → document as cleared hunt
- INCONCLUSIVE: Insufficient data → identify logging gaps
**Estimated Hunt Duration:** [X hours]
**Priority:** [High / Medium / Low]
**Analyst:** [Name]
4. SIEM 检测查询库
当用户要求为特定技术构建检测查询时:
Splunk SPL 查询
// T1059.001 — PowerShell Execution with suspicious flags
index=windows (source="WinEventLog:Microsoft-Windows-PowerShell/Operational" EventCode=4104)
| search ScriptBlockText IN ("*DownloadString*", "*IEX*", "*EncodedCommand*", "*bypass*", "*WebClient*")
| stats count by ComputerName, UserName, ScriptBlockText
| where count > 0
// T1003.001 — LSASS Memory Dump
index=windows EventCode=10 TargetImage="*lsass.exe"
| where NOT (SourceImage IN ("C:\\Windows\\System32\\*", "C:\\Program Files\\*"))
| table _time, SourceImage, TargetImage, GrantedAccess, CallTrace
// T1547.001 — Registry Run Key Persistence
index=windows EventCode=13 TargetObject IN ("*\\Run\\*", "*\\RunOnce\\*")
| where NOT (Image IN ("C:\\Windows\\System32\\*", "C:\\Windows\\SysWOW64\\*"))
| table _time, ComputerName, Image, TargetObject, Details
// T1021.002 — Lateral Movement via SMB Admin Shares
index=windows EventCode=5140
| where ShareName IN ("\\\\*\\ADMIN$", "\\\\*\\C$", "\\\\*\\IPC$")
| stats count by SubjectUserName, IpAddress, ShareName, ObjectType
| where count > 3
Microsoft Sentinel KQL
// T1110.001 — Brute Force Login Attempt
SecurityEvent
| where EventID == 4625
| where TimeGenerated > ago(1h)
| summarize FailCount=count() by TargetAccount, IpAddress=replace(@"\.", "[.]", tostring(parse_json(EventData).IpAddress))
| where FailCount > 20
| join kind=leftouter (
SecurityEvent | where EventID == 4624
| summarize SuccessCount=count() by TargetAccount
) on TargetAccount
| project TargetAccount, IpAddress, FailCount, SuccessCount
| where isnotnull(SuccessCount) // Brute force succeeded!
// T1190 — Exploit Public-Facing Application
AzureDiagnostics
| where Category == "ApplicationGatewayFirewallLog"
| where action_s == "Blocked"
| where ruleSetVersion_s startswith "3."
| summarize count() by clientIp_s, requestUri_s, ruleId_s
| where count_ > 100
| order by count_ desc
Elastic EQL
// T1055 — Process Injection
sequence by host.name
[process where process.name : "notepad.exe" and event.type == "start"]
[process where event.type == "start" and process.parent.name : "notepad.exe"
and not process.name in ("conhost.exe")]
// T1566.001 — Spearphishing with attachment
sequence by user.name within 5m
[file where file.extension in ("doc", "xls", "pdf") and
process.name : ("outlook.exe", "WINWORD.EXE")]
[process where process.name : ("cmd.exe", "powershell.exe", "wscript.exe", "cscript.exe")]
Sigma 规则模板
title: Suspicious PowerShell Download Cradle
id: a3c2f1b4-8e9d-4a2c-b7f6-1234567890ab
status: stable
description: Detects PowerShell commands used to download and execute code from the internet
author: Threat Hunter
date: 2025/05/28
modified: 2025/05/28
references:
- https://attack.mitre.org/techniques/T1059/001/
tags:
- attack.execution
- attack.t1059.001
- attack.defense_evasion
- attack.t1027
logsource:
category: ps_script
product: windows
definition: Script Block Logging enabled (EventID 4104)
detection:
selection:
ScriptBlockText|contains|all:
- 'DownloadString'
- 'IEX'
selection2:
ScriptBlockText|contains:
- '-EncodedCommand'
- '-enc '
- '-WindowStyle Hidden'
- 'Net.WebClient'
- 'WebProxy'
condition: selection or selection2
falsepositives:
- Legitimate software installations
- Administrative scripts
level: high
5. 威胁情报关联分析
当用户要求关联 IOC 或识别威胁行为者时:
-
对照已知攻击活动,交叉分析基础设施:
- 相同的注册商 + 相近的注册日期 → 基础设施可能有关联
- 托管多个 C2 域名的 IP → 基础设施集群
- 证书 SAN 字段 → 揭示关联域名
-
将威胁行为者映射到相关组织:
- MITRE ATT&CK 组织:https://attack.mitre.org/groups/
- VirusTotal/OpenCTI 行为者追踪
- Mandiant / CrowdStrike / SentinelOne 威胁情报报告
-
生成威胁评估:
## Threat Assessment — [Campaign Name] **Threat Actor:** [APT Group / Criminal Group / Unknown] **Confidence:** [High / Medium / Low] **Motivation:** [Espionage / Financial / Hacktivism] **Targeting:** [Industries / Countries / Organization types] **Campaign IOCs:** - Infrastructure: [IPs, domains] - Malware: [Family names, hashes] - TTPs: [ATT&CK technique IDs] **Relevance to Organization:** [Why this threat is or isn't relevant] **Recommended Actions:** 1. Block IOCs in firewall/proxy 2. Hunt for T1XXX in SIEM 3. Deploy YARA rules for detection
脚本参考
ioc_extractor.py
python scripts/ioc_extractor.py --input threat_report.txt --output iocs.json
python scripts/ioc_extractor.py --input report.pdf --format stix --output iocs.stix.json
python scripts/ioc_extractor.py --input email.eml --defang --output iocs.csv
mitre_mapper.py
python scripts/mitre_mapper.py --input techniques.txt --output attack_map.json
python scripts/mitre_mapper.py --technique T1059.001 --detection-query splunk
python scripts/mitre_mapper.py --actor "APT29" --output apt29_layer.json
技能集成
| 条件 | 相关技能 |
|---|---|
| 来自恶意软件样本的 IOC | ← 技能 05(恶意软件分析) |
| 来自 IR 行动的 IOC | ← 技能 07(事件响应) |
| 将情报源狩猎查询发送至 SIEM | → 技能 12(日志分析) |
| 生成检测规则 | → 技能 15(蓝队防御) |
| 自动响应调查发现 | → 技能 11(CSOC 自动化) |
参考资料
v3.0 增强功能(2026 年更新)
以威胁情报为依据、可重复执行的狩猎:
- ATT&CK 当前版本 — 映射到最新的 Enterprise 矩阵(包括更新后的云、身份和容器技术);明确指出子技术。
- PEAK 狩猎框架 — 按 Prepare → Execute → Act 的流程组织狩猎,并记录假设、数据源及 ABLE(行为者/行为/位置/证据)基线。
- 以身份为中心的狩猎 — 分析 Entra ID / Okta 日志:不可能的旅行、非法 OAuth 同意授权、MFA 疲劳、令牌盗窃与重放,以及风险登录关联分析。
- 利用系统自带工具 — 为 LOLBin/LOLBAS 使用情况建立基线,并狩猎偏差,而非依赖静态特征。
- 检测即代码 — 将狩猎发现编写为纳入版本控制并附带测试数据的 Sigma 规则,然后将经过验证的狩猎提升为技能 12/15 检测。
- 狩猎成熟度 — 跟踪从临时到数据驱动再到自动化的演进;记录哪些狩猎已成为定期执行的检测。
**精确性规则:**每次狩猎都必须给出假设、查询、结果(已发现/未发现/无法确定)和处置方式(新增检测 / 调优警报 / 关闭)。
评论
支持 Markdown