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.
Query · spl
| tstats `security_content_summariesonly`
count min(_time) AS firstTime
max(_time) AS lastTime
dc(Processes.process_guid) AS numScExe
values(Processes.action) AS action
values(Processes.original_file_name) AS original_file_name
values(Processes.parent_process_exec) AS parent_process_exec
values(Processes.parent_process_guid) AS parent_process_guid
values(Processes.parent_process_id) AS parent_process_id
values(Processes.parent_process_name) AS parent_process_name
values(Processes.parent_process_path) AS parent_process_path
values(Processes.parent_process) AS parent_process
values(Processes.process_exec) AS process_exec
values(Processes.process_guid) AS process_guid
values(Processes.process_hash) AS process_hash
values(Processes.process_id) AS process_id
values(Processes.process_integrity_level) AS process_integrity_level
values(Processes.process_name) AS process_name
values(Processes.process_path) AS process_path
values(Processes.process) AS process
values(Processes.user_id) AS user_id
values(Processes.user) AS user
values(Processes.vendor_product) AS vendor_product
FROM datamodel=Endpoint.Processes WHERE
Processes.process_name = "sc.exe"
BY Processes.dest _time span=15m
| `drop_dm_object_name(Processes)`
| eventstats count AS numSlots
avg(numScExe) AS avgScExe
stdev(numScExe) AS stdScExe
BY dest
| eval upperThreshold = avgScExe + (stdScExe * 3)
| where numScExe > 5 AND numScExe >= upperThreshold
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `excessive_usage_of_sc_service_utility_filter`
Implementation guide
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.
Analyst notes
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.