Detection: Excessive Usage Of SC Service Utility

Description

The following analytic detects excessive usage of the sc.exe service utility on a host machine. It uses distinct process GUIDs to count sc.exe executions in 15-minute windows and flags a window when its count is greater than five and at or above the host's average window count plus three standard deviations. This behavior can be associated with ransomware, cryptocurrency miners, and other malware attempting to create, modify, delete, or disable services, including security services. If confirmed malicious, this activity could allow attackers to manipulate critical services, leading to system compromise or disruption of security defenses.

 1
 2| tstats `security_content_summariesonly`
 3  count min(_time) AS firstTime
 4        max(_time) AS lastTime
 5        dc(Processes.process_guid) AS numScExe
 6        values(Processes.action) AS action
 7        values(Processes.original_file_name) AS original_file_name
 8        values(Processes.parent_process_exec) AS parent_process_exec
 9        values(Processes.parent_process_guid) AS parent_process_guid
10        values(Processes.parent_process_id) AS parent_process_id
11        values(Processes.parent_process_name) AS parent_process_name
12        values(Processes.parent_process_path) AS parent_process_path
13        values(Processes.parent_process) AS parent_process
14        values(Processes.process_exec) AS process_exec
15        values(Processes.process_guid) AS process_guid
16        values(Processes.process_hash) AS process_hash
17        values(Processes.process_id) AS process_id
18        values(Processes.process_integrity_level) AS process_integrity_level
19        values(Processes.process_name) AS process_name
20        values(Processes.process_path) AS process_path
21        values(Processes.process) AS process
22        values(Processes.user_id) AS user_id
23        values(Processes.user) AS user
24        values(Processes.vendor_product) AS vendor_product
25
26FROM datamodel=Endpoint.Processes WHERE
27
28Processes.process_name = "sc.exe"
29
30BY Processes.dest _time span=15m
31
32
33| `drop_dm_object_name(Processes)`
34
35
36| eventstats count AS numSlots
37             avg(numScExe) AS avgScExe
38             stdev(numScExe) AS stdScExe
39
40  BY dest
41
42
43| eval upperThreshold = avgScExe + (stdScExe * 3)
44
45
46| where numScExe > 5 AND numScExe >= upperThreshold
47
48
49| `security_content_ctime(firstTime)`
50
51| `security_content_ctime(lastTime)`
52
53| `excessive_usage_of_sc_service_utility_filter`

Data Source

Name Platform Sourcetype Source
Sysmon EventID 1 Windows icon Windows 'XmlWinEventLog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'

Macros Used

Name Value
security_content_summariesonly summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config``
excessive_usage_of_sc_service_utility_filter search *
excessive_usage_of_sc_service_utility_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1569.002 Service Execution Execution
Installation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) No
Creates Intermediate Finding (Risk Event) Yes
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.

Implementation

To successfully implement this search, ingest endpoint process creation events that include the process name, parent process, user, and command line, and map them to the Endpoint.Processes data model. If you are using Sysmon, use at least version 6.0.4 of the Sysmon TA. Tune known benign service management activity as needed.

Known False Positives

Legitimate software installation, endpoint management, service monitoring, or administrative scripts may execute sc.exe repeatedly in a short period. Review the command line, parent process, user, and service operations, and tune known benign management activity. The threshold is unstable when the search window contains little baseline history, ensure a sufficient history of 15-minute bins is available.

Associated Analytic Story

Intermediate Findings

Message Entity Field Entity Type Risk Score
[$numScExe$] executions of sc.exe were observed on [$dest$] by [$user$] in a 15-minute window, meeting or exceeding the host baseline threshold of [$upperThreshold$]. dest system 20

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

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: GitHub |

Version: 12