mcpField
T
Threat Hunting & IOC Analysis

Threat Hunting & IOC Analysis

github.com/masriyanセキュリティ530220 回インストール1 週間前に更新
リポジトリ

Threat Hunting & IOC Analysis について

脅威ハンター向けの Claude スキルです。脅威レポートや行動の記述から、正規化した IOC、ATT&CK マッピング、ハンティング仮説、SIEM 検知コンテンツを作成します。IOC 抽出と手法マッピングのスクリプトを、再現可能なハンティング手順と組み合わせています。

主な機能

  1. 01IOC の抽出、正規化、信頼度評価
  2. 02STIX 形式のインジケーター出力
  3. 03MITRE ATT&CK の手法マッピング
  4. 04ハンティング仮説の作成
  5. 05Sigma、Splunk SPL、KQL、EQL の検知

活用シーン

  1. 01レポート、メール、ログから IOC を抽出・整形
  2. 02観測した行動を ATT&CK の手法に対応付け
  3. 03プロアクティブな脅威ハンティングの仮説作成
  4. 04SIEM クエリと検知ルールの作成

インストール

コマンドをコピーしてターミナルで実行します。

$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.md
scripts/
mitre_mapper.py
ioc_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 — パターンマッチング(→ スキル 05)
  • Sigma CLI — ルール変換ツール
  • SIEM アクセス(Splunk、Elastic、QRadar、Microsoft Sentinel)

主な機能

1. IOC の抽出と正規化

ユーザーが脅威レポート、記事、メール、またはログの抜粋を提供した場合:

Claude は次の手順で抽出を行います。

  1. すべてのテキストを解析し、パターンマッチングを使用してインジケーターを検出します。
IOC タイプパターンの例
IPv4192.0.2.1、難読化形式:192[.]0[.]2[.]1
IPv62001:db8::1
ドメインevil.example.com、evil[.]example[.]com
URLhxxp://evil.com/path、https://malicious[.]io/c2
メールアドレス[email protected]、phish[at]evil.com
MD516 進数 32 文字
SHA116 進数 40 文字
SHA25616 進数 64 文字
CVECVE-2024-XXXXX
ATT&CK IDT1059.001、TA0001
レジストリキーHKCU\Software\...
ファイルパスC:\Windows\Temp\...、/tmp/...
Mutex名前付きミューテックスのパターン
  1. 抽出したインジケーターをデファングします。使用前にリファングしてください。

    • hxxp:// → http://
    • [.] → .
    • [at] → @
    • [:] → :
  2. タイプ別に分類します:ネットワーク / ファイル / ホスト / ID / 脆弱性

  3. 信頼度をスコア化します:高(具体的で、出典がある)、中(推論に基づく)、低(一般的)

  4. 複数の形式で出力します。

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

マッピングのプロセス:

  1. 各振る舞いを ATT&CK の手法の説明と照合して分析します
  2. 具体的な戦術 → 手法 → サブテクニックにマッピングします(T1059 → T1059.001)
  3. 証拠の質に基づいて信頼度を割り当てます

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 の相関分析や脅威アクターの特定をユーザーから依頼された場合:

  1. 既知のキャンペーン間でインフラを相互参照します。

    • 同一のレジストラーと類似した登録日 → 関連するインフラである可能性が高いです
    • 複数の C2 ドメインをホストする IP → インフラクラスター
    • 証明書の SAN フィールド → 関連ドメインが明らかになります
  2. 脅威アクターグループにマッピングします。

    • MITRE ATT&CK グループ:https://attack.mitre.org/groups/
    • VirusTotal/OpenCTI のアクター追跡
    • Mandiant / CrowdStrike / SentinelOne の脅威インテリジェンスレポート
  3. 脅威評価を作成します。

    ## 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(Actor/Behavior/Location/Evidence)のベースラインを文書化します。
  • アイデンティティ中心のハンティング — Entra ID / Okta のログを対象に、あり得ない場所間の移動、不正な OAuth 同意の付与、MFA 疲労攻撃、トークンの窃取とリプレイ、リスクのあるサインインの相関分析を行います。
  • 環境寄生型の手法 — LOLBin/LOLBAS の使用状況をベースライン化し、静的なシグネチャではなく逸脱をハンティングします。
  • 検知のコード化 — ハンティングの発見事項を、テストデータとともにバージョン管理下の Sigma ルールとして表現し、検証済みのハンティングをスキル 12/15 の検知に昇格させます。
  • ハンティングの成熟度 — アドホック → データ駆動 → 自動化の段階を追跡し、スケジュールされた検知になったハンティングを記録します。

精度ルール: すべてのハンティングで、仮説、クエリ、結果(発見/未発見/結論不能)、対応方針(新規検知/アラート調整/クローズ)を提示します。

コメント