Malicious Powershell Executed As A Service
Description
This detection is to identify the abuse the Windows SC.exe to execute malicious commands or payloads via PowerShell.
- Type: TTP
-
Product: Splunk Enterprise, Splunk Enterprise Security, Splunk Cloud
- Last Updated: 2021-04-07
- Author: Ryan Becwar
- ID: 8e204dfd-cae0-4ea8-a61d-e972a1ff2ff8
Annotations
ATT&CK
Kill Chain Phase
- Installation
NIST
- DE.CM
CIS20
- CIS 10
CVE
Search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
`wineventlog_system` EventCode=7045
| eval l_Service_File_Name=lower(Service_File_Name)
| regex l_Service_File_Name="powershell[.\s]
|powershell_ise[.\s]
|pwsh[.\s]
|psexec[.\s]"
| regex l_Service_File_Name="-nop[rofile\s]+
|-w[indowstyle]*\s+hid[den]*
|-noe[xit\s]+
|-enc[odedcommand\s]+"
| stats count min(_time) as firstTime max(_time) as lastTime by EventCode Service_File_Name Service_Name Service_Start_Type Service_Type Service_Account user
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `malicious_powershell_executed_as_a_service_filter`
Macros
The SPL above uses the following Macros:
malicious_powershell_executed_as_a_service_filter is a empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Required fields
List of fields required to use this analytic.
- EventCode
- Service_File_Name
- Service_Type
- _time
- Service_Name
- Service_Start_Type
- Service_Account
- user
How To Implement
To successfully implement this search, you need to be ingesting Windows System logs with the Service name, Service File Name Service Start type, and Service Type from your endpoints.
Known False Positives
Creating a hidden powershell service is rare and could key off of those instances.
Associated Analytic Story
RBA
Risk Score | Impact | Confidence | Message |
---|---|---|---|
72.0 | 90 | 80 | Identifies the abuse the Windows SC.exe to execute malicious powerShell as a service $Service_File_Name$ by $user$ on $dest$ |
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.
Reference
- https://www.fireeye.com/content/dam/fireeye-www/blog/pdfs/dosfuscation-report.pdf
- http://az4n6.blogspot.com/2017/
- https://www.danielbohannon.com/blog-1/2017/3/12/powershell-execution-argument-obfuscation-how-it-can-make-detection-easier
Test Dataset
Replay any dataset to Splunk Enterprise by using our replay.py
tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
source | version: 1