Excessive Usage Of SC Service Utility

 Original Source: [splunk source]
Name:Excessive Usage Of SC Service Utility
id:cb6b339e-d4c6-11eb-a026-acde48001122
version:12
date:None
author:Teoderick Contreras, Splunk
status:production
type:Anomaly
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.
Data_source:
  • -Sysmon EventID 1
search:| 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`


how_to_implement: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.
References:
  -https://app.any.run/tasks/c0f98850-af65-4352-9746-fbebadee4f05/
drilldown_searches:
 name:'View the detection results for - "$dest$"'
 search:'%original_detection_search% | search dest = "$dest$"'
 earliest_offset:'$info_min_time$'
 latest_offset:'$info_max_time$'
 name:'View risk events for the last 7 days for - "$dest$"'
 search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
 earliest_offset:'7d'
 latest_offset:'0'
analytic_story:['Azorult', 'Ransomware', 'Crypto Stealer']

asset_type:Endpoint

mitre_attack_id:['T1569.002']

product:['Splunk Enterprise', 'Splunk Enterprise Security', 'Splunk Cloud']

category:endpoint

security_domain:endpoint

tags:

tests:
 name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/malware/ransomware_ttp/data2/windows-sysmon.log
  source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
  sourcetype: XmlWinEventLog
 test_type:'unit'
manual_test:None