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/06/10"
  5
  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 = """
 35This rule is triggered when a Windows registry indicator from the Threat Intel Filebeat module or integrations has a
 36match against an event that contains registry data.
 37"""
 38from = "now-65m"
 39index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "winlogbeat-*"]
 40interval = "1h"
 41language = "kuery"
 42license = "Elastic License v2"
 43name = "Threat Intel Windows Registry Indicator Match"
 44note = """## Triage and Analysis
 45
 46### Investigating Threat Intel Windows Registry Indicator Match
 47
 48Threat 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.
 49
 50Matches 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.
 51
 52This 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.
 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- 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.
 60- 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.
 61- Retrieve the involved process executable and examine the host for derived artifacts that indicate suspicious activities:
 62  - Analyze the process executable using a private sandboxed analysis system.
 63  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
 64    - Attempts to contact external domains and addresses.
 65      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 66      - Examine the DNS cache for suspicious or anomalous entries.
 67        - $osquery_0
 68    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 69    - Examine the host services for suspicious or anomalous entries.
 70      - $osquery_1
 71      - $osquery_2
 72      - $osquery_3
 73- Using the data collected through the analysis, scope users targeted and other machines infected in the environment.
 74
 75### False Positive Analysis
 76
 77- 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.
 78
 79### Response and Remediation
 80
 81- Initiate the incident response process based on the outcome of the triage.
 82- Isolate the involved host to prevent further post-compromise behavior.
 83- If the triage identified malware, search the environment for additional compromised hosts.
 84  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 85  - Stop suspicious processes.
 86  - Immediately block the identified indicators of compromise (IoCs).
 87  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 88- Remove and block malicious artifacts identified during triage.
 89- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 90- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 91- 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).
 92"""
 93references = [
 94    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
 95    "https://www.elastic.co/guide/en/security/master/es-threat-intel-integrations.html",
 96    "https://www.elastic.co/security/tip",
 97]
 98risk_score = 99
 99rule_id = "a61809f3-fb5b-465c-8bff-23a8a068ac60"
100setup = """## Setup
101
102This rule needs threat intelligence indicators to work.
103Threat 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),
104the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
105or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).
106
107More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).
108"""
109severity = "critical"
110tags = ["OS: Windows", "Data Source: Elastic Endgame", "Rule Type: Threat Match"]
111threat_index = ["filebeat-*", "logs-ti_*"]
112threat_indicator_path = "threat.indicator"
113threat_language = "kuery"
114threat_query = """
115@timestamp >= "now-30d/d" and event.module:(threatintel or ti_*) and threat.indicator.registry.path:* and not
116labels.is_ioc_transform_source:"true"
117"""
118timeline_id = "495ad7a7-316e-4544-8a0f-9c098daee76e"
119timeline_title = "Generic Threat Match Timeline"
120timestamp_override = "event.ingested"
121type = "threat_match"
122
123query = '''
124registry.path:*
125'''
126
127
128[[rule.threat_filters]]
129
130[rule.threat_filters."$state"]
131store = "appState"
132[rule.threat_filters.meta]
133disabled = false
134key = "event.category"
135negate = false
136type = "phrase"
137[rule.threat_filters.meta.params]
138query = "threat"
139[rule.threat_filters.query.match_phrase]
140"event.category" = "threat"
141[[rule.threat_filters]]
142
143[rule.threat_filters."$state"]
144store = "appState"
145[rule.threat_filters.meta]
146disabled = false
147key = "event.kind"
148negate = false
149type = "phrase"
150[rule.threat_filters.meta.params]
151query = "enrichment"
152[rule.threat_filters.query.match_phrase]
153"event.kind" = "enrichment"
154[[rule.threat_filters]]
155
156[rule.threat_filters."$state"]
157store = "appState"
158[rule.threat_filters.meta]
159disabled = false
160key = "event.type"
161negate = false
162type = "phrase"
163[rule.threat_filters.meta.params]
164query = "indicator"
165[rule.threat_filters.query.match_phrase]
166"event.type" = "indicator"
167[[rule.threat_mapping]]
168
169[[rule.threat_mapping.entries]]
170field = "registry.path"
171type = "mapping"
172value = "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