Skip to content

Commit 2b7de6c

Browse files
Samirboustradebot-elastic
authored andcommitted
[New] Alerts in Different ATT&CK Tactics by Host (#5343)
* [New] Alerts in Different ATT&CK Tactics by Host Using ES|QL and alerts risk score to identify top risky hosts based on presence of multiple alert touching at least 4 unique tactics in a 24h time Window. * Update multiple_alerts_risky_host_esql.toml * Update multiple_alerts_risky_host_esql.toml * Update multiple_alerts_risky_host_esql.toml * Update multiple_alerts_risky_host_esql.toml * Update multiple_alerts_risky_host_esql.toml * Update non-ecs-schema.json * ++ * Update multiple_alerts_edr_elastic_defend_by_host.toml --------- Co-authored-by: shashank-elastic <[email protected]> (cherry picked from commit fda139f)
1 parent 9cdf2b9 commit 2b7de6c

File tree

3 files changed

+206
-1
lines changed

3 files changed

+206
-1
lines changed

detection_rules/etc/non-ecs-schema.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@
145145
"kibana.alert.rule.threat.tactic.id": "keyword",
146146
"kibana.alert.workflow_status": "keyword",
147147
"kibana.alert.rule.rule_id": "keyword",
148-
"kibana.alert.rule.name": "keyword"
148+
"kibana.alert.rule.name": "keyword",
149+
"kibana.alert.risk_score": "long",
150+
"kibana.alert.rule.type": "keyword",
151+
"kibana.alert.rule.threat.tactic.name": "keyword"
149152
},
150153
"logs-google_workspace*": {
151154
"gsuite.admin": "keyword",
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
[metadata]
2+
creation_date = "2025/11/19"
3+
maturity = "production"
4+
updated_date = "2025/11/19"
5+
6+
[rule]
7+
author = ["Elastic"]
8+
description = """
9+
This rule uses alert data to determine when multiple alerts from Elastic Defend involving the same host are triggered.
10+
Analysts can use this to prioritize triage and response, as these hosts are more likely to be compromised.
11+
"""
12+
from = "now-60m"
13+
interval = "30m"
14+
language = "esql"
15+
license = "Elastic License v2"
16+
name = "Multiple Elastic Defend Alerts by Agent"
17+
risk_score = 73
18+
rule_id = "ab25369e-ea5e-46f1-9cd5-478a0a4a131a"
19+
severity = "high"
20+
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide", "Data Source: Elastic Defend"]
21+
timestamp_override = "event.ingested"
22+
type = "esql"
23+
24+
query = '''
25+
from logs-endpoint.alerts-* metadata _id
26+
| eval target_time_window = DATE_TRUNC(24 hours, @timestamp)
27+
| where event.code in ("malicious_file", "memory_signature", "shellcode_thread", "behavior") and
28+
agent.id is not null and not rule.name in ("Multi.EICAR.Not-a-virus")
29+
| stats Esql.alerts_count = COUNT(*),
30+
Esql.event_code_distinct_count = count_distinct(event.code),
31+
Esql.rule_name_distinct_count = COUNT_DISTINCT(rule.name),
32+
Esql.file_hash_distinct_count = COUNT_DISTINCT(file.hash.sha256),
33+
Esql.process_name_distinct_count = COUNT_DISTINCT(process.entity_id),
34+
Esql.event_code_values = VALUES(event.code),
35+
Esql.rule_name_values = VALUES(rule.name),
36+
Esql.message_values = VALUES(message),
37+
Esql.file_path_values = VALUES(file.path),
38+
Esql.dll_path_values = VALUES(dll.path),
39+
Esql.process_executable_values = VALUES(process.executable),
40+
Esql.process_parent_executable_values = VALUES(process.parent.executable),
41+
Esql.process_command_line_values = VALUES(process.command_line),
42+
Esql.process_hash_sha256_values = VALUES(process.hash.sha256),
43+
Esql.file_hash_sha256_values = VALUES(file.hash.sha256),
44+
Esql.dll_hash_sha256_values = VALUES(dll.hash.sha256) by agent.id
45+
| where (Esql.event_code_distinct_count >= 2 or Esql.rule_name_distinct_count >= 3 or Esql.file_hash_distinct_count >= 2)
46+
| keep agent.id,
47+
Esql.alerts_count,
48+
Esql.event_code_distinct_count,
49+
Esql.rule_name_distinct_count,
50+
Esql.message_values,
51+
Esql.event_code_values,
52+
Esql.rule_name_values,
53+
Esql.process_executable_values,
54+
Esql.process_parent_executable_values,
55+
Esql.process_command_line_values,
56+
Esql.file_path_values,
57+
Esql.dll_path_values,
58+
Esql.process_hash_sha256_values,
59+
Esql.file_hash_sha256_values,
60+
Esql.dll_hash_sha256_values
61+
'''
62+
note = """## Triage and analysis
63+
64+
> **Disclaimer**:
65+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
66+
67+
### Investigating Multiple Elastic Defend Alerts by Agent
68+
69+
Endpoint security technologies monitor and analyze activities on devices to detect malicious behavior. Adversaries exploit these systems by deploying malware that triggers specific signatures across multiple hosts, indicating a coordinated attack. The detection rule identifies such threats by analyzing alert data for specific malware signatures across several hosts, flagging potential widespread infections for prioritized investigation.
70+
71+
### Possible investigation steps
72+
73+
- Review the alert details to identify the specific host involved and the different ATT&CK tactics that triggered the alerts.
74+
- Examine the timeline of the alerts to understand the sequence of events and determine if there is a pattern or progression in the tactics used.
75+
- Correlate the alert data with other logs and telemetry from the host, such as process creation, network connections, and file modifications, to gather additional context.
76+
- Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary.
77+
- Check for any indicators of compromise (IOCs) associated with the alerts, such as suspicious IP addresses, domains, or file hashes, and search for these across the network.
78+
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
79+
80+
### False positive analysis
81+
82+
- Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance.
83+
- Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise.
84+
- Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening.
85+
- Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score.
86+
- User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities.
87+
88+
### Response and remediation
89+
90+
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
91+
- Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved.
92+
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
93+
- Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks.
94+
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
95+
- Monitor the host and network for any signs of re-infection or further suspicious activity, using enhanced logging and alerting based on the identified attack patterns.
96+
- Escalate the incident to the appropriate internal or external cybersecurity teams for further investigation and potential legal action if the attack is part of a larger campaign."""
97+
references = ["https://github.com/elastic/protections-artifacts/tree/main/yara/rules"]
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
[metadata]
2+
creation_date = "2025/11/19"
3+
maturity = "production"
4+
updated_date = "2025/11/19"
5+
6+
[rule]
7+
author = ["Elastic"]
8+
description = """
9+
This rule uses alert data to determine when multiple alerts in different phases of an attack involving the same host are
10+
triggered and where the accumulated risk score is higher than a defined threshold. Analysts can use this to prioritize
11+
triage and response, as these hosts are more likely to be compromised.
12+
"""
13+
from = "now-8h"
14+
interval = "1h"
15+
language = "esql"
16+
license = "Elastic License v2"
17+
name = "Alerts in Different ATT&CK Tactics by Host"
18+
risk_score = 73
19+
rule_id = "29531d20-0e80-41d4-9ec6-d6b58e4a475c"
20+
severity = "high"
21+
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide"]
22+
timestamp_override = "event.ingested"
23+
type = "esql"
24+
25+
query = '''
26+
from .alerts-security.* metadata _id
27+
28+
// filter for alerts with populated risk score, excluding threat_match rules, deprecated and some other noisy ones.
29+
| where kibana.alert.risk_score > 0 and
30+
kibana.alert.rule.name IS NOT NULL and
31+
host.id is not null and event.dataset is not null and
32+
kibana.alert.rule.type != "threat_match" and
33+
not kibana.alert.rule.name in ("Agent Spoofing - Mismatched Agent ID") and
34+
not kibana.alert.rule.name like "Deprecated - *"
35+
36+
// extract unique counts and values by host.id
37+
| stats Esql.alerts_count = COUNT(*),
38+
Esql.kibana_alert_rule_name_distinct_count = COUNT_DISTINCT(kibana.alert.rule.name),
39+
Esql.event_module_distinct_count = COUNT_DISTINCT(event.module),
40+
Esql.event_module_values = VALUES(event.module),
41+
Esql.kibana_alert_rule_name_values = VALUES(kibana.alert.rule.name),
42+
Esql.threat_tactic_id_distinct_count = COUNT_DISTINCT(kibana.alert.rule.threat.tactic.id),
43+
Esql.threat_tactic_name_values = VALUES(kibana.alert.rule.threat.tactic.name),
44+
Esql.kibana_alert_risk_score_sum = sum(kibana.alert.risk_score),
45+
Esql.process_executable_values = VALUES(process.executable),
46+
Esql.process_parent_executable_values = VALUES(process.parent.executable),
47+
Esql.process_command_line_values = VALUES(process.command_line),
48+
Esql.process_entity_id_distinct_count = COUNT_DISTINCT(process.entity_id) by host.id
49+
50+
// divide the sum of risk scores by the total number of alerts
51+
| eval Esql.risk_alerts_count_ratio = Esql.kibana_alert_risk_score_sum/Esql.alerts_count
52+
53+
// filter for risky hosts by risk score and unique count of rules and tactics
54+
| where Esql.kibana_alert_rule_name_distinct_count >= 5 and Esql.threat_tactic_id_distinct_count >= 3 and Esql.threat_tactic_id_distinct_count >= 3 and Esql.alerts_count <= 500 and Esql.risk_alerts_count_ratio >= 50
55+
56+
// fiels populated in the resulting alert
57+
| keep host.id,
58+
Esql.alerts_count,
59+
Esql.kibana_alert_risk_score_sum,
60+
Esql.risk_alerts_count_ratio,
61+
Esql.kibana_alert_rule_name_distinct_count,
62+
Esql.event_module_values,
63+
Esql.kibana_alert_rule_name_values,
64+
Esql.threat_tactic_name_values,
65+
Esql.process_executable_values,
66+
Esql.process_parent_executable_values,
67+
Esql.process_command_line_values
68+
'''
69+
note = """## Triage and analysis
70+
71+
> **Disclaimer**:
72+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
73+
74+
### Investigating Alerts in Different ATT&CK Tactics by Host
75+
76+
The detection rule identifies hosts with alerts across various attack phases, indicating potential compromise. Adversaries exploit system vulnerabilities, moving through different tactics like execution, persistence, and exfiltration. This rule prioritizes hosts with diverse tactic alerts, aiding analysts in focusing on high-risk threats by correlating alert data to detect complex attack patterns.
77+
78+
### Possible investigation steps
79+
80+
- Review the alert details to identify the specific host involved and the different ATT&CK tactics that triggered the alerts.
81+
- Examine the timeline of the alerts to understand the sequence of events and determine if there is a pattern or progression in the tactics used.
82+
- Correlate the alert data with other logs and telemetry from the host, such as process creation, network connections, and file modifications, to gather additional context.
83+
- Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary.
84+
- Check for any indicators of compromise (IOCs) associated with the alerts, such as suspicious IP addresses, domains, or file hashes, and search for these across the network.
85+
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
86+
87+
### False positive analysis
88+
89+
- Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance.
90+
- Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise.
91+
- Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening.
92+
- Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score.
93+
- User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities.
94+
95+
### Response and remediation
96+
97+
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
98+
- Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved.
99+
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
100+
- Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks.
101+
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
102+
- Monitor the host and network for any signs of re-infection or further suspicious activity, using enhanced logging and alerting based on the identified attack patterns.
103+
- Escalate the incident to the appropriate internal or external cybersecurity teams for further investigation and potential legal action if the attack is part of a larger campaign."""
104+
105+

0 commit comments

Comments
 (0)