Detection rules › Splunk
Service Created containing Command Shell (Windows Event Log)
This use case detects when a service has been created (event 7045) containing PowerShell or cmd commands
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Execution | T1569.002 System Services: Service Execution |
References
Event coverage
| Provider | Event |
|---|---|
| Service-Control-Manager | Event ID 7045 |
Rule body yaml
id: '22357.39390'
title: Service Created containing Command Shell
description: 'This use case detects when a service has been created (event 7045) containing
PowerShell or cmd commands. -- Software Association: BlueSky'
logic_format: Splunk
logic: '`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=7045) OR
"<EventID>7045<") "powershell.exe" OR "pwsh.exe" OR "cmd.exe" | table _time, host,
user signature_id, member_nt_domain, user, dest_host | bin span=1s | stats values(*)
as * by _time, host '
techniques:
- execution:system services:service execution
technique_id:
- T1569.002
data_category:
- Windows event logs
references:
- https://thedfirreport.com/2021/11/01/from-zero-to-domain-admin/
Stages and Predicates
Stage 1: search
`get_endpoint_data` `get_endpoint_data_winevent` (TERM(EventCode=7045) OR "<EventID>7045<") "powershell.exe" OR "pwsh.exe" OR "cmd.exe"
Stage 2: table
| table _time, host, user signature_id, member_nt_domain, user, dest_host
Stage 3: bucket
| bin span=1s
Stage 4: stats
| stats values(*) as * by _time, host
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
EventCode | eq |
|
Search terms
Bare-string tokens in the SPL search body. Splunk matches each token against _raw (the untyped raw event text) anywhere it appears, not against a specific field. These don't surface in the Indicators table because they aren't predicates on a known field.
| Stage | Term |
|---|---|
| 1 | TERM |
| 1 | "<EventID>7045<" |
| 1 | "powershell.exe" |
| 1 | "pwsh.exe" |
| 1 | "cmd.exe" |