Remotely Started Services via RPC
Identifies remote execution of Windows services over remote procedure call (RPC). This could be indicative of lateral movement, but will be noisy if commonly done by administrators.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/11/16"
3integration = ["endpoint", "windows"]
4maturity = "production"
5updated_date = "2026/09/18"
6[transform]
7[[transform.osquery]]
8label = "Osquery - Retrieve DNS Cache"
9query = "SELECT * FROM dns_cache"
10
11[[transform.osquery]]
12label = "Osquery - Retrieve All Services"
13query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
14
15[[transform.osquery]]
16label = "Osquery - Retrieve Services Running on User Accounts"
17query = """
18SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
19NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
20user_account == null)
21"""
22
23[[transform.osquery]]
24label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
25query = """
26SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
27services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
28authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
29"""
30
31
32[rule]
33author = ["Elastic"]
34description = """
35Identifies remote execution of Windows services over remote procedure call (RPC). This could be indicative of lateral
36movement, but will be noisy if commonly done by administrators.
37"""
38from = "now-9m"
39index = [
40 "logs-endpoint.events.process-*",
41 "logs-endpoint.events.network-*",
42 "winlogbeat-*",
43 "logs-windows.sysmon_operational-*",
44]
45language = "eql"
46license = "Elastic License v2"
47name = "Remotely Started Services via RPC"
48note = """## Triage and analysis
49
50### Investigating Remotely Started Services via RPC
51
52The Service Control Manager Remote Protocol is a client/server protocol used for configuring and controlling service programs running on a remote computer. A remote service management session begins with the client initiating the connection request to the server. If the server grants the request, the connection is established. The client can then make multiple requests to modify, query the configuration, or start and stop services on the server by using the same session until the session is terminated.
53
54This rule detects the remote creation or start of a service by correlating a `services.exe` network connection and the spawn of a child process.
55
56> **Note**:
57> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
58
59#### Possible investigation steps
60
61- Review login events (e.g., 4624) in the alert timeframe to identify the account used to perform this action. Use the `source.address` field to help identify the source system.
62- Review network events from the source system using the source port identified on the alert and try to identify the program used to initiate the action.
63- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
64- Investigate any abnormal behavior by the subject process such as network connections, registry or file modifications, and any spawned child processes.
65- Investigate other alerts associated with the user/host during the past 48 hours.
66- Validate if the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
67- Examine the host for derived artifacts that indicate suspicious activities:
68 - Analyze the process executable using a private sandboxed analysis system.
69 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
70 - Attempts to contact external domains and addresses.
71 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
72 - Examine the DNS cache for suspicious or anomalous entries.
73 - $osquery_0
74 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
75 - Examine the host services for suspicious or anomalous entries.
76 - $osquery_1
77 - $osquery_2
78 - $osquery_3
79 - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
80- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
81
82
83### False positive analysis
84
85- Remote management software like SCCM may trigger this rule. If noisy on your environment, consider adding exceptions.
86
87### Response and remediation
88
89- Initiate the incident response process based on the outcome of the triage.
90- Isolate the involved hosts to prevent further post-compromise behavior.
91- If the triage identified malware, search the environment for additional compromised hosts.
92 - Implement temporary network rules, procedures, and segmentation to contain the malware.
93 - Stop suspicious processes.
94 - Immediately block the identified indicators of compromise (IoCs).
95 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
96- Remove and block malicious artifacts identified during triage.
97- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
98- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
99- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
100- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
101"""
102
103setup = """## Setup
104
105This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
106
107Setup instructions: https://ela.st/install-elastic-defend
108
109### Additional data sources
110
111This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
112
113- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
114- [Sysmon Event ID 3 - Network Connection](https://ela.st/sysmon-event-3-setup)
115"""
116
117references = [
118 "https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-scmr/705b624a-13de-43cc-b8a2-99573da3635f",
119 "https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
120]
121risk_score = 47
122rule_id = "aa9a274d-6b53-424d-ac5e-cb8ca4251650"
123severity = "medium"
124tags = [
125 "Domain: Endpoint",
126 "OS: Windows",
127 "Use Case: Threat Detection",
128 "Tactic: Lateral Movement",
129 "Resources: Investigation Guide",
130 "Data Source: Elastic Defend",
131 "Data Source: Sysmon",
132 "Noise: High",
133 "Performance: Normal",
134 "Profile: Aggressive",
135 "Rule Type: Event Correlation (EQL)",
136 "Platform: Windows",
137 "Resources: Osquery",
138]
139type = "eql"
140
141query = '''
142sequence with maxspan=1s
143 [network where host.os.type == "windows" and process.name : "services.exe" and
144 network.direction : ("incoming", "ingress") and network.transport == "tcp" and
145 source.port >= 49152 and destination.port >= 49152 and source.ip != "127.0.0.1" and source.ip != "::1"
146 ] by host.id, process.entity_id
147 [process where host.os.type == "windows" and
148 event.type == "start" and process.parent.name : "services.exe" and
149 not (process.executable : "?:\\Windows\\System32\\msiexec.exe" and process.args : "/V") and
150 not process.executable : (
151 "?:\\Pella Corporation\\OSCToGPAutoService\\OSCToGPAutoSvc.exe",
152 "?:\\Pella Corporation\\Pella Order Management\\GPAutoSvc.exe",
153 "?:\\Pella Corporation\\Pella Order Management\\GPAutoSvc.exe",
154 "?:\\Program Files (x86)\\*.exe",
155 "?:\\Program Files\\*.exe",
156 "?:\\Windows\\ADCR_Agent\\adcrsvc.exe",
157 "?:\\Windows\\AdminArsenal\\PDQ*.exe",
158 "?:\\Windows\\CAInvokerService.exe",
159 "?:\\Windows\\ccmsetup\\ccmsetup.exe",
160 "?:\\Windows\\eset-remote-install-service.exe",
161 "?:\\Windows\\ProPatches\\Scheduler\\STSchedEx.exe",
162 "?:\\Windows\\PSEXESVC.EXE",
163 "?:\\Windows\\RemoteAuditService.exe",
164 "?:\\Windows\\servicing\\TrustedInstaller.exe",
165 "?:\\Windows\\System32\\certsrv.exe",
166 "?:\\Windows\\System32\\sppsvc.exe",
167 "?:\\Windows\\System32\\srmhost.exe",
168 "?:\\Windows\\System32\\svchost.exe",
169 "?:\\Windows\\System32\\taskhostex.exe",
170 "?:\\Windows\\System32\\upfc.exe",
171 "?:\\Windows\\System32\\vds.exe",
172 "?:\\Windows\\System32\\VSSVC.exe",
173 "?:\\Windows\\System32\\wbem\\WmiApSrv.exe",
174 "?:\\Windows\\SysWOW64\\NwxExeSvc\\NwxExeSvc.exe",
175 "?:\\Windows\\Veeam\\Backup\\VeeamDeploymentSvc.exe",
176 "?:\\Windows\\VeeamLogShipper\\VeeamLogShipper.exe",
177 "?:\\Windows\\VeeamVssSupport\\VeeamGuestHelper.exe"
178 )] by host.id, process.parent.entity_id
179'''
180
181
182[[rule.threat]]
183framework = "MITRE ATT&CK"
184
185[[rule.threat.technique]]
186id = "T1021"
187name = "Remote Services"
188reference = "https://attack.mitre.org/techniques/T1021/"
189
190[rule.threat.tactic]
191id = "TA0008"
192name = "Lateral Movement"
193reference = "https://attack.mitre.org/tactics/TA0008/"
194
195[[rule.threat]]
196framework = "MITRE ATT&CK"
197
198[[rule.threat.technique]]
199id = "T1569"
200name = "System Services"
201reference = "https://attack.mitre.org/techniques/T1569/"
202
203[[rule.threat.technique.subtechnique]]
204id = "T1569.002"
205name = "Service Execution"
206reference = "https://attack.mitre.org/techniques/T1569/002/"
207
208[rule.threat.tactic]
209id = "TA0002"
210name = "Execution"
211reference = "https://attack.mitre.org/tactics/TA0002/"
Triage and analysis
Investigating Remotely Started Services via RPC
The Service Control Manager Remote Protocol is a client/server protocol used for configuring and controlling service programs running on a remote computer. A remote service management session begins with the client initiating the connection request to the server. If the server grants the request, the connection is established. The client can then make multiple requests to modify, query the configuration, or start and stop services on the server by using the same session until the session is terminated.
This rule detects the remote creation or start of a service by correlating a services.exe network connection and the spawn of a child process.
Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
Possible investigation steps
- Review login events (e.g., 4624) in the alert timeframe to identify the account used to perform this action. Use the
source.addressfield to help identify the source system. - Review network events from the source system using the source port identified on the alert and try to identify the program used to initiate the action.
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate any abnormal behavior by the subject process such as network connections, registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Validate if the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
- Examine the host for derived artifacts that indicate suspicious activities:
- Analyze the process executable using a private sandboxed analysis system.
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
process.entity_id. - Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process'
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
- Attempts to contact external domains and addresses.
- Retrieve the files' SHA-256 hash values using the PowerShell
Get-FileHashcmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
False positive analysis
- Remote management software like SCCM may trigger this rule. If noisy on your environment, consider adding exceptions.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved hosts to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
References
Related rules
- Code Signing Policy Modification Through Registry
- Incoming Execution via WinRM Remote Shell
- NullSessionPipe Registry Modification
- Process Execution from an Unusual Directory
- RDP Enabled via Registry