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/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 an IP address indicator from the Threat Intel Filebeat module or integrations has a match
 36against a network event.
 37"""
 38from = "now-65m"
 39index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "packetbeat-*", "winlogbeat-*"]
 40interval = "1h"
 41language = "kuery"
 42license = "Elastic License v2"
 43name = "Threat Intel IP Address Indicator Match"
 44note = """## Triage and Analysis
 45
 46### Investigating Threat Intel IP Address 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 an IP address indicator from the Threat Intel Filebeat module or a threat intelligence integration matches against a network event.
 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- 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.
 60- Investigate the IP address, which can be found in the `threat.indicator.matched.atomic` field:
 61  - Check the reputation of the IP address in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 62  - Execute a reverse DNS lookup to retrieve hostnames associated with the given IP address.
 63- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 64- 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.
 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- 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.
 82- False positives might occur after large and publicly written campaigns if curious employees interact with attacker infrastructure.
 83- 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.
 84
 85### Response and Remediation
 86
 87- Initiate the incident response process based on the outcome of the triage.
 88- Isolate the involved host to prevent further post-compromise behavior.
 89- If the triage identified malware, search the environment for additional compromised hosts.
 90  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 91  - Stop suspicious processes.
 92  - Immediately block the identified indicators of compromise (IoCs).
 93  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 94- Remove and block malicious artifacts identified during triage.
 95- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 96- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 97- 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).
 98"""
 99references = [
100    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
101    "https://www.elastic.co/guide/en/security/master/es-threat-intel-integrations.html",
102    "https://www.elastic.co/security/tip",
103]
104risk_score = 99
105rule_id = "0c41e478-5263-4c69-8f9e-7dfd2c22da64"
106setup = """## Setup
107
108This rule needs threat intelligence indicators to work.
109Threat 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),
110the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
111or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).
112
113More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).
114"""
115severity = "critical"
116tags = ["OS: Windows", "Data Source: Elastic Endgame", "Rule Type: Threat Match"]
117threat_index = ["filebeat-*", "logs-ti_*"]
118threat_indicator_path = "threat.indicator"
119threat_language = "kuery"
120threat_query = """
121@timestamp >= "now-30d/d" and event.module:(threatintel or ti_*) and threat.indicator.ip:* and not
122labels.is_ioc_transform_source:"true"
123"""
124timeline_id = "495ad7a7-316e-4544-8a0f-9c098daee76e"
125timeline_title = "Generic Threat Match Timeline"
126timestamp_override = "event.ingested"
127type = "threat_match"
128
129query = '''
130source.ip:* or destination.ip:*
131'''
132
133
134[[rule.threat_filters]]
135
136[rule.threat_filters."$state"]
137store = "appState"
138[rule.threat_filters.meta]
139disabled = false
140key = "event.category"
141negate = false
142type = "phrase"
143[rule.threat_filters.meta.params]
144query = "threat"
145[rule.threat_filters.query.match_phrase]
146"event.category" = "threat"
147[[rule.threat_filters]]
148
149[rule.threat_filters."$state"]
150store = "appState"
151[rule.threat_filters.meta]
152disabled = false
153key = "event.kind"
154negate = false
155type = "phrase"
156[rule.threat_filters.meta.params]
157query = "enrichment"
158[rule.threat_filters.query.match_phrase]
159"event.kind" = "enrichment"
160[[rule.threat_filters]]
161
162[rule.threat_filters."$state"]
163store = "appState"
164[rule.threat_filters.meta]
165disabled = false
166key = "event.type"
167negate = false
168type = "phrase"
169[rule.threat_filters.meta.params]
170query = "indicator"
171[rule.threat_filters.query.match_phrase]
172"event.type" = "indicator"
173[[rule.threat_mapping]]
174
175[[rule.threat_mapping.entries]]
176field = "source.ip"
177type = "mapping"
178value = "threat.indicator.ip"
179
180[[rule.threat_mapping]]
181
182[[rule.threat_mapping.entries]]
183field = "destination.ip"
184type = "mapping"
185value = "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