performing-threat-hunting-with-elastic-siem について
Elastic SIEMを使うSOCチーム向けの脅威ハンティングスキルです。仮説に基づくテレメトリ検索、イベント調査、検出ルール化の手順を示します。
主な機能
- 01仮説に基づくハントの計画
- 02KQLによるテレメトリ検索
- 03EQLによるイベント系列の検出
- 04Timelineでの共同調査
- 05調査結果の検出ルール化
- 06結果の集計とレポート記録
活用シーン
- 01脅威インテリジェンスのTTP検証
- 02LOLBin悪用や横方向移動の調査
- 03イベント系列の分析とホスト特定
- 04調査結果の検出カバレッジへの反映
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill performing-threat-hunting-with-elastic-siemインストール後、Claude Code で/performing-threat-hunting-with-elastic-siemを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEreferences/api-reference.mdscripts/agent.py詳細
Elastic SIEM を使用した脅威ハンティング
使用するタイミング
次の場合にこのスキルを使用します。
- SOC チームが、既存の検知ルールでは検出されない脅威をプロアクティブに検索する必要がある
- 脅威インテリジェンスレポートで、新しい TTP が説明されており、過去のデータに照らした検証が必要である
- レッドチーム演習で検知のギャップが明らかになり、ハンティングクエリの作成が必要である
- 定期的なハンティングの実施に、仮説に基づく体系的な調査が必要である
リアルタイムのアラートトリアージには使用しないでください。この作業は、自動検知ルールが適用される Elastic Security の Alerts キューで行います。
前提条件
- Kibana で Security アプリが有効になっている Elastic Security 8.x 以降
- Elastic Agent(Endpoint Security インテグレーション)または Beats(Winlogbeat、Filebeat、Packetbeat)によるデータ取り込み
- Elastic Common Schema(ECS)のフィールドマッピングに正規化されたデータ
- 関連するインデックスへの
kibana_security_solutionおよびreadアクセス権を持つユーザーロール - 仮説の作成に必要な MITRE ATT&CK フレームワークの知識
ワークフロー
ステップ 1:ハンティングの仮説を立てる
脅威インテリジェンス、ATT&CK のテクニック、または異常に基づいて仮説を立てます。
仮説の例:「攻撃者は実行に環境寄生型バイナリ(LOLBins)を使用しており、特にファイルのダウンロードには certutil.exe を使用している(T1105 — イングレス・ツール転送)。」
対象範囲を定義します。
- データソース:
logs-endpoint.events.process-*、logs-windows.sysmon_operational-* - 期間:過去 30 日間
- 予想される指標:
-urlcache、-split、または-decodeフラグを指定した certutil.exe
ステップ 2:Discover で KQL を使用してハンティングする
Kibana Discover を開き、KQL(Kibana Query Language)でクエリを実行します。
process.name: "certutil.exe" and process.args: ("-urlcache" or "-split" or "-decode" or "-encode" or "-verifyctl")
既知の正当な使用を除外するよう絞り込みます。
process.name: "certutil.exe"
and process.args: ("-urlcache" or "-split" or "-decode")
and not process.parent.name: ("sccm*.exe" or "ccmexec.exe")
and not user.name: "SYSTEM"
エンコードされたコマンドを使う PowerShell のハンティングの場合(T1059.001):
process.name: "powershell.exe"
and process.args: ("-enc" or "-encodedcommand" or "-e " or "frombase64string" or "iex" or "invoke-expression")
and not process.parent.executable: "C:\\Windows\\System32\\svchost.exe"
ステップ 3:EQL でシーケンスを検出する
Elastic Event Query Language(EQL)を使用すると、複数段階の攻撃シーケンスをハンティングできます。
親プロセスと子プロセスの異常を検出する(T1055 — プロセスインジェクション):
sequence by host.name with maxspan=5m
[process where event.type == "start" and process.name == "explorer.exe"]
[process where event.type == "start" and process.parent.name == "explorer.exe"
and process.name in ("cmd.exe", "powershell.exe", "rundll32.exe", "regsvr32.exe")]
認証情報ダンプのシーケンスを検出する(T1003):
sequence by host.name with maxspan=2m
[process where event.type == "start"
and process.name in ("procdump.exe", "procdump64.exe", "rundll32.exe", "taskmgr.exe")
and process.args : "*lsass*"]
[file where event.type == "creation"
and file.extension in ("dmp", "dump", "bin")]
PsExec によるラテラルムーブメントを検出する(T1021.002):
sequence by source.ip with maxspan=1m
[authentication where event.outcome == "success" and winlog.logon.type == "Network"]
[process where event.type == "start"
and process.name == "psexesvc.exe"]
ステップ 4:Elastic Security Timeline で調査する
共同分析のために、Elastic Security で Timeline の調査を作成します。
- Security > Timelines > Create new timeline に移動します
- Discover で「Add to timeline」を使用し、ハンティングクエリのイベントを追加します
- 重要なイベントをピン留めし、調査メモを追加します
- Timeline のクエリバーで追加のフィルタリングを行います。
host.name: "WORKSTATION-042" and event.category: ("process" or "network" or "file")
主要フィールドの列を追加します:@timestamp、event.action、process.name、process.args、user.name、source.ip、destination.ip
ステップ 5:調査結果から検知ルールを作成する
成功したハンティングクエリを Elastic の検知ルールに変換します。
{
"name": "Certutil Download Activity",
"description": "Detects certutil.exe used for file download, a common LOLBin technique",
"risk_score": 73,
"severity": "high",
"type": "eql",
"query": "process where event.type == \"start\" and process.name == \"certutil.exe\" and process.args : (\"-urlcache\", \"-split\", \"-decode\") and not process.parent.name : (\"ccmexec.exe\", \"sccm*.exe\")",
"threat": [
{
"framework": "MITRE ATT&CK",
"tactic": {
"id": "TA0011",
"name": "Command and Control"
},
"technique": [
{
"id": "T1105",
"name": "Ingress Tool Transfer"
}
]
}
],
"tags": ["Hunting", "LOLBins", "T1105"],
"interval": "5m",
"from": "now-6m",
"enabled": true
}
Elastic Security API を使用してデプロイします。
curl -X POST "https://kibana:5601/api/detection_engine/rules" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey YOUR_API_KEY" \
-d @certutil_rule.json
ステップ 6:調査結果を集計して可視化する
集計を使用してハンティングダッシュボードを作成します。
GET logs-endpoint.events.process-*/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{"term": {"process.name": "certutil.exe"}},
{"range": {"@timestamp": {"gte": "now-30d"}}}
]
}
},
"aggs": {
"by_host": {
"terms": {"field": "host.name", "size": 20},
"aggs": {
"by_user": {
"terms": {"field": "user.name", "size": 10}
},
"by_args": {
"terms": {"field": "process.args", "size": 10}
}
}
}
}
}
ステップ 7:ハンティングを記録し、フィードバックループを完了する
構造化されたハントレポートに調査結果を記録し、検知範囲を更新します。
- 仮説が検証されたか、否定されたか
- 発見された IOC と影響を受けたホスト
- 作成または更新された検知ルール
- 新たな検知範囲を反映して更新された ATT&CK Navigator レイヤー
- セキュリティコントロールの改善に関する推奨事項
主要な概念
| 用語 | 定義 |
|---|---|
| KQL | Kibana Query Language — Kibana Discover やダッシュボードでデータをフィルタリングするための簡易クエリ構文 |
| EQL | Event Query Language — 複数段階の攻撃パターンを検出するための、シーケンスを認識する Elastic のクエリ言語 |
| ECS | Elastic Common Schema — 複数のソース間で相関分析を可能にする、標準化されたフィールド命名規則 |
| Timeline | イベントの共同分析と注釈付けに使用する Elastic Security の調査ワークスペース |
| 仮説に基づくハンティング | 攻撃者の行動に関する仮説から始め、テレメトリデータに照らして検証する体系的なアプローチ |
| LOLBins | 環境寄生型バイナリ — 攻撃者に悪用される正規の Windows ツール(certutil、mshta、rundll32) |
ツールとシステム
- Elastic Security:検知ルール、タイムライン、ケース管理機能を備えた、Elasticsearch ベースの SIEM プラットフォーム
- Elastic Agent:エンドポイントとネットワークのテレメトリを収集する、Beats に代わる統合データ収集エージェント
- Elastic Endpoint Security:プロセス、ファイル、ネットワークの監視機能を Elastic Agent に統合した EDR
- ATT&CK Navigator:ATT&CK マトリックス全体の検知とハンティングのカバレッジを追跡する MITRE のツール
よくあるシナリオ
- LOLBin の悪用:不審な引数を伴う mshta.exe、regsvr32.exe、rundll32.exe、certutil.exe をハンティングします
- 永続化の仕組み:スケジュールされたタスクの作成、レジストリの Run キーの変更、WMI サブスクリプションをクエリします
- C2 ビーコニング:一定間隔で発生する定期的な外向き接続がないか、ネットワークフローデータを分析します
- データのステージング:大容量ファイルの圧縮(7z、rar、zip)後に発生する外向き転送をハンティングします
- アカウントの操作:非管理者ユーザーによる net.exe でのユーザー作成、グループメンバーシップの変更、パスワードのリセットを検索します
出力形式
THREAT HUNT REPORT — TH-2024-012
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Hypothesis: Attackers using certutil.exe for tool download (T1105)
Period: 2024-02-15 to 2024-03-15
Data Sources: Elastic Endpoint (process events), Sysmon
Findings:
Total certutil executions: 342
With -urlcache flag: 12 (3.5%)
Suspicious (non-SCCM): 3 confirmed anomalous
Affected Hosts:
WORKSTATION-042 (Finance) — certutil downloading payload.exe from external IP
SERVER-DB-03 (Database) — certutil decoding base64 encoded binary
LAPTOP-EXEC-07 (Executive) — certutil downloading script from Pastebin
Actions Taken:
[DONE] 3 hosts isolated for forensic investigation
[DONE] Detection rule "Certutil Download Activity" deployed (ID: elastic-th012)
[DONE] ATT&CK Navigator updated: T1105 coverage = GREEN
Verdict: HYPOTHESIS CONFIRMED — 3 true positive findings escalated to IR