EDR or “Endpoint Detection & Response” is a key element of many networks today. An agent is installed on all endpoints to track suspicious/malicious activity and (try to) block it. Behavioral monitoring is also a key element in modern SIEM infrastructure: To see a word.exe running is definitively not malicious, same with a Powershell script being launched. But if you monitor parent/child relations, to see a Powershell script launched from a Word process, that is suspicious! Here is a simple Sigma rule to detect this behavior:
title: Suspicious PowerShell Invocation Based on Parent Process id: 95eadcb2-92e4-4ed1-9031-92547773a6db status: test description: Detects suspicious powershell invocations from interpreters or unusual programs author: Florian Roth references: - https://www.carbonblack.com/2017/03/15/attackers-leverage-excel-powershell-dns-latest-non-malware-attack/ date: 2019/01/16 modified: 2022/01/07 logsource: category: process_creation product: windows detection: selection: ParentImage|endswith: - 'wscript.exe' - 'cscript.exe' - 'word.exe' - 'excel.exe' Image|endswith: 'powershell.exe' falsepositive: CurrentDirectory|contains: 'Health Service State' condition: selection and not falsepositive fields: - CommandLine - ParentCommandLine falsepositives: - Microsoft Operations Manager (MOM) - Other scripts level: medium tags: - attack.execution - attack.t1059.001
Note: I modified it to add “word.exe” and “excel.exe”.
When you implement this kind of rule in your SIEM, the next mandatory step is the fine-tuning process to reduce the unavoidable false positive alerts. Indeed, to increase the detection of suspicious Powershell invocations, it can be tempting to reduce the list of parent processes. The side effect is an increase in noise generated by the alert. For example, do you know that some Microsoft tools are able to launch Powershell script? ccm.exe is a good example.
I found an interesting project called “w*fbins”. Unlike “lolbas”, which lists official Microsoft tools that can be (ab)used by attackers to perform malicious actions, this project aims to list tools that could be flagged as malicious by rules like the one seen above but… they are not! At this time, the tools list remains small but I’m sure it will grow in the future.
Xavier Mertens (@xme)
Senior ISC Handler – Freelance Cyber Security Consultant
(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.