Analyzing PowerShell Empire Artifacts
Overview
PowerShell Empire is a post-exploitation framework consisting of listeners, stagers, and agents. Its artifacts leave detectable traces in Windows event logs, particularly PowerShell Script Block Logging (Event ID 4104) and Module Logging (Event ID 4103). This skill analyzes event logs for Empire's default launcher string (powershell -noP -sta -w 1 -enc), Base64 encoded payloads containing System.Net.WebClient and FromBase64String, known module invocations (Invoke-Mimikatz, Invoke-Kerberoast, Invoke-TokenManipulation), and staging URL patterns.
When to Use
- When investigating security incidents that require analyzing powershell empire artifacts
- 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
Detection Gaps & Validation
- Logging downgrade is the #1 evasion. Empire can run under PowerShell v2 (
powershell -version 2), which never emits Script Block Logging (4104). Hunt EID 400/600 engine-start events showing EngineVersion=2.0 and the v2 downgrade itself, not just 4104.
- Reassemble before you match. Large payloads are split across multiple 4104 events (
MessageNumber/MessageTotal); regexing each fragment independently misses the Base64 blob and FromBase64String. Stitch fragments by ScriptBlockId first.
- Don't pin on default strings. The literal launcher
-noP -sta -w 1 -enc, the default URIs (/login/process.php, /admin/get.php), and stock user agents are all configurable in Empire 4.x / malleable profiles. Match on behavior (System.Net.WebClient + DownloadData + IEX) and AMSI-bypass patterns, not one fixed string.
- Coverage check: confirm 4104 (and ideally 4103 Module Logging) are enabled via GPO and that AMSI hasn't been patched in-process (
amsiInitFailed writes).
- Validate the rule fires: run a benign
powershell -enc <base64 of Write-Host hi> and confirm your pipeline captures the 4104 event and your decoder reconstructs the cleartext.
- Tune false positives: SCCM, Intune, and admin tooling legitimately use
-enc/-EncodedCommand. Allowlist by signing cert and known ScriptBlock hashes rather than suppressing -enc wholesale.
Prerequisites
- Python 3.9+ with access to Windows Event Log or exported EVTX files
- PowerShell Script Block Logging (Event ID 4104) enabled via Group Policy
- Module Logging (Event ID 4103) enabled for comprehensive coverage
Key Detection Patterns
- Default launcher —
powershell -noP -sta -w 1 -enc followed by Base64 blob
- Stager indicators —
System.Net.WebClient, DownloadData, DownloadString, FromBase64String
- Module signatures — Invoke-Mimikatz, Invoke-Kerberoast, Invoke-TokenManipulation, Invoke-PSInject, Invoke-DCOM
- User agent strings — default Empire user agents in HTTP listener configuration
- Staging URLs —
/login/process.php, /admin/get.php and similar default URI patterns
Output
JSON report with matched IOCs, decoded Base64 payloads, timeline of suspicious events, MITRE ATT&CK technique mappings, and severity scores.
1---2name: analyzing-powershell-empire-artifacts3description: Detect PowerShell Empire framework artifacts in Windows event logs by identifying Base64 encoded launcher patterns, default user agents, staging URL structures, stager IOCs, and known Empire module signatures in Script Block Logging events.4license: Apache-2.05---67# Analyzing PowerShell Empire Artifacts89## Overview1011PowerShell Empire is a post-exploitation framework consisting of listeners, stagers, and agents. Its artifacts leave detectable traces in Windows event logs, particularly PowerShell Script Block Logging (Event ID 4104) and Module Logging (Event ID 4103). This skill analyzes event logs for Empire's default launcher string (`powershell -noP -sta -w 1 -enc`), Base64 encoded payloads containing `System.Net.WebClient` and `FromBase64String`, known module invocations (Invoke-Mimikatz, Invoke-Kerberoast, Invoke-TokenManipulation), and staging URL patterns.121314## When to Use1516- When investigating security incidents that require analyzing powershell empire artifacts17- When building detection rules or threat hunting queries for this domain18- When SOC analysts need structured procedures for this analysis type19- When validating security monitoring coverage for related attack techniques2021## Detection Gaps & Validation2223- **Logging downgrade is the #1 evasion.** Empire can run under PowerShell v2 (`powershell -version 2`), which never emits Script Block Logging (4104). Hunt EID 400/600 engine-start events showing `EngineVersion=2.0` and the v2 downgrade itself, not just 4104.24- **Reassemble before you match.** Large payloads are split across multiple 4104 events (`MessageNumber`/`MessageTotal`); regexing each fragment independently misses the Base64 blob and `FromBase64String`. Stitch fragments by ScriptBlockId first.25- **Don't pin on default strings.** The literal launcher `-noP -sta -w 1 -enc`, the default URIs (`/login/process.php`, `/admin/get.php`), and stock user agents are all configurable in Empire 4.x / malleable profiles. Match on behavior (`System.Net.WebClient` + `DownloadData` + `IEX`) and AMSI-bypass patterns, not one fixed string.26- **Coverage check:** confirm 4104 (and ideally 4103 Module Logging) are enabled via GPO and that AMSI hasn't been patched in-process (`amsiInitFailed` writes).27- **Validate the rule fires:** run a benign `powershell -enc <base64 of Write-Host hi>` and confirm your pipeline captures the 4104 event and your decoder reconstructs the cleartext.28- **Tune false positives:** SCCM, Intune, and admin tooling legitimately use `-enc`/`-EncodedCommand`. Allowlist by signing cert and known ScriptBlock hashes rather than suppressing `-enc` wholesale.2930## Prerequisites3132- Python 3.9+ with access to Windows Event Log or exported EVTX files33- PowerShell Script Block Logging (Event ID 4104) enabled via Group Policy34- Module Logging (Event ID 4103) enabled for comprehensive coverage3536## Key Detection Patterns37381. **Default launcher** — `powershell -noP -sta -w 1 -enc` followed by Base64 blob392. **Stager indicators** — `System.Net.WebClient`, `DownloadData`, `DownloadString`, `FromBase64String`403. **Module signatures** — Invoke-Mimikatz, Invoke-Kerberoast, Invoke-TokenManipulation, Invoke-PSInject, Invoke-DCOM414. **User agent strings** — default Empire user agents in HTTP listener configuration425. **Staging URLs** — `/login/process.php`, `/admin/get.php` and similar default URI patterns4344## Output4546JSON report with matched IOCs, decoded Base64 payloads, timeline of suspicious events, MITRE ATT&CK technique mappings, and severity scores.