Unusual Network Activity from a Windows System Binary
Identifies network activity from unexpected system applications. This may indicate adversarial activity as these applications are often leveraged by adversaries to execute code and evade detection.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/09/02"
3integration = ["endpoint", "windows"]
4maturity = "production"
5updated_date = "2024/10/15"
6min_stack_version = "8.14.0"
7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
8
9[transform]
10[[transform.osquery]]
11label = "Osquery - Retrieve DNS Cache"
12query = "SELECT * FROM dns_cache"
13
14[[transform.osquery]]
15label = "Osquery - Retrieve All Services"
16query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
17
18[[transform.osquery]]
19label = "Osquery - Retrieve Services Running on User Accounts"
20query = """
21SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
22NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
23user_account == null)
24"""
25
26[[transform.osquery]]
27label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
28query = """
29SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
30services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
31authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
32"""
33
34
35[rule]
36author = ["Elastic"]
37description = """
38Identifies network activity from unexpected system applications. This may indicate adversarial activity as these
39applications are often leveraged by adversaries to execute code and evade detection.
40"""
41from = "now-9m"
42index = [
43 "logs-endpoint.events.process-*",
44 "logs-endpoint.events.network-*",
45 "winlogbeat-*",
46 "logs-windows.sysmon_operational-*",
47]
48language = "eql"
49license = "Elastic License v2"
50name = "Unusual Network Activity from a Windows System Binary"
51note = """## Triage and analysis
52
53### Investigating Unusual Network Activity from a Windows System Binary
54
55Attackers can abuse certain trusted developer utilities to proxy the execution of malicious payloads. Since these utilities are usually signed, they can bypass the security controls that were put in place to prevent or detect direct execution.
56
57This rule identifies network connections established by trusted developer utilities, which can indicate abuse to execute payloads or process masquerading.
58
59> **Note**:
60> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
61
62#### Possible investigation steps
63
64- 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.
65- Investigate abnormal behaviors observed by the subject process, such as registry or file modifications, and any spawned child processes.
66- Investigate other alerts associated with the user/host during the past 48 hours.
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
81### False positive analysis
82
83- As trusted developer utilities have dual-use purposes, alerts derived from this rule are not essentially malicious. If these utilities are contacting internal or known trusted domains, review their security and consider creating exceptions if the domain is safe.
84
85### Response and remediation
86
87- Initiate the incident response process based on the outcome of the triage.
88- Isolate the involved host to prevent further post-compromise behavior.
89- 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.
90- If the triage identified malware, search the environment for additional compromised hosts.
91 - Implement temporary network rules, procedures, and segmentation to contain the malware.
92 - Stop suspicious processes.
93 - Immediately block the identified indicators of compromise (IoCs).
94 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
95- Remove and block malicious artifacts identified during triage.
96- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
97- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
98 - If the malicious file was delivered via phishing:
99 - Block the email sender from sending future emails.
100 - Block the malicious web pages.
101 - Remove emails from the sender from mailboxes.
102 - Consider improvements to the security awareness program.
103- 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).
104"""
105risk_score = 47
106rule_id = "1fe3b299-fbb5-4657-a937-1d746f2c711a"
107severity = "medium"
108tags = [
109 "Domain: Endpoint",
110 "OS: Windows",
111 "Use Case: Threat Detection",
112 "Tactic: Defense Evasion",
113 "Resources: Investigation Guide",
114 "Data Source: Elastic Defend",
115 "Data Source: Sysmon",
116]
117type = "eql"
118
119query = '''
120sequence by process.entity_id with maxspan=5m
121 [process where host.os.type == "windows" and event.type == "start" and
122
123 /* known applocker bypasses */
124 (process.name : "bginfo.exe" or
125 process.name : "cdb.exe" or
126 process.name : "control.exe" or
127 process.name : "cmstp.exe" or
128 process.name : "csi.exe" or
129 process.name : "dnx.exe" or
130 process.name : "fsi.exe" or
131 process.name : "ieexec.exe" or
132 process.name : "iexpress.exe" or
133 process.name : "installutil.exe" or
134 process.name : "Microsoft.Workflow.Compiler.exe" or
135 process.name : "MSBuild.exe" or
136 process.name : "msdt.exe" or
137 process.name : "mshta.exe" or
138 process.name : "msiexec.exe" or
139 process.name : "msxsl.exe" or
140 process.name : "odbcconf.exe" or
141 process.name : "rcsi.exe" or
142 process.name : "regsvr32.exe" or
143 process.name : "xwizard.exe")]
144 [network where
145 (process.name : "bginfo.exe" or
146 process.name : "cdb.exe" or
147 process.name : "control.exe" or
148 process.name : "cmstp.exe" or
149 process.name : "csi.exe" or
150 process.name : "dnx.exe" or
151 process.name : "fsi.exe" or
152 process.name : "ieexec.exe" or
153 process.name : "iexpress.exe" or
154 process.name : "installutil.exe" or
155 process.name : "Microsoft.Workflow.Compiler.exe" or
156 (
157 process.name : "msbuild.exe" and
158 destination.ip != "127.0.0.1"
159 ) or
160 process.name : "msdt.exe" or
161 process.name : "mshta.exe" or
162 (
163 process.name : "msiexec.exe" and not
164 dns.question.name : (
165 "ocsp.digicert.com", "ocsp.verisign.com", "ocsp.comodoca.com", "ocsp.entrust.net", "ocsp.usertrust.com",
166 "ocsp.godaddy.com", "ocsp.camerfirma.com", "ocsp.globalsign.com", "ocsp.sectigo.com", "*.local"
167 ) and
168 /* Localhost, DigiCert and Comodo CA IP addresses */
169 not cidrmatch(destination.ip, "127.0.0.1", "192.229.211.108/32", "192.229.221.95/32",
170 "152.195.38.76/32", "104.18.14.101/32")
171 ) or
172 process.name : "msxsl.exe" or
173 process.name : "odbcconf.exe" or
174 process.name : "rcsi.exe" or
175 process.name : "regsvr32.exe" or
176 process.name : "xwizard.exe") and
177
178 not dns.question.name : ("localhost", "setup.officetimeline.com", "us.deployment.endpoint.ingress.rapid7.com",
179 "ctldl.windowsupdate.com", "crl?.digicert.com", "ocsp.digicert.com", "addon-cms-asl.eu.goskope.com", "crls.ssl.com",
180 "evcs-ocsp.ws.symantec.com", "s.symcd.com", "s?.symcb.com", "crl.verisign.com", "oneocsp.microsoft.com", "crl.verisign.com",
181 "aka.ms", "crl.comodoca.com", "acroipm2.adobe.com", "sv.symcd.com") and
182
183 /* host query itself */
184 not startswith~(dns.question.name, host.name)
185 ]
186'''
187
188
189[[rule.threat]]
190framework = "MITRE ATT&CK"
191[[rule.threat.technique]]
192id = "T1036"
193name = "Masquerading"
194reference = "https://attack.mitre.org/techniques/T1036/"
195[[rule.threat.technique.subtechnique]]
196id = "T1036.005"
197name = "Match Legitimate Name or Location"
198reference = "https://attack.mitre.org/techniques/T1036/005/"
199
200
201[[rule.threat.technique]]
202id = "T1127"
203name = "Trusted Developer Utilities Proxy Execution"
204reference = "https://attack.mitre.org/techniques/T1127/"
205[[rule.threat.technique.subtechnique]]
206id = "T1127.001"
207name = "MSBuild"
208reference = "https://attack.mitre.org/techniques/T1127/001/"
209
210[[rule.threat.technique.subtechnique]]
211id = "T1218.005"
212name = "Mshta"
213reference = "https://attack.mitre.org/techniques/T1218/005/"
214
215
216
217[rule.threat.tactic]
218id = "TA0005"
219name = "Defense Evasion"
220reference = "https://attack.mitre.org/tactics/TA0005/"
Triage and analysis
Investigating Unusual Network Activity from a Windows System Binary
Attackers can abuse certain trusted developer utilities to proxy the execution of malicious payloads. Since these utilities are usually signed, they can bypass the security controls that were put in place to prevent or detect direct execution.
This rule identifies network connections established by trusted developer utilities, which can indicate abuse to execute payloads or process masquerading.
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
- 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 abnormal behaviors observed by the subject process, such as registry or file modifications, and any spawned child processes.
- Investigate other alerts associated with the user/host during the past 48 hours.
- 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-FileHash
cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
False positive analysis
- As trusted developer utilities have dual-use purposes, alerts derived from this rule are not essentially malicious. If these utilities are contacting internal or known trusted domains, review their security and consider creating exceptions if the domain is safe.
Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- 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.
- 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.
- 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.
- If the malicious file was delivered via phishing:
- Block the email sender from sending future emails.
- Block the malicious web pages.
- Remove emails from the sender from mailboxes.
- Consider improvements to the security awareness program.
- If the malicious file was delivered via phishing:
- 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).
Related rules
- Code Signing Policy Modification Through Registry
- Conhost Spawned By Suspicious Parent Process
- Creation or Modification of Root Certificate
- Execution from Unusual Directory - Command Line
- Microsoft Build Engine Using an Alternate Name