
PowerShell是Windows系统中常用的自动化与管理工具,也被攻击者频繁用于各类攻击活动。
由于PowerShell支持通过Base64编码方式执行命令,并允许使用如-EncodedCommand、-enc、-ec等多种参数变体,这一特性经常被利用于隐蔽执行恶意载荷,提高攻击的隐蔽性和灵活性。
因此检测PowerShell执行Base64编码命令的行为,有助于及时发现潜在攻击活动和威胁。
请编写检测规则,识别日志中所有通过PowerShell执行Base64编码命令的行为,需要检测各类参数的变体。
在编写检测语句时,请确保将
Computer字段包含在输出结果中,以便后续进行验证
数据源Sysmon,数据样例:
{ "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"}
没有找到匹配的字段