mcpField
A
analyzing-windows-event-logs-in-splunk

analyzing-windows-event-logs-in-splunk

github.com/mukul975セキュリティ35.2k243 回インストール8 週間前に更新
リポジトリ

analyzing-windows-event-logs-in-splunk について

このスキルは、WindowsイベントログをSplunk SPLで分析する手順とクエリ例を、SOCアナリスト、検知エンジニア、インシデント対応担当者向けに示します。認証、権限昇格、永続化、横展開の検知とフォレンジックタイムラインを扱います。

主な機能

  1. 01ブルートフォースとパスワードスプレーの検知
  2. 02権限昇格と永続化の特定
  3. 03横展開の兆候の分析
  4. 04ホストのフォレンジックタイムライン作成
  5. 05ルックアップテーブルによるイベント情報の補完

活用シーン

  1. 01Windows認証アラートの調査
  2. 02Windows脅威検知クエリの作成
  3. 03侵害されたホストの活動の再構成
  4. 04Windows ATT&CK手法のハンティング

インストール

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

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-windows-event-logs-in-splunk

インストール後、Claude Code で/analyzing-windows-event-logs-in-splunkを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

Splunk での Windows イベントログの分析

使用する場面

次の場合にこのスキルを使用します:

  • SOC アナリストが、Windows 認証、プロセス実行、または AD の変更に関連するアラートを調査する場合
  • 検知エンジニアが、Windows ベースの脅威検知に使用する SPL クエリを作成する場合
  • インシデント対応担当者が、Windows エンドポイントまたはドメインコントローラーのアクティビティに関するフォレンジックタイムラインを必要とする場合
  • 定期的な脅威ハンティングで、Windows 固有の ATT&CK テクニックを対象とする場合

Linux/macOS エンドポイントの分析や、ネットワークのみを対象とする調査には使用しないでください。

前提条件

  • Windows イベントログデータが取り込まれている Splunk(sourcetype WinEventLog:Security、WinEventLog:System、XmlWinEventLog:Microsoft-Windows-Sysmon/Operational)
  • SwiftOnSecurity または Olaf Hartong の設定でエンドポイントに導入された Sysmon
  • Endpoint および Authentication データモデルの CIM データモデルアクセラレーション
  • Windows セキュリティイベント ID と Sysmon イベントタイプに関する知識

ワークフロー

ステップ 1:認証攻撃の検知

ブルートフォース攻撃の検知(EventCode 4625 — ログオン失敗):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625
| stats count, dc(TargetUserName) AS unique_users, values(TargetUserName) AS targeted_users
  by src_ip, Logon_Type, Status
| where count > 20
| eval attack_type = case(
    Logon_Type=3, "Network Brute Force",
    Logon_Type=10, "RDP Brute Force",
    Logon_Type=2, "Interactive Brute Force",
    1=1, "Other"
  )
| eval status_meaning = case(
    Status="0xc000006d", "Bad Username or Password",
    Status="0xc000006a", "Incorrect Password (valid user)",
    Status="0xc0000234", "Account Locked Out",
    Status="0xc0000072", "Account Disabled",
    1=1, Status
  )
| sort - count
| table src_ip, attack_type, status_meaning, count, unique_users, targeted_users

パスワードスプレー攻撃の検知:

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625 Logon_Type=3
| bin _time span=10m
| stats dc(TargetUserName) AS unique_users, count AS total_attempts,
  values(TargetUserName) AS users_targeted by src_ip, _time
| where unique_users > 10 AND total_attempts < unique_users * 3
| eval spray_confidence = if(unique_users > 25, "HIGH", "MEDIUM")

失敗後のログオン成功(侵害の兆候):

index=wineventlog sourcetype="WinEventLog:Security"
(EventCode=4625 OR EventCode=4624) src_ip!="127.0.0.1"
| sort _time
| stats earliest(_time) AS first_seen, latest(_time) AS last_seen,
  sum(eval(if(EventCode=4625,1,0))) AS failures,
  sum(eval(if(EventCode=4624,1,0))) AS successes
  by src_ip, TargetUserName, ComputerName
| where failures > 10 AND successes > 0
| eval time_to_success = round((last_seen - first_seen)/60, 1)
| sort - failures
ステップ 2:権限昇格の検知

新しい管理者アカウントの作成(T1136.001):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4720
| join TargetUserName type=left [
    search index=wineventlog EventCode=4732 TargetUserName="Administrators"
    | rename MemberName AS TargetUserName
  ]
| table _time, SubjectUserName, TargetUserName, ComputerName
| eval alert = "New account created and added to Administrators group"

特殊な権限の割り当て(EventCode 4672):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4672
SubjectUserName!="SYSTEM" SubjectUserName!="LOCAL SERVICE" SubjectUserName!="NETWORK SERVICE"
| stats count, values(PrivilegeList) AS privileges by SubjectUserName, ComputerName
| where count > 0
| search privileges IN ("SeDebugPrivilege", "SeTcbPrivilege", "SeBackupPrivilege",
  "SeRestorePrivilege", "SeAssignPrimaryTokenPrivilege")

トークン操作の検知(T1134):

index=sysmon EventCode=10 TargetImage="*\\lsass.exe"
GrantedAccess IN ("0x1010", "0x1038", "0x1fffff", "0x40")
| stats count by SourceImage, SourceUser, Computer, GrantedAccess
| where NOT match(SourceImage, "(svchost|csrss|wininit|MsMpEng|CrowdStrike)")
| sort - count
ステップ 3:永続化メカニズムの検知

スケジュールされたタスクの作成(T1053.005):

index=wineventlog (sourcetype="WinEventLog:Security" EventCode=4698)
  OR (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
      Image="*\\schtasks.exe")
| eval task_info = coalesce(TaskContent, CommandLine)
| search task_info="*powershell*" OR task_info="*cmd*" OR task_info="*http*" OR task_info="*\\Temp\\*"
| table _time, Computer, SubjectUserName, TaskName, task_info

レジストリ Run キーの変更(T1547.001):

index=sysmon EventCode=13
TargetObject IN (
  "*\\CurrentVersion\\Run\\*",
  "*\\CurrentVersion\\RunOnce\\*",
  "*\\CurrentVersion\\RunServices\\*",
  "*\\Explorer\\Shell Folders\\*"
)
| stats count by Computer, Image, TargetObject, Details
| where NOT match(Image, "(explorer\.exe|msiexec\.exe|setup\.exe)")
| sort - count

WMI イベントサブスクリプション(T1546.003):

index=sysmon EventCode=20 OR EventCode=21
| stats count by Computer, Operation, Consumer, EventNamespace
| where count > 0
ステップ 4:ラテラルムーブメントの検知

リモートサービスの悪用(T1021.002 — SMB/Windows 管理共有):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=3
| stats dc(ComputerName) AS unique_destinations, values(ComputerName) AS targets
  by src_ip, TargetUserName
| where unique_destinations > 3
| sort - unique_destinations
| table src_ip, TargetUserName, unique_destinations, targets

PsExec の検知(T1021.002):

index=sysmon EventCode=1
(Image="*\\psexec.exe" OR Image="*\\psexesvc.exe"
 OR ParentImage="*\\psexesvc.exe"
 OR OriginalFileName="psexec.c")
| table _time, Computer, User, ParentImage, Image, CommandLine

RDP によるラテラルムーブメント(T1021.001):

index=wineventlog sourcetype="WinEventLog:Security" EventCode=4624 Logon_Type=10
| stats count, dc(ComputerName) AS rdp_targets, values(ComputerName) AS destinations
  by src_ip, TargetUserName
| where rdp_targets > 2
| sort - rdp_targets
ステップ 5:フォレンジックタイムラインの作成

侵害されたホストの包括的なタイムラインを作成します:

(index=wineventlog OR index=sysmon) Computer="WORKSTATION-042"
earliest="2024-03-14T00:00:00" latest="2024-03-16T00:00:00"
| eval event_description = case(
    EventCode=4624, "Logon: ".TargetUserName." (Type ".Logon_Type.")",
    EventCode=4625, "Failed Logon: ".TargetUserName,
    EventCode=4688 OR (sourcetype="XmlWinEventLog:*Sysmon*" AND EventCode=1),
      "Process: ".Image." CMD: ".CommandLine,
    EventCode=4698, "Scheduled Task: ".TaskName,
    EventCode=3, "Network: ".DestinationIp.":".DestinationPort,
    EventCode=11, "File Created: ".TargetFilename,
    EventCode=13, "Registry: ".TargetObject,
    1=1, "Event ".EventCode
  )
| sort _time
| table _time, EventCode, event_description, User, src_ip
ステップ 6:エンリッチメント用のルックアップテーブルの作成

Windows イベント ID のコンテキストを参照するルックアップテーブルを作成します:

| inputlookup windows_eventcode_lookup.csv
| table EventCode, Description, ATT_CK_Technique, Severity

ルックアップが存在しない場合は、作成します:

EventCode,Description,ATT_CK_Technique,Severity
4624,Successful Logon,T1078,Informational
4625,Failed Logon,T1110,Low
4648,Explicit Credential Logon,T1078,Medium
4672,Special Privileges Assigned,T1134,Medium
4688,New Process Created,T1059,Informational
4698,Scheduled Task Created,T1053.005,Medium
4720,User Account Created,T1136.001,High
4732,Member Added to Security Group,T1098,High
4768,Kerberos TGT Requested,T1558,Informational
4769,Kerberos Service Ticket,T1558.003,Low
4771,Kerberos Pre-Auth Failed,T1110,Low

主な概念

用語定義
EventCode 4624ログオン成功イベント — Logon_Type 2(対話型)、3(ネットワーク)、10(RDP)、7(ロック解除)
EventCode 4625ログオン失敗イベント — ステータスコードは失敗の理由(パスワードの誤り、アカウントのロック、無効化)を示します
Sysmon EventCode 1完全なコマンドライン、親プロセス、ハッシュ情報を含むプロセス作成
Sysmon EventCode 3プロセスが開始したネットワーク接続 — 送信元/宛先 IP、ポート、プロセスのコンテキスト
Logon Type 3ネットワークログオン(SMB、WMI、PowerShell リモート処理) — ラテラルムーブメントの重要な兆候
Logon Type 10RDP/ターミナルサービスを介したリモート対話型ログオン

ツールとシステム

  • Splunk Enterprise:Windows イベントログの分析と相関に使用する SPL クエリエンジンを備えた SIEM プラットフォーム
  • Sysmon (System Monitor):詳細なプロセス、ネットワーク、ファイルのアクティビティログを提供する Microsoft Sysinternals ツール
  • Splunk CIM:Windows イベントを正規化されたフィールドにマッピングし、複数ソースにまたがるクエリを可能にする Common Information Model
  • Windows Event Forwarding (WEF):イベントログをコレクターサーバーに一元化する、Windows 組み込みのメカニズム

一般的なシナリオ

  • Kerberoasting (T1558.003):標準外のサービスアカウントについて、暗号化タイプが 0x17(RC4)の EventCode 4769 を検知します
  • DCSync (T1003.006):DC 以外のソースからの DS-Replication-Get-Changes を含む EventCode 4662 を検知します
  • Golden Ticket (T1558.001):異常なチケット属性(長い有効期間、標準外の暗号化)を持つ EventCode 4769 を検知します
  • Pass-the-Hash (T1550.002):予期しないソースからの NTLM 認証を伴う EventCode 4624 Logon_Type 3 を検知します
  • DLL Side-Loading (T1574.002):正規のプロセスによって読み込まれた未署名 DLL を示す Sysmon EventCode 7 を検知します

出力形式

WINDOWS EVENT LOG ANALYSIS — HOST: WORKSTATION-042
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Period:     2024-03-14 to 2024-03-15
Events:     12,847 total (Security: 9,231 | Sysmon: 3,616)

Authentication Summary:
  Successful Logons (4624):    487 (Type 3: 312, Type 10: 45, Type 2: 130)
  Failed Logons (4625):        847 (from 192.168.1.105 — BRUTE FORCE)
  Explicit Creds (4648):       12

Suspicious Findings:
  [HIGH]   847 failed logons followed by success at 14:35 from 192.168.1.105
  [HIGH]   New user "backdoor_admin" created (4720) at 14:38
  [HIGH]   User added to Administrators group (4732) at 14:38
  [MEDIUM] schtasks.exe creating persistence task at 14:42
  [MEDIUM] PowerShell encoded command execution at 14:45

ATT&CK Mapping:
  T1110.001 — Password Guessing (847 failed logons)
  T1136.001 — Local Account Creation (backdoor_admin)
  T1053.005 — Scheduled Task (persistence)
  T1059.001 — PowerShell (encoded execution)

コメント