• Home
  • Learn
  • DetectionHub
  • Ranking
  • About
  • Blog
  • Login
Medium·Updated on 2025-03-15

PowerShell Execution of Base64-Encoded Commands and Parameter Variants

1,234
Submissions
67.5%
Pass Rate
15 minutes
Estimated Time
Sysmon T1027

Description

PowerShell is a commonly used automation and management tool in Windows systems, and is frequently leveraged by attackers in various malicious activities.

Because PowerShell allows commands to be executed via Base64 encoding and supports multiple parameter variants such as -EncodedCommand, -enc, and -ec, attackers often exploit these features to covertly run malicious payloads, enhancing both stealth and flexibility.

Detecting PowerShell executions of Base64-encoded commands is therefore essential for identifying potential attacks and threats in a timely manner.

Challenge Objective

Write detection rules to identify all instances in logs where PowerShell executes Base64-encoded commands. Your detection should cover all relevant parameter variants.

When writing detection queries, ensure the Computer field is included in the output for further validation.

Data Sample

Data source: Sysmon; sample data:

{  "Channel": "Microsoft-Windows-Sysmon/Operational",  "CommandLine": "powershell.exe  -EncodedCommand ZQBjAGgAbwAgACIARABvAHIAbwB0AGgAeQAiAA==",  "Company": "Microsoft Corporation",  "Computer": "DESKTOP-EQTV9K3",  "CurrentDirectory": "C:\\Users\\admin\\",  "Description": "Windows PowerShell",  "EventId": 1,  "FileVersion": "10.0.19041.3996 (WinBuild.160101.0800)",  "Hashes": "MD5=2E5A8590CF6848968FC23DE3FA1E25F1,SHA256=9785001B0DCF755EDDB8AF294A373C0B87B2498660F724E76C4D53F9C217C7A3,IMPHASH=3D08F4848535206D772DE145804FF4B6",  "Image": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",  "IntegrityLevel": "Medium",  "LogonGuid": "{769c9af7-93bf-686f-d893-320400000000}",  "LogonId": "0x43293d8",  "OriginalFileName": "PowerShell.EXE",  "ParentCommandLine": "\"C:\\WINDOWS\\system32\\cmd.exe\" ",  "ParentImage": "C:\\Windows\\System32\\cmd.exe",  "ParentProcessGuid": "{769c9af7-038e-6877-6d1d-000000000a00}",  "ParentProcessId": "11848",  "ParentUser": "DESKTOP-EQTV9K3\\admin",  "ProcessGuid": "{769c9af7-0390-6877-731d-000000000a00}",  "ProcessId": "8992",  "Product": "Microsoft? Windows? Operating System",  "RuleName": "-",  "SystemTime": "2025-07-16T01:42:40.3722412Z",  "TerminalSessionId": "2",  "User": "DESKTOP-EQTV9K3\\admin",  "UtcTime": "2025-07-16 01:42:40.342"}

References

loading...

Fields

No fields found

0 fields selected

Preview Results