configuring-windows-event-logging-for-detection について
管理者やセキュリティチーム向けのWindowsイベントログ設定スキルです。高度な監査ポリシー、プロセスのコマンドライン記録、ログ容量、セキュリティ監視用の集中転送を扱います。
主な機能
- 01GPOによる高度な監査設定
- 02プロセス作成時のコマンドライン記録
- 03イベントログの容量と保持設定
- 04Windows Event Forwardingの構成
- 05主要なセキュリティイベントIDの活用
活用シーン
- 01Windowsのセキュリティ監査設定
- 02エンドポイントイベントの集中収集
- 03検知用ログのSIEM転送
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill configuring-windows-event-logging-for-detectionインストール後、Claude Code で/configuring-windows-event-logging-for-detectionを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py詳細
検知のための Windows イベントログの設定
使用するタイミング
次のような場合にこのスキルを使用します。
- セキュリティ監視のために Windows の詳細な監査ポリシーを設定する
- コマンドラインログを含むプロセス作成の監査(イベント 4688)を有効にする
- 認証監視のためにログオン/ログオフの監査を設定する
- イベントログの保存容量を決め、SIEM プラットフォームに転送する
Sysmon の設定(別のスキル)や Linux の監査ログには使用しないでください。
前提条件
- グループポリシーの管理権限がある Windows Server または Windows 10/11 システム
- グループポリシーオブジェクト(GPO)の作成権限がある Active Directory 環境
- Windows イベントログの転送を受信するように設定された SIEM プラットフォーム
- Windows のセキュリティイベント ID と監査カテゴリに関する理解
ワークフロー
ステップ 1:GPO で詳細な監査ポリシーを設定する
Computer Configuration → Windows Settings → Security Settings
→ Advanced Audit Policy Configuration → Audit Policies
Recommended settings:
Account Logon:
- Audit Credential Validation: Success, Failure
- Audit Kerberos Authentication: Success, Failure
Account Management:
- Audit Security Group Management: Success
- Audit User Account Management: Success, Failure
Logon/Logoff:
- Audit Logon: Success, Failure
- Audit Logoff: Success
- Audit Special Logon: Success
- Audit Other Logon/Logoff Events: Success, Failure
Object Access:
- Audit File Share: Success, Failure
- Audit Removable Storage: Success, Failure
- Audit SAM: Success
Policy Change:
- Audit Audit Policy Change: Success, Failure
- Audit Authentication Policy Change: Success
Privilege Use:
- Audit Sensitive Privilege Use: Success, Failure
Detailed Tracking:
- Audit Process Creation: Success
- Audit DPAPI Activity: Success, Failure
ステップ 2:プロセス作成イベントでコマンドラインを有効にする
# Registry: Enable command line logging in Event 4688
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit" `
-Name ProcessCreationIncludeCmdLine_Enabled -Value 1 -PropertyType DWORD -Force
# GPO: Computer Configuration → Administrative Templates → System → Audit Process Creation
# "Include command line in process creation events" → Enabled
ステップ 3:イベントログのサイズを設定する
# Increase Security log to 1 GB (default 20 MB is insufficient)
wevtutil sl Security /ms:1073741824
# Increase PowerShell Operational log
wevtutil sl "Microsoft-Windows-PowerShell/Operational" /ms:536870912
# Set log retention to overwrite as needed
wevtutil sl Security /rt:false
# Configure via GPO:
# Computer Configuration → Administrative Templates → Windows Components
# → Event Log Service → Security
# Maximum log file size (KB): 1048576
ステップ 4:Windows イベント転送(WEF)を設定する
# On collector server:
wecutil qc /q
# Create subscription for high-value events:
# Event IDs: 4624 (logon), 4625 (failed logon), 4688 (process create),
# 4672 (special privilege), 4720 (user created), 4728 (group membership),
# 7045 (service installed), 1102 (log cleared)
# On source endpoints (GPO):
# Configure WinRM: winrm quickconfig
# Configure event forwarding: Computer Configuration → Admin Templates
# → Windows Components → Event Forwarding
# Configure target Subscription Manager: Server=http://collector:5985/wsman/SubscriptionManager/WEC
ステップ 5:検知に重要なイベント ID
Authentication Events:
4624 - Successful logon (Type 2=Interactive, 3=Network, 10=RemoteInteractive)
4625 - Failed logon attempt
4648 - Logon using explicit credentials (RunAs, pass-the-hash indicator)
4672 - Special privileges assigned (admin logon)
4776 - NTLM credential validation
Process Events:
4688 - Process creation (with command line if enabled)
4689 - Process termination
Account Events:
4720 - User account created
4722 - User account enabled
4724 - Password reset attempted
4728 - Member added to security group
4732 - Member added to local group
4756 - Member added to universal group
Service/System Events:
7045 - New service installed (persistence indicator)
1102 - Audit log cleared (evidence tampering)
4697 - Service installed in the system
Lateral Movement Indicators:
4648 + 4624(Type 3) - Credential-based lateral movement
5140 - Network share accessed
5145 - Network share access check (detailed file share)
主な概念
| 用語 | 定義 |
|---|---|
| 詳細な監査ポリシー | 詳細な監査サブカテゴリ(基本カテゴリ 9 個に対し、サブカテゴリは 58 個) |
| イベント ID 4688 | プロセス作成イベント。エンドポイントでの実行を追跡するうえで不可欠です |
| WEF | Windows イベント転送。サードパーティ製エージェントを使わずにログを一元収集します |
| ログオンの種類 | 認証方法を示す数値コード(2=対話型、3=ネットワーク、10=RDP) |
ツールとシステム
- Windows イベント転送(WEF):組み込みの一元ログ収集機能
- NXLog:Windows イベント用のオープンソースログ転送エージェント
- Winlogbeat:Windows イベントログを Elasticsearch に送信する Elastic Agent
- Palantir WEF Configuration:オープンソースの WEF サブスクリプションテンプレート
よくある落とし穴
- 詳細な監査ポリシーではなく基本監査ポリシーを使用する:基本監査ポリシーと詳細な監査ポリシーは競合します。必ず詳細な監査ポリシーのみを使用してください。
- 既定のログサイズが小さすぎる:負荷の高いサーバーでは、20 MB のセキュリティログは数分でいっぱいになります。最低 1 GB に設定してください。
- コマンドラインログが有効になっていない:コマンドラインの内容を含まないイベント 4688 は、検知にほとんど役立ちません。必ず ProcessCreationIncludeCmdLine_Enabled を有効にしてください。
- ログを転送していない:ランサムウェアによってエンドポイントが消去されると、ローカルのイベントログは失われます。すぐに一元管理された SIEM に転送してください。
コメント
Markdown 対応