脅威ハンティング
脅威ハンティングは、既知の脅威指標(IOC)やシグネチャだけに頼らず、能動的にログを分析して潜在的な脅威を発見する活動です。 CSIRT-Pro は、保存済みクエリ、Sigma ルール連携、IOC 抽出機能によって脅威ハンティングを支援します。
保存済みクエリ
脅威ハンティングで繰り返し使用するクエリを保存し、チーム内で共有できます。
クエリの保存
- Search 画面でクエリを作成して実行
- 結果を確認して「保存」をクリック
- タイトルと説明を入力して保存
ハンティングクエリ例
ブルートフォース攻撃の検知
from `auth_logs`
filter action == "login_failed"
group {src_ip, user} (
aggregate {
failed_cnt = count this,
first_attempt = min __time,
last_attempt = max __time
}
)
filter failed_count > 10
sort {-failed_count}
異常な時間帯のアクセス
from `auth_logs`
filter action == "login_success"
derive {hour = to_start_of_hour __time}
filter hour >= @2025-01-15T22:00:00
filter hour < @2025-01-16T06:00:00
sort {-__time}
大量データ転送の検知
from `proxy_logs`
group {src_ip, dst_ip} (
aggregate {
total_bytes = sum bytes,
session_cnt = count this
}
)
filter total_bytes > 1073741824
sort {-total_bytes}
DNS トンネリングの疑い
from `dns_logs`
filter query_type == "TXT" || query_length > 50
group {src_ip, domain} (
aggregate {
query_cnt = count this,
avg_query_length = average query_length
}
)
filter query_cnt > 100
sort {-query_cnt}
横展開(Lateral Movement)の検知
from `auth_logs`
filter action == "login_success"
group {user} (
aggregate {
unique_hosts = count_distinct dst_host,
login_cnt = count this
}
)
filter unique_hosts > 5
sort {-unique_hosts}
PowerShell の不審な実行
from `windows_logs`
filter process_name == "powershell.exe"
filter command_line ~= "(?i)(encodedcommand|bypass|hidden|downloadstring|invoke-expression|iex)"
sort {-__time}
Sigma ルールの活用
Sigma は、SIEM に依存しないシグネチャ記述形式です。 CSIRT-Pro では、Sigma ルールを PRQL クエリに変換して脅威検知に活用できます。
Sigma ルールの基本構造
title: Suspicious PowerShell Download
status: stable
description: Detects PowerShell commands that download files from the internet
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith: '\powershell.exe'
CommandLine|contains:
- 'Invoke-WebRequest'
- 'wget'
- 'curl'
- 'DownloadFile'
- 'DownloadString'
condition: selection
level: high
tags:
- attack.execution
- attack.t1059.001
Sigma から PRQL への変換例
例 1: 不審な PowerShell ダウンロード
Sigma ルール:
title: Suspicious PowerShell Download
logsource:
category: process_creation
product: windows
detection:
selection:
Image|endswith: '\powershell.exe'
CommandLine|contains:
- 'Invoke-WebRequest'
- 'DownloadFile'
- 'DownloadString'
condition: selection
level: high
PRQL クエリ:
from `windows_logs`
filter process_name ~= "powershell\\.exe$"
filter (command_line ~= "Invoke-WebRequest" || command_line ~= "DownloadFile" || command_line ~= "DownloadString")
sort {-__time}
例 2: LSASS メモリダンプ
Sigma ルール:
title: LSASS Memory Dump
logsource:
category: process_access
product: windows
detection:
selection:
TargetImage|endswith: '\lsass.exe'
GrantedAccess|contains:
- '0x1010'
- '0x1038'
condition: selection
level: critical
PRQL クエリ:
from `windows_logs`
filter target_process ~= "lsass\\.exe$"
filter (granted_access ~= "0x1010" || granted_access ~= "0x1038")
sort {-__time}
例 3: 不審なスケジュールタスク作成
Sigma ルール:
title: Suspicious Scheduled Task Creation
logsource:
product: windows
service: security
detection:
selection:
EventID: 4698
filter:
TaskName|contains:
- '\Microsoft\Windows\'
condition: selection and not filter
level: medium
PRQL クエリ:
from `windows_logs`
filter event_id == 4698
filter !(task_name ~= "\\\\Microsoft\\\\Windows\\\\")
sort {-__time}
例 4: SSH ブルートフォース
Sigma ルール:
title: SSH Brute Force Attempt
logsource:
product: linux
service: sshd
detection:
selection:
message|contains: 'Failed password'
condition: selection | count(src_ip) by src_ip > 10
timeframe: 5m
level: high
PRQL クエリ:
from `syslog_logs`
filter message ~= "Failed password"
filter __time > @2025-01-15T10:00:00
group {src_ip} (
aggregate {
failed_cnt = count this,
first_attempt = min __time,
last_attempt = max __time
}
)
filter failed_count > 10
sort {-failed_count}
Sigma ルール変換のポイント
| Sigma 修飾子 | PRQL での表現 | 説明 |
|---|---|---|
contains |
~= "keyword" |
部分一致(正規表現) |
endswith |
~= "keyword$" |
後方一致 |
startswith |
~= "^keyword" |
前方一致 |
re |
~= "regex" |
正規表現 |
all of selection* |
複数の filter を AND で連結 |
すべての条件に一致 |
1 of selection* |
filter (cond1 \|\| cond2) |
いずれかの条件に一致 |
not |
filter !(...) |
条件の否定 |
count() > N |
group + aggregate + filter cnt > N |
閾値ベースの検知 |
IOC 抽出
CSIRT-Pro は、ログやケースの内容から IOC(Indicator of Compromise)を抽出し、脅威インテリジェンスと照合できます。
抽出可能な IOC タイプ
| IOC タイプ | 説明 | 抽出パターン例 |
|---|---|---|
| IP アドレス | IPv4 / IPv6 アドレス | 192.168.1.100, 2001:db8::1 |
| ドメイン名 | FQDN | malicious-domain.example.com |
| URL | 完全な URL | https://evil.example.com/payload |
| ファイルハッシュ | MD5, SHA-1, SHA-256 | d41d8cd98f00b204e9800998ecf8427e |
| メールアドレス | メールアドレス | attacker@evil.example.com |
| CVE ID | 脆弱性識別子 | CVE-2024-12345 |
IOC を使ったハンティング
不審な IP アドレスの通信履歴
不審なドメインへのアクセス
from `dns_logs`
filter domain ~= "malicious-domain\\.example\\.com"
group {src_ip} (
aggregate {
query_cnt = count this,
first_seen = min __time,
last_seen = max __time
}
)
sort {-query_cnt}
ファイルハッシュの検索
from `endpoint_logs`
filter (file_hash == "d41d8cd98f00b204e9800998ecf8427e" || file_hash == "e3b0c44298fc1c149afbf4c8996fb924")
sort {-__time}
脅威インテリジェンスとの連携
CSIRT-Pro の脅威インテリジェンス機能と組み合わせることで、IOC の照合を効率化できます。
| 連携先 | 機能 | 用途 |
|---|---|---|
| CVE データベース | CVE ID で脆弱性情報を検索 | 既知の脆弱性の影響範囲を調査 |
| IOC 共有 | IOC の共有と照合 | コミュニティの脅威情報を活用 |
| 脅威情報フィード | 自動的に IOC を更新 | 最新の脅威指標でハンティング |
詳細は 脅威情報 を参照してください。
脅威ハンティングのワークフロー
効果的な脅威ハンティングのためのワークフローです。
1. 仮説の立案
脅威の仮説を立てます。 MITRE ATT&CK フレームワークや最新の脅威レポートを参考にします。
| 仮説例 | 対応する MITRE ATT&CK | ハンティング対象 |
|---|---|---|
| ブルートフォース攻撃 | T1110 | 認証ログの大量失敗 |
| データ持ち出し | T1048 | 異常なデータ転送量 |
| 横展開 | T1021 | 複数ホストへの認証成功 |
| 永続化 | T1053 | スケジュールタスクの新規作成 |
| C2 通信 | T1071 | DNS の異常パターン |
2. クエリの作成と実行
仮説に基づいて PRQL クエリを作成し、Search 画面で実行します。
3. 結果の分析
クエリ結果を分析し、不審なパターンを特定します。 可視化機能を使って、傾向やアノマリーを視覚的に確認します。
4. ケース化
不審なアクティビティを発見した場合、ケースとして登録します。
5. 自動化
繰り返し実行するハンティングクエリは、UEBA タスクまたは Playbook として自動化します。
ハンティングの自動化
手動ハンティングで有効性が確認されたクエリは、UEBA タスクとしてスケジュール登録することで、継続的な検知を自動化できます。 詳細は UEBA を参照してください。