Threat Intel IP Address Indicator Match

This rule is triggered when an IP address indicator from the Threat Intel Filebeat module or integrations has a match against a network event.

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 an IP address indicator from the Threat Intel Filebeat module or integrations has a match
 40against a network event.
 41"""
 42from = "now-65m"
 43index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "packetbeat-*", "winlogbeat-*"]
 44interval = "1h"
 45language = "kuery"
 46license = "Elastic License v2"
 47name = "Threat Intel IP Address Indicator Match"
 48note = """## Triage and Analysis
 49
 50### Investigating Threat Intel IP Address 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 an IP address indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against a network event.
 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- Gain context about the field that matched the local observation so you can understand the nature of the connection. This information can be found in the `threat.indicator.matched.field` field.
 64- Investigate the IP address, which can be found in the `threat.indicator.matched.atomic` field:
 65  - Check the reputation of the IP address in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 66  - Execute a reverse DNS lookup to retrieve hostnames associated with the given IP address.
 67- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 68- Identify the process responsible for the connection, 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.
 69- Retrieve the involved process executable and examine the host for derived artifacts that indicate suspicious activities:
 70  - Analyze the process executable using a private sandboxed analysis system.
 71  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
 72    - Attempts to contact external domains and addresses.
 73      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 74      - Examine the DNS cache for suspicious or anomalous entries.
 75        - $osquery_0
 76    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 77    - Examine the host services for suspicious or anomalous entries.
 78      - $osquery_1
 79      - $osquery_2
 80      - $osquery_3
 81- Using the data collected through the analysis, scope users targeted and other machines infected in the environment.
 82
 83### False Positive Analysis
 84
 85- When a match is found, it's important to consider the indicator's initial release date. Threat intelligence is useful for augmenting existing security processes but can quickly become outdated. In other words, some threat intelligence only represents a specific set of activity observed at a specific time. For example, an IP address may have hosted malware observed in a Dridex campaign months ago, but it's possible that IP has been remediated and no longer represents any threat.
 86- False positives might occur after large and publicly written campaigns if curious employees interact with attacker infrastructure.
 87- Some feeds may include internal or known benign addresses by mistake (e.g., 8.8.8.8, google.com, 127.0.0.1, etc.). Make sure you understand how blocking a specific domain or address might impact the organization or normal system functioning.
 88
 89### Response and Remediation
 90
 91- Initiate the incident response process based on the outcome of the triage.
 92- Isolate the involved host to prevent further post-compromise behavior.
 93- If the triage identified malware, search the environment for additional compromised hosts.
 94  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 95  - Stop suspicious processes.
 96  - Immediately block the identified indicators of compromise (IoCs).
 97  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 98- Remove and block malicious artifacts identified during triage.
 99- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
100- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
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"""
103references = [
104    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
105    "https://www.elastic.co/guide/en/security/master/es-threat-intel-integrations.html",
106    "https://www.elastic.co/security/tip"
107]
108risk_score = 99
109rule_id = "0c41e478-5263-4c69-8f9e-7dfd2c22da64"
110setup = """## Setup
111
112This rule needs threat intelligence indicators to work.
113Threat 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),
114the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
115or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).
116
117More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).
118"""
119severity = "critical"
120tags = ["OS: Windows", "Data Source: Elastic Endgame", "Rule Type: Indicator Match"]
121timeline_id = "495ad7a7-316e-4544-8a0f-9c098daee76e"
122timeline_title = "Generic Threat Match Timeline"
123timestamp_override = "event.ingested"
124type = "threat_match"
125
126threat_index = ["filebeat-*", "logs-ti_*"]
127threat_indicator_path = "threat.indicator"
128threat_language = "kuery"
129
130threat_query = '''
131@timestamp >= "now-30d/d" and event.module:(threatintel or ti_*) and threat.indicator.ip:* and
132  not labels.is_ioc_transform_source:"true"
133'''
134
135query = """
136source.ip:* or destination.ip:*
137"""
138
139
140[[rule.threat_filters]]
141[rule.threat_filters."$state"]
142store = "appState"
143[rule.threat_filters.meta]
144negate = false
145disabled = false
146type = "phrase"
147key = "event.category"
148[rule.threat_filters.meta.params]
149query = "threat"
150[rule.threat_filters.query.match_phrase]
151"event.category" = "threat"
152
153[[rule.threat_filters]]
154[rule.threat_filters."$state"]
155store = "appState"
156[rule.threat_filters.meta]
157negate = false
158disabled = false
159type = "phrase"
160key = "event.kind"
161[rule.threat_filters.meta.params]
162query = "enrichment"
163[rule.threat_filters.query.match_phrase]
164"event.kind" = "enrichment"
165
166[[rule.threat_filters]]
167[rule.threat_filters."$state"]
168store = "appState"
169[rule.threat_filters.meta]
170negate = false
171disabled = false
172type = "phrase"
173key = "event.type"
174[rule.threat_filters.meta.params]
175query = "indicator"
176[rule.threat_filters.query.match_phrase]
177"event.type" = "indicator"
178
179[[rule.threat_mapping]]
180[[rule.threat_mapping.entries]]
181field = "source.ip"
182type = "mapping"
183value = "threat.indicator.ip"
184
185[[rule.threat_mapping]]
186[[rule.threat_mapping.entries]]
187field = "destination.ip"
188type = "mapping"
189value = "threat.indicator.ip"

Triage and Analysis

Investigating Threat Intel IP Address 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 an IP address indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against a network event.

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

  • Gain context about the field that matched the local observation so you can understand the nature of the connection. This information can be found in the threat.indicator.matched.field field.
  • Investigate the IP address, which can be found in the threat.indicator.matched.atomic field:
    • Check the reputation of the IP address in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
    • Execute a reverse DNS lookup to retrieve hostnames associated with the given IP address.
  • Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
  • Identify the process responsible for the connection, 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

  • When a match is found, it's important to consider the indicator's initial release date. Threat intelligence is useful for augmenting existing security processes but can quickly become outdated. In other words, some threat intelligence only represents a specific set of activity observed at a specific time. For example, an IP address may have hosted malware observed in a Dridex campaign months ago, but it's possible that IP has been remediated and no longer represents any threat.
  • False positives might occur after large and publicly written campaigns if curious employees interact with attacker infrastructure.
  • Some feeds may include internal or known benign addresses by mistake (e.g., 8.8.8.8, google.com, 127.0.0.1, etc.). Make sure you understand how blocking a specific domain or address might impact the organization or normal system functioning.

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