Behavior - Detected - Elastic Defend

Generates a detection alert each time an Elastic Defend alert for malicious behavior is received. Enabling this rule allows you to immediately begin investigating your Endpoint behavior alerts. This rule identifies Elastic Defend behavior detections only, and does not include prevention alerts.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2024/03/24"
  3integration = ["endpoint"]
  4maturity = "production"
  5min_stack_comments = "Defend alerting adjustments patch to distinguish prevention and detection."
  6min_stack_version = "8.16.0"
  7promotion = true
  8updated_date = "2024/11/26"
  9
 10[rule]
 11author = ["Elastic"]
 12description = """
 13Generates a detection alert each time an Elastic Defend alert for malicious behavior is received. Enabling this rule
 14allows you to immediately begin investigating your Endpoint behavior alerts. This rule identifies Elastic Defend
 15behavior detections only, and does not include prevention alerts.
 16"""
 17enabled = false
 18from = "now-10m"
 19index = ["logs-endpoint.alerts-*"]
 20interval = "5m"
 21language = "kuery"
 22license = "Elastic License v2"
 23max_signals = 10000
 24name = "Behavior - Detected - Elastic Defend"
 25note = """## Triage and analysis
 26
 27### Investigating Behavior Alerts
 28
 29Malicious behavior protection is a foundational feature which can be used to protect against all manner of attacks on the endpoint. For example, it provides coverage against phishing such as malicious macros, many malware families based on their activities, privilege escalation attacks such as user account control bypasses (UAC), credential theft, and much more. It works by consuming an unfiltered feed of all events that are captured on the system (process, file, registry, network, dns, etc). These events are processed against a routinely updated set of rules written by Elastic threat experts. From there, malicious behaviors are identified and offending processes are terminated. The protection operates on the event stream asynchronously, but has been designed to be extremely efficient and typically requires just milliseconds (under standard load) to stop malicious activity.
 30
 31### Possible investigation steps
 32
 33- Assess whether this activity is prevalent in your environment by looking for similar occurrences across hosts.
 34- Verify the detailed activity of the process that triggered the alert (process tree, child process, process arguments, network, files, libraries and registry events).
 35- Verify the activity of the `user.name` associated with the alert (local or remote actity, privileged or standard user).
 36- Particular attention should be paid to instances where the same process is triggering multiple alerts (more than 2 or 3) within a short period of time.
 37- Even the the process is signed by a valid certificate, verify the if it's running from the expected location or if it's loading any suspicious libraries or any sign of code injection.
 38
 39### False positive analysis
 40
 41- Same alert observed on a high number of hosts with similar details.
 42- High count of the same alert on a specific host over a long period of time.
 43
 44### Response and Remediation
 45
 46- Initiate the incident response process based on the outcome of the triage.
 47  - If malicious activity is confirmed, perform a broader investigation to identify the scope of the compromise and determine the appropriate remediation steps.
 48- Implement Elastic Endpoint Security to detect and prevent further post exploitation activities in the environment.
 49   - Contain the affected system by isolating it from the network to prevent further spread of the attack.
 50- If the triage identified malware, search the environment for additional compromised hosts.
 51  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 52  - Stop suspicious processes.
 53  - Immediately block the identified indicators of compromise (IoCs).
 54  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 55- Remove and block malicious artifacts identified during triage.
 56- Restore the affected system to its operational state by applying any necessary patches, updates, or configuration changes.
 57- 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.
 58- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 59- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 60- 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).
 61"""
 62references = [
 63    "https://github.com/elastic/protections-artifacts/tree/main/behavior",
 64    "https://docs.elastic.co/en/integrations/endpoint",
 65]
 66risk_score = 47
 67rule_id = "0f615fe4-eaa2-11ee-ae33-f661ea17fbce"
 68rule_name_override = "message"
 69setup = """## Setup
 70
 71### Elastic Defend Alerts
 72This rule is designed to capture specific alerts generated by Elastic Defend.
 73
 74To capture all the Elastic Defend alerts, it is recommended to use all of the Elastic Defend feature-specific protection rules:
 75
 76Behavior - Detected - Elastic Defend (UUID: 0f615fe4-eaa2-11ee-ae33-f661ea17fbce)
 77Behavior - Prevented - Elastic Defend (UUID: eb804972-ea34-11ee-a417-f661ea17fbce)
 78Malicious File - Detected - Elastic Defend (UUID: f2c3caa6-ea34-11ee-a417-f661ea17fbce)
 79Malicious File - Prevented - Elastic Defend (UUID: f87e6122-ea34-11ee-a417-f661ea17fbce)
 80Memory Threat - Detected - Elastic Defend (UUID: 017de1e4-ea35-11ee-a417-f661ea17fbce)
 81Memory Threat - Prevented - Elastic Defend (UUID: 06f3a26c-ea35-11ee-a417-f661ea17fbce)
 82Ransomware - Detected - Elastic Defend (UUID: 0c74cd7e-ea35-11ee-a417-f661ea17fbce)
 83Ransomware - Prevented - Elastic Defend (UUID: 10f3d520-ea35-11ee-a417-f661ea17fbce)
 84
 85To avoid generating duplicate alerts, you should enable either all feature-specific protection rules or the Endpoint Security (Elastic Defend) rule (UUID: 9a1a2dae-0b5f-4c3d-8305-a268d404c306).
 86
 87### Additional notes
 88This rule is configured to generate more **Max alerts per run** than the default 1000 alerts per run set for all rules. This is to ensure that it captures as many alerts as possible.
 89
 90**IMPORTANT:** The rule's **Max alerts per run** setting can be superseded by the `xpack.alerting.rules.run.alerts.max` Kibana config setting, which determines the maximum alerts generated by _any_ rule in the Kibana alerting framework. For example, if `xpack.alerting.rules.run.alerts.max` is set to 1000, this rule will still generate no more than 1000 alerts even if its own **Max alerts per run** is set higher.
 91
 92To make sure this rule can generate as many alerts as it's configured in its own **Max alerts per run** setting, increase the `xpack.alerting.rules.run.alerts.max` system setting accordingly.
 93
 94**NOTE:** Changing `xpack.alerting.rules.run.alerts.max` is not possible in Serverless projects.
 95"""
 96severity = "medium"
 97tags = ["Data Source: Elastic Defend"]
 98timestamp_override = "event.ingested"
 99type = "query"
100
101query = '''
102event.kind : alert and event.code : behavior and (event.type : allowed or (event.type: denied and event.outcome: failure))
103'''
104
105
106[[rule.exceptions_list]]
107id = "endpoint_list"
108list_id = "endpoint_list"
109namespace_type = "agnostic"
110type = "endpoint"
111
112[[rule.risk_score_mapping]]
113field = "event.risk_score"
114operator = "equals"
115value = ""
116
117[[rule.severity_mapping]]
118field = "event.severity"
119operator = "equals"
120severity = "low"
121value = "21"
122
123[[rule.severity_mapping]]
124field = "event.severity"
125operator = "equals"
126severity = "medium"
127value = "47"
128
129[[rule.severity_mapping]]
130field = "event.severity"
131operator = "equals"
132severity = "high"
133value = "73"
134
135[[rule.severity_mapping]]
136field = "event.severity"
137operator = "equals"
138severity = "critical"
139value = "99"

Triage and analysis

Investigating Behavior Alerts

Malicious behavior protection is a foundational feature which can be used to protect against all manner of attacks on the endpoint. For example, it provides coverage against phishing such as malicious macros, many malware families based on their activities, privilege escalation attacks such as user account control bypasses (UAC), credential theft, and much more. It works by consuming an unfiltered feed of all events that are captured on the system (process, file, registry, network, dns, etc). These events are processed against a routinely updated set of rules written by Elastic threat experts. From there, malicious behaviors are identified and offending processes are terminated. The protection operates on the event stream asynchronously, but has been designed to be extremely efficient and typically requires just milliseconds (under standard load) to stop malicious activity.

Possible investigation steps

  • Assess whether this activity is prevalent in your environment by looking for similar occurrences across hosts.
  • Verify the detailed activity of the process that triggered the alert (process tree, child process, process arguments, network, files, libraries and registry events).
  • Verify the activity of the user.name associated with the alert (local or remote actity, privileged or standard user).
  • Particular attention should be paid to instances where the same process is triggering multiple alerts (more than 2 or 3) within a short period of time.
  • Even the the process is signed by a valid certificate, verify the if it's running from the expected location or if it's loading any suspicious libraries or any sign of code injection.

False positive analysis

  • Same alert observed on a high number of hosts with similar details.
  • High count of the same alert on a specific host over a long period of time.

Response and Remediation

  • Initiate the incident response process based on the outcome of the triage.
    • If malicious activity is confirmed, perform a broader investigation to identify the scope of the compromise and determine the appropriate remediation steps.
  • Implement Elastic Endpoint Security to detect and prevent further post exploitation activities in the environment.
    • Contain the affected system by isolating it from the network to prevent further spread of the attack.
  • 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.
  • Restore the affected system to its operational state by applying any necessary patches, updates, or configuration changes.
  • 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.
  • 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