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 including certutil, regsvr32, mshta, and rundll32 via process telemetry, Sigma rules, and parent-child process analysis. Use when detecting living off the land binaries (lolbins/lolbas) abuse including certutil,.4license: Apache-2.05---678# Detecting Living Off the Land with LOLBAS910## Overview1112Living 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.131415## When to Use16**Trigger phrases:**17- "detecting living off the land with lolbas"18- "Detect Living Off the Land Binaries (LOLBins/LOLBAS) abuse including certutil, r"192021- When investigating security incidents that require detecting living off the land with lolbas22- When building detection rules or threat hunting queries for this domain23- When SOC analysts need structured procedures for this analysis type24- When validating security monitoring coverage for related attack techniques252627## When NOT to Use2829- When you lack proper authorization for testing30- For production systems without change management31- When the task requires legal or compliance expertise beyond technical scope323334## Prerequisites3536- Sysmon or Windows Security Event Log (Event ID 4688) with command-line logging enabled37- Sigma rule conversion tool (sigmac or sigma-cli)38- SIEM platform (Splunk, Elastic, or similar) for log ingestion39- Python 3.8+ with pySigma library40- LOLBAS project reference database4142## Steps4344```python45# Example: IOC detection46import re4748IOC_PATTERNS = {49 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",50 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",51 "hash_md5": r"\b[a-f0-9]{32}\b",52 "hash_sha256": r"\b[a-f0-9]{64}\b",53}5455def extract_iocs(text: str) -> dict:56 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}57```58591. **Establish LOLBin Watchlist** — Build a prioritized list of monitored binaries (certutil, mshta, regsvr32, rundll32, msbuild, installutil, cmstp, wmic, bitsadmin)602. **Collect Process Telemetry** — Ingest Sysmon Event ID 1 (Process Create) and Windows 4688 events with full command-line capture613. **Build Sigma Detection Rules** — Create Sigma rules matching suspicious command-line arguments, network activity, and parent-child process anomalies for each LOLBin624. **Analyze Parent-Child Relationships** — Flag unexpected parent processes spawning LOLBins (e.g., Excel spawning certutil, Word spawning mshta)635. **Score and Prioritize Alerts** — Apply risk scoring based on argument anomaly, parent process, execution path, and network indicators646. **Generate Detection Report** — Produce a structured report of all LOLBin abuse detections with MITRE ATT&CK mapping6566## Expected Output6768- JSON report listing detected LOLBin abuse events with severity scores69- MITRE ATT&CK technique mapping for each detection (T1218, T1105, T1140, T1127)70- Parent-child process anomaly analysis71- Sigma rule match details with raw event data72## Red Flags7374- Performing actions without explicit written authorization from the asset owner75- Testing against production systems without a defined scope and rules of engagement76- Sharing sensitive findings or credentials in unencrypted communications77- Failing to properly scope and contain the assessment before starting7879## Process80811. **Reconnaissance** — Gather target information, identify attack surface, enumerate services821. **Analysis/Exploitation** — Execute the technique, analyze results, document findings831. **Reporting** — Document IOCs, write findings, provide remediation recommendations8485## Verification8687- All steps executed successfully against a test environment before production use88- Output documented with screenshots or logs demonstrating expected behavior89- Results validated against known-good baselines or reference implementations90- Documentation complete enough for another analyst to reproduce findings9192## Anti-Rationalization Table9394| Rationalization | Reality |95|---|---|96| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |97| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |98| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |