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/09/10"
6
7[transform]
8[[transform.osquery]]
9label = "Osquery - Retrieve DNS Cache"
10query = "SELECT * FROM dns_cache"
11
12[[transform.osquery]]
13label = "Osquery - Retrieve All Services"
14query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
15
16[[transform.osquery]]
17label = "Osquery - Retrieve Services Running on User Accounts"
18query = """
19SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
20NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
21user_account == null)
22"""
23
24[[transform.osquery]]
25label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
26query = """
27SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
28services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
29authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
30"""
31
32
33[rule]
34author = ["Elastic"]
35description = """
36Identifies network activity from unexpected system applications. This may indicate adversarial activity as these
37applications are often leveraged by adversaries to execute code and evade detection.
38"""
39from = "now-9m"
40index = [
41 "logs-endpoint.events.process-*",
42 "logs-endpoint.events.network-*",
43 "winlogbeat-*",
44 "logs-windows.sysmon_operational-*",
45]
46language = "eql"
47license = "Elastic License v2"
48name = "Unusual Network Activity from a Windows System Binary"
49note = """## Triage and analysis
50
51### Investigating Unusual Network Activity from a Windows System Binary
52
53Attackers 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.
54
55This rule identifies network connections established by trusted developer utilities, which can indicate abuse to execute payloads or process masquerading.
56
57> **Note**:
58> 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.
59
60#### Possible investigation steps
61
62- 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.
63- Investigate abnormal behaviors observed by the subject process, such as registry or file modifications, and any spawned child processes.
64- Investigate other alerts associated with the user/host during the past 48 hours.
65- Examine the host for derived artifacts that indicate suspicious activities:
66 - Analyze the process executable using a private sandboxed analysis system.
67 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
68 - Attempts to contact external domains and addresses.
69 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
70 - Examine the DNS cache for suspicious or anomalous entries.
71 - $osquery_0
72 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
73 - Examine the host services for suspicious or anomalous entries.
74 - $osquery_1
75 - $osquery_2
76 - $osquery_3
77 - 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.
78
79### False positive analysis
80
81- 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.
82
83### Response and remediation
84
85- Initiate the incident response process based on the outcome of the triage.
86- Isolate the involved host to prevent further post-compromise behavior.
87- 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.
88- If the triage identified malware, search the environment for additional compromised hosts.
89 - Implement temporary network rules, procedures, and segmentation to contain the malware.
90 - Stop suspicious processes.
91 - Immediately block the identified indicators of compromise (IoCs).
92 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
93- Remove and block malicious artifacts identified during triage.
94- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
95- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
96 - If the malicious file was delivered via phishing:
97 - Block the email sender from sending future emails.
98 - Block the malicious web pages.
99 - Remove emails from the sender from mailboxes.
100 - Consider improvements to the security awareness program.
101- 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).
102"""
103risk_score = 47
104rule_id = "1fe3b299-fbb5-4657-a937-1d746f2c711a"
105severity = "medium"
106tags = [
107 "Domain: Endpoint",
108 "OS: Windows",
109 "Use Case: Threat Detection",
110 "Tactic: Defense Evasion",
111 "Resources: Investigation Guide",
112 "Data Source: Elastic Defend",
113 "Data Source: Sysmon",
114]
115type = "eql"
116
117query = '''
118sequence by process.entity_id with maxspan=5m
119 [process where host.os.type == "windows" and event.type == "start" and
120
121 /* known applocker bypasses */
122 (process.name : "bginfo.exe" or
123 process.name : "cdb.exe" or
124 process.name : "control.exe" or
125 process.name : "cmstp.exe" or
126 process.name : "csi.exe" or
127 process.name : "dnx.exe" or
128 process.name : "fsi.exe" or
129 process.name : "ieexec.exe" or
130 process.name : "iexpress.exe" or
131 process.name : "installutil.exe" or
132 process.name : "Microsoft.Workflow.Compiler.exe" or
133 process.name : "MSBuild.exe" or
134 process.name : "msdt.exe" or
135 process.name : "mshta.exe" or
136 process.name : "msiexec.exe" or
137 process.name : "msxsl.exe" or
138 process.name : "odbcconf.exe" or
139 process.name : "rcsi.exe" or
140 process.name : "regsvr32.exe" or
141 process.name : "xwizard.exe")]
142 [network where
143 (process.name : "bginfo.exe" or
144 process.name : "cdb.exe" or
145 process.name : "control.exe" or
146 process.name : "cmstp.exe" or
147 process.name : "csi.exe" or
148 process.name : "dnx.exe" or
149 process.name : "fsi.exe" or
150 process.name : "ieexec.exe" or
151 process.name : "iexpress.exe" or
152 process.name : "installutil.exe" or
153 process.name : "Microsoft.Workflow.Compiler.exe" or
154 (
155 process.name : "msbuild.exe" and
156 destination.ip != "127.0.0.1"
157 ) or
158 process.name : "msdt.exe" or
159 process.name : "mshta.exe" or
160 (
161 process.name : "msiexec.exe" and not
162 dns.question.name : (
163 "ocsp.digicert.com", "ocsp.verisign.com", "ocsp.comodoca.com", "ocsp.entrust.net", "ocsp.usertrust.com",
164 "ocsp.godaddy.com", "ocsp.camerfirma.com", "ocsp.globalsign.com", "ocsp.sectigo.com", "*.local"
165 ) and
166 /* Localhost, DigiCert and Comodo CA IP addresses */
167 not cidrmatch(destination.ip, "127.0.0.1", "192.229.211.108/32", "192.229.221.95/32",
168 "152.195.38.76/32", "104.18.14.101/32")
169 ) or
170 process.name : "msxsl.exe" or
171 process.name : "odbcconf.exe" or
172 process.name : "rcsi.exe" or
173 process.name : "regsvr32.exe" or
174 process.name : "xwizard.exe") and
175
176 not dns.question.name : ("localhost", "setup.officetimeline.com", "us.deployment.endpoint.ingress.rapid7.com",
177 "ctldl.windowsupdate.com", "crl?.digicert.com", "ocsp.digicert.com", "addon-cms-asl.eu.goskope.com", "crls.ssl.com",
178 "evcs-ocsp.ws.symantec.com", "s.symcd.com", "s?.symcb.com", "crl.verisign.com", "oneocsp.microsoft.com", "crl.verisign.com",
179 "aka.ms", "crl.comodoca.com", "acroipm2.adobe.com", "sv.symcd.com") and
180
181 /* host query itself */
182 not startswith~(dns.question.name, host.name)
183 ]
184'''
185
186
187[[rule.threat]]
188framework = "MITRE ATT&CK"
189[[rule.threat.technique]]
190id = "T1036"
191name = "Masquerading"
192reference = "https://attack.mitre.org/techniques/T1036/"
193[[rule.threat.technique.subtechnique]]
194id = "T1036.005"
195name = "Match Legitimate Name or Location"
196reference = "https://attack.mitre.org/techniques/T1036/005/"
197
198
199[[rule.threat.technique]]
200id = "T1127"
201name = "Trusted Developer Utilities Proxy Execution"
202reference = "https://attack.mitre.org/techniques/T1127/"
203[[rule.threat.technique.subtechnique]]
204id = "T1127.001"
205name = "MSBuild"
206reference = "https://attack.mitre.org/techniques/T1127/001/"
207
208[[rule.threat.technique.subtechnique]]
209id = "T1218.005"
210name = "Mshta"
211reference = "https://attack.mitre.org/techniques/T1218/005/"
212
213
214
215[rule.threat.tactic]
216id = "TA0005"
217name = "Defense Evasion"
218reference = "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
- MsBuild Making Network Connections
- Suspicious Antimalware Scan Interface DLL
- Suspicious Startup Shell Folder Modification
- Windows Defender Disabled via Registry Modification
- Service DACL Modification via sc.exe