Detecting Living Off the Land with LOLBAS
Overview
Living Off the Land Binaries, Scripts, and Libraries (LOLBAS) are legitimate system utilities abused by attackers to execute malicious actions while evading detection. This skill covers detecting abuse of certutil.exe, regsvr32.exe, mshta.exe, rundll32.exe, msbuild.exe, and other LOLBins using process telemetry from Sysmon and Windows Event Logs, combined with Sigma rule-based detection.
When to Use
Trigger phrases:
"detecting living off the land with lolbas"
"Detect Living Off the Land Binaries (LOLBins/LOLBAS) abuse including certutil, r"
When investigating security incidents that require detecting living off the land with lolbas
When building detection rules or threat hunting queries for this domain
When SOC analysts need structured procedures for this analysis type
When validating security monitoring coverage for related attack techniques
When NOT to Use
- When you lack proper authorization for testing
- For production systems without change management
- When the task requires legal or compliance expertise beyond technical scope
Prerequisites
- Sysmon or Windows Security Event Log (Event ID 4688) with command-line logging enabled
- Sigma rule conversion tool (sigmac or sigma-cli)
- SIEM platform (Splunk, Elastic, or similar) for log ingestion
- Python 3.8+ with pySigma library
- LOLBAS project reference database
Steps
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Establish LOLBin Watchlist — Build a prioritized list of monitored binaries (certutil, mshta, regsvr32, rundll32, msbuild, installutil, cmstp, wmic, bitsadmin)
- Collect Process Telemetry — Ingest Sysmon Event ID 1 (Process Create) and Windows 4688 events with full command-line capture
- Build Sigma Detection Rules — Create Sigma rules matching suspicious command-line arguments, network activity, and parent-child process anomalies for each LOLBin
- Analyze Parent-Child Relationships — Flag unexpected parent processes spawning LOLBins (e.g., Excel spawning certutil, Word spawning mshta)
- Score and Prioritize Alerts — Apply risk scoring based on argument anomaly, parent process, execution path, and network indicators
- Generate Detection Report — Produce a structured report of all LOLBin abuse detections with MITRE ATT&CK mapping
Expected Output
- JSON report listing detected LOLBin abuse events with severity scores
- MITRE ATT&CK technique mapping for each detection (T1218, T1105, T1140, T1127)
- Parent-child process anomaly analysis
- Sigma rule match details with raw event data
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Sharing sensitive findings or credentials in unencrypted communications
- Failing to properly scope and contain the assessment before starting
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- Results validated against known-good baselines or reference implementations
- Documentation complete enough for another analyst to reproduce findings
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: detecting-living-off-the-land-with-lolbas3description: Use when detect Living Off the Land Binaries (LOLBins/LOLBAS) abuse including4 certutil, regsvr32, mshta, and rundll32 via process telemetry, Sigma rules, and5 parent-child process analysis. Use when detecting living off the land binaries (lolbins/lolbas)6 abuse including certutil,.7domain: cybersecurity8subdomain: threat-detection9tags:10- lolbas11- lolbins12- sigma-rules13- process-monitoring14- sysmon15- endpoint-detection16- threat-hunting17version: '1.0'18author: oyi7719license: Apache-2.020d3fend_techniques:21- Executable Denylisting22- Execution Isolation23- File Metadata Consistency Validation24- Application Protocol Command Analysis25- Content Format Conversion26nist_csf:27- DE.CM-0128- DE.AE-0229- DE.AE-0630- ID.RA-0531category: cybersecurity32metadata:33 source: https://skillmd.com/skills/oyi77/detecting-living-off-the-land-with-lolbas34---353637# Detecting Living Off the Land with LOLBAS3839## Overview4041Living Off the Land Binaries, Scripts, and Libraries (LOLBAS) are legitimate system utilities abused by attackers to execute malicious actions while evading detection. This skill covers detecting abuse of certutil.exe, regsvr32.exe, mshta.exe, rundll32.exe, msbuild.exe, and other LOLBins using process telemetry from Sysmon and Windows Event Logs, combined with Sigma rule-based detection.424344## When to Use45**Trigger phrases:**46- "detecting living off the land with lolbas"47- "Detect Living Off the Land Binaries (LOLBins/LOLBAS) abuse including certutil, r"484950- When investigating security incidents that require detecting living off the land with lolbas51- When building detection rules or threat hunting queries for this domain52- When SOC analysts need structured procedures for this analysis type53- When validating security monitoring coverage for related attack techniques545556## When NOT to Use5758- When you lack proper authorization for testing59- For production systems without change management60- When the task requires legal or compliance expertise beyond technical scope616263## Prerequisites6465- Sysmon or Windows Security Event Log (Event ID 4688) with command-line logging enabled66- Sigma rule conversion tool (sigmac or sigma-cli)67- SIEM platform (Splunk, Elastic, or similar) for log ingestion68- Python 3.8+ with pySigma library69- LOLBAS project reference database7071## Steps7273```python74# Example: IOC detection75import re7677IOC_PATTERNS = {78 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",79 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",80 "hash_md5": r"\b[a-f0-9]{32}\b",81 "hash_sha256": r"\b[a-f0-9]{64}\b",82}8384def extract_iocs(text: str) -> dict:85 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}86```87881. **Establish LOLBin Watchlist** — Build a prioritized list of monitored binaries (certutil, mshta, regsvr32, rundll32, msbuild, installutil, cmstp, wmic, bitsadmin)892. **Collect Process Telemetry** — Ingest Sysmon Event ID 1 (Process Create) and Windows 4688 events with full command-line capture903. **Build Sigma Detection Rules** — Create Sigma rules matching suspicious command-line arguments, network activity, and parent-child process anomalies for each LOLBin914. **Analyze Parent-Child Relationships** — Flag unexpected parent processes spawning LOLBins (e.g., Excel spawning certutil, Word spawning mshta)925. **Score and Prioritize Alerts** — Apply risk scoring based on argument anomaly, parent process, execution path, and network indicators936. **Generate Detection Report** — Produce a structured report of all LOLBin abuse detections with MITRE ATT&CK mapping9495## Expected Output9697- JSON report listing detected LOLBin abuse events with severity scores98- MITRE ATT&CK technique mapping for each detection (T1218, T1105, T1140, T1127)99- Parent-child process anomaly analysis100- Sigma rule match details with raw event data101## Red Flags102103- Performing actions without explicit written authorization from the asset owner104- Testing against production systems without a defined scope and rules of engagement105- Sharing sensitive findings or credentials in unencrypted communications106- Failing to properly scope and contain the assessment before starting107108## Process1091101. **Reconnaissance** — Gather target information, identify attack surface, enumerate services1111. **Analysis/Exploitation** — Execute the technique, analyze results, document findings1121. **Reporting** — Document IOCs, write findings, provide remediation recommendations113114## Verification115116- All steps executed successfully against a test environment before production use117- Output documented with screenshots or logs demonstrating expected behavior118- Results validated against known-good baselines or reference implementations119- Documentation complete enough for another analyst to reproduce findings120121## Anti-Rationalization Table122123| Rationalization | Reality |124|---|---|125| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |126| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |127| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |