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"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/04/08"
  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 = ["logs-endpoint.events.process-*", "logs-endpoint.events.network-*", "winlogbeat-*", "logs-windows.sysmon_operational-*"]
 43language = "eql"
 44license = "Elastic License v2"
 45name = "Unusual Network Activity from a Windows System Binary"
 46note = """## Triage and analysis
 47
 48### Investigating Unusual Network Activity from a Windows System Binary
 49
 50Attackers 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.
 51
 52This rule identifies network connections established by trusted developer utilities, which can indicate abuse to execute payloads or process masquerading.
 53
 54> **Note**:
 55> 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.
 56
 57#### Possible investigation steps
 58
 59- 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.
 60- Investigate abnormal behaviors observed by the subject process, such as registry or file modifications, and any spawned child processes.
 61- Investigate other alerts associated with the user/host during the past 48 hours.
 62- Examine the host for derived artifacts that indicate suspicious activities:
 63  - Analyze the process executable using a private sandboxed analysis system.
 64  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
 65    - Attempts to contact external domains and addresses.
 66      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 67      - Examine the DNS cache for suspicious or anomalous entries.
 68        - $osquery_0
 69    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 70    - Examine the host services for suspicious or anomalous entries.
 71      - $osquery_1
 72      - $osquery_2
 73      - $osquery_3
 74  - 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.
 75
 76### False positive analysis
 77
 78- 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.
 79
 80### Response and remediation
 81
 82- Initiate the incident response process based on the outcome of the triage.
 83- Isolate the involved host to prevent further post-compromise behavior.
 84- 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.
 85- If the triage identified malware, search the environment for additional compromised hosts.
 86  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 87  - Stop suspicious processes.
 88  - Immediately block the identified indicators of compromise (IoCs).
 89  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 90- Remove and block malicious artifacts identified during triage.
 91- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 92- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 93  - If the malicious file was delivered via phishing:
 94    - Block the email sender from sending future emails.
 95    - Block the malicious web pages.
 96    - Remove emails from the sender from mailboxes.
 97    - Consider improvements to the security awareness program.
 98- 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).
 99"""
100risk_score = 47
101rule_id = "1fe3b299-fbb5-4657-a937-1d746f2c711a"
102severity = "medium"
103tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Defense Evasion", "Resources: Investigation Guide", "Data Source: Elastic Defend", "Data Source: Sysmon"]
104type = "eql"
105
106query = '''
107sequence by process.entity_id with maxspan=5m
108  [process where host.os.type == "windows" and event.type == "start" and
109
110     /* known applocker bypasses */
111     (process.name : "bginfo.exe" or
112      process.name : "cdb.exe" or
113      process.name : "control.exe" or
114      process.name : "cmstp.exe" or
115      process.name : "csi.exe" or
116      process.name : "dnx.exe" or
117      process.name : "fsi.exe" or
118      process.name : "ieexec.exe" or
119      process.name : "iexpress.exe" or
120      process.name : "installutil.exe" or
121      process.name : "Microsoft.Workflow.Compiler.exe" or
122      process.name : "MSBuild.exe" or
123      process.name : "msdt.exe" or
124      process.name : "mshta.exe" or
125      process.name : "msiexec.exe" or
126      process.name : "msxsl.exe" or
127      process.name : "odbcconf.exe" or
128      process.name : "rcsi.exe" or
129      process.name : "regsvr32.exe" or
130      process.name : "xwizard.exe")]
131  [network where
132     (process.name : "bginfo.exe" or
133      process.name : "cdb.exe" or
134      process.name : "control.exe" or
135      process.name : "cmstp.exe" or
136      process.name : "csi.exe" or
137      process.name : "dnx.exe" or
138      process.name : "fsi.exe" or
139      process.name : "ieexec.exe" or
140      process.name : "iexpress.exe" or
141      process.name : "installutil.exe" or
142      process.name : "Microsoft.Workflow.Compiler.exe" or
143      (
144        process.name : "msbuild.exe" and
145          destination.ip != "127.0.0.1"
146      ) or
147      process.name : "msdt.exe" or
148      process.name : "mshta.exe" or
149      (
150        process.name : "msiexec.exe" and not
151        dns.question.name : (
152           "ocsp.digicert.com", "ocsp.verisign.com", "ocsp.comodoca.com", "ocsp.entrust.net", "ocsp.usertrust.com",
153           "ocsp.godaddy.com", "ocsp.camerfirma.com", "ocsp.globalsign.com", "ocsp.sectigo.com", "*.local"
154        ) and
155        /* Localhost, DigiCert and Comodo CA IP addresses */
156        not cidrmatch(destination.ip, "127.0.0.1", "192.229.211.108/32", "192.229.221.95/32",
157                      "152.195.38.76/32", "104.18.14.101/32")
158      ) or
159      process.name : "msxsl.exe" or
160      process.name : "odbcconf.exe" or
161      process.name : "rcsi.exe" or
162      process.name : "regsvr32.exe" or
163      process.name : "xwizard.exe")]
164'''
165
166
167[[rule.threat]]
168framework = "MITRE ATT&CK"
169[[rule.threat.technique]]
170id = "T1127"
171name = "Trusted Developer Utilities Proxy Execution"
172reference = "https://attack.mitre.org/techniques/T1127/"
173[[rule.threat.technique.subtechnique]]
174id = "T1127.001"
175name = "MSBuild"
176reference = "https://attack.mitre.org/techniques/T1127/001/"
177
178[[rule.threat.technique.subtechnique]]
179id = "T1218.005"
180name = "Mshta"
181reference = "https://attack.mitre.org/techniques/T1218/005/"
182
183[[rule.threat.technique]]
184id = "T1036"
185name = "Masquerading"
186reference = "https://attack.mitre.org/techniques/T1036/"
187
188[[rule.threat.technique.subtechnique]]
189id = "T1036.005"
190name = "Match Legitimate Name or Location"
191reference = "https://attack.mitre.org/techniques/T1036/005/"
192
193[rule.threat.tactic]
194id = "TA0005"
195name = "Defense Evasion"
196reference = "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 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
    • 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.
  • 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

to-top