Threat Intel Windows Registry Indicator Match

This rule is triggered when a Windows registry indicator from the Threat Intel Filebeat module or integrations has a match against an event that contains registry data.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2023/05/22"
  3maturity = "production"
  4updated_date = "2024/01/17"
  5min_stack_comments = """
  6Limiting the backport of these rules to the stack version which we are deprecating the Threat Intel Indicator Match
  7general rules.
  8"""
  9min_stack_version = "8.5.0"
 10
 11[transform]
 12[[transform.osquery]]
 13label = "Osquery - Retrieve DNS Cache"
 14query = "SELECT * FROM dns_cache"
 15
 16[[transform.osquery]]
 17label = "Osquery - Retrieve All Services"
 18query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
 19
 20[[transform.osquery]]
 21label = "Osquery - Retrieve Services Running on User Accounts"
 22query = """
 23SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
 24NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
 25user_account == null)
 26"""
 27
 28[[transform.osquery]]
 29label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
 30query = """
 31SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
 32services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
 33authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
 34"""
 35
 36[rule]
 37author = ["Elastic"]
 38description = """
 39This rule is triggered when a Windows registry indicator from the Threat Intel Filebeat module or integrations has a
 40match against an event that contains registry data.
 41"""
 42from = "now-65m"
 43index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "winlogbeat-*"]
 44interval = "1h"
 45language = "kuery"
 46license = "Elastic License v2"
 47name = "Threat Intel Windows Registry Indicator Match"
 48note = """## Triage and Analysis
 49
 50### Investigating Threat Intel Windows Registry Indicator Match
 51
 52Threat Intel indicator match rules allow matching from a local observation, such as an endpoint event that records a file hash with an entry of a file hash stored within the Threat Intel integrations index.
 53
 54Matches are based on threat intelligence data that's been ingested during the last 30 days. Some integrations don't place expiration dates on their threat indicators, so we strongly recommend validating ingested threat indicators and reviewing match results. When reviewing match results, check associated activity to determine whether the event requires additional investigation.
 55
 56This rule is triggered when a Windows registry indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against an event that contains registry data.
 57
 58> **Note**:
 59> 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.
 60
 61#### Possible investigation steps
 62
 63- Check related threat reports to gain context about the registry indicator of compromise (IoC) and to understand if it's a system-native mechanism abused for persistence, to store data, to disable security mechanisms, etc. Use this information to define the appropriate triage and respond steps.
 64- Identify the process responsible for the registry operation and 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- Retrieve the involved process executable and 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- Using the data collected through the analysis, scope users targeted and other machines infected in the environment.
 78
 79### False Positive Analysis
 80
 81- Adversaries can leverage dual-use registry mechanisms that are commonly used by normal applications. These registry keys can be added into indicator lists creating the potential for false positives.
 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- If the triage identified malware, search the environment for additional compromised hosts.
 88  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 89  - Stop suspicious processes.
 90  - Immediately block the identified indicators of compromise (IoCs).
 91  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 92- Remove and block malicious artifacts identified during triage.
 93- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 94- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 95- 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).
 96"""
 97references = [
 98    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
 99    "https://www.elastic.co/guide/en/security/master/es-threat-intel-integrations.html",
100    "https://www.elastic.co/security/tip"
101]
102risk_score = 99
103rule_id = "a61809f3-fb5b-465c-8bff-23a8a068ac60"
104setup = """## Setup
105
106This rule needs threat intelligence indicators to work.
107Threat intelligence indicators can be collected using an [Elastic Agent integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#agent-ti-integration),
108the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
109or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).
110
111More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).
112"""
113severity = "critical"
114tags = ["OS: Windows", "Data Source: Elastic Endgame", "Rule Type: Indicator Match"]
115timeline_id = "495ad7a7-316e-4544-8a0f-9c098daee76e"
116timeline_title = "Generic Threat Match Timeline"
117timestamp_override = "event.ingested"
118type = "threat_match"
119
120threat_index = ["filebeat-*", "logs-ti_*"]
121threat_indicator_path = "threat.indicator"
122threat_language = "kuery"
123
124threat_query = '''
125@timestamp >= "now-30d/d" and event.module:(threatintel or ti_*) and threat.indicator.registry.path:* and
126  not labels.is_ioc_transform_source:"true"
127'''
128
129query = """
130registry.path:*
131"""
132
133
134[[rule.threat_filters]]
135[rule.threat_filters."$state"]
136store = "appState"
137[rule.threat_filters.meta]
138negate = false
139disabled = false
140type = "phrase"
141key = "event.category"
142[rule.threat_filters.meta.params]
143query = "threat"
144[rule.threat_filters.query.match_phrase]
145"event.category" = "threat"
146
147[[rule.threat_filters]]
148[rule.threat_filters."$state"]
149store = "appState"
150[rule.threat_filters.meta]
151negate = false
152disabled = false
153type = "phrase"
154key = "event.kind"
155[rule.threat_filters.meta.params]
156query = "enrichment"
157[rule.threat_filters.query.match_phrase]
158"event.kind" = "enrichment"
159
160[[rule.threat_filters]]
161[rule.threat_filters."$state"]
162store = "appState"
163[rule.threat_filters.meta]
164negate = false
165disabled = false
166type = "phrase"
167key = "event.type"
168[rule.threat_filters.meta.params]
169query = "indicator"
170[rule.threat_filters.query.match_phrase]
171"event.type" = "indicator"
172
173[[rule.threat_mapping]]
174[[rule.threat_mapping.entries]]
175field = "registry.path"
176type = "mapping"
177value = "threat.indicator.registry.path"

Triage and Analysis

Investigating Threat Intel Windows Registry Indicator Match

Threat Intel indicator match rules allow matching from a local observation, such as an endpoint event that records a file hash with an entry of a file hash stored within the Threat Intel integrations index.

Matches are based on threat intelligence data that's been ingested during the last 30 days. Some integrations don't place expiration dates on their threat indicators, so we strongly recommend validating ingested threat indicators and reviewing match results. When reviewing match results, check associated activity to determine whether the event requires additional investigation.

This rule is triggered when a Windows registry indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against an event that contains registry data.

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

  • Check related threat reports to gain context about the registry indicator of compromise (IoC) and to understand if it's a system-native mechanism abused for persistence, to store data, to disable security mechanisms, etc. Use this information to define the appropriate triage and respond steps.
  • Identify the process responsible for the registry operation and 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.
  • Retrieve the involved process executable and 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
  • Using the data collected through the analysis, scope users targeted and other machines infected in the environment.

False Positive Analysis

  • Adversaries can leverage dual-use registry mechanisms that are commonly used by normal applications. These registry keys can be added into indicator lists creating the potential for false positives.

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.
  • 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.
  • 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

to-top