Skip to content

Commit 24d0ad9

Browse files
Merge branch 'main' into new-rule-user-agents
2 parents 5425c6d + fda139f commit 24d0ad9

10 files changed

+598
-82
lines changed
483 Bytes
Binary file not shown.
8.23 KB
Binary file not shown.

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",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "detection_rules"
3-
version = "1.5.14"
3+
version = "1.5.15"
44
description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine."
55
readme = "README.md"
66
requires-python = ">=3.12"
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/18"
3+
integration = ["endpoint", "panw", "fortinet_fortigate", "suricata"]
4+
maturity = "production"
5+
updated_date = "2025/11/18"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule correlate any Elastic Defend alert with a set of suspicious events from Network security devices like Palo Alto
11+
Networks (PANW) and Fortinet Fortigate by host.ip and source.ip. This may indicate that this host is compromised and
12+
triggering multi-datasource alerts.
13+
"""
14+
from = "now-60m"
15+
interval = "10m"
16+
language = "esql"
17+
license = "Elastic License v2"
18+
name = "Elastic Defend and Network Security Alerts Correlation"
19+
risk_score = 73
20+
rule_id = "0bca7e73-e1b5-4fb2-801b-9b5f5be20dfe"
21+
severity = "high"
22+
tags = [
23+
"Use Case: Threat Detection",
24+
"Rule Type: Higher-Order Rule",
25+
"Resources: Investigation Guide",
26+
"Data Source: Elastic Defend",
27+
"Data Source: Fortinet",
28+
"Data Source: PAN-OS"
29+
]
30+
timestamp_override = "event.ingested"
31+
type = "esql"
32+
33+
query = '''
34+
FROM logs-* metadata _id
35+
| WHERE
36+
// Elastic Defend Alerts
37+
(event.module == "endpoint" and event.dataset == "endpoint.alerts") or
38+
39+
// PANW suspicious events
40+
(event.dataset == "panw.panos" and
41+
event.action in ("virus_detected", "wildfire_virus_detected", "c2_communication", "spyware_detected", "large_upload", "denied", "exploit_detected")) or
42+
43+
// Fortigate suspicious events
44+
(event.dataset == "fortinet_fortigate.log" and
45+
(event.action in ("outbreak-prevention", "deny", "infected", "blocked") or message like "backdoor*" or message like "Proxy*" or message like "anomaly*" or message like "P2P*" or message like "misc*" or message like "DNS.Over.HTTPS" or message like "Remote.Access")) or
46+
47+
// Suricata
48+
(event.dataset == "suricata.eve" and message in ("Command and Control Traffic", "Potentially Bad Traffic", "A Network Trojan was detected", "Detection of a Network Scan", "Domain Observed Used for C2 Detected", "Malware Command and Control Activity Detected"))
49+
50+
// extract source.ip from PANW or Fortigate events and host.ip from Elastic Defend alert
51+
|eval fw_alert_source_ip = CASE(event.dataset in ("panw.panos", "fortinet_fortigate.log"), source.ip, null),
52+
elastic_defend_alert_host_ip = CASE(event.module == "endpoint" and event.dataset == "endpoint.alerts", host.ip, null)
53+
| eval Esql.source_ip = COALESCE(fw_alert_source_ip, elastic_defend_alert_host_ip)
54+
| where Esql.source_ip is not null
55+
56+
// group by host_source_ip shared between FG/PANW and Elastic Defend
57+
| stats Esql.alerts_count = COUNT(*),
58+
Esql.event_module_distinct_count = COUNT_DISTINCT(event.module),
59+
Esql.event_module_values = VALUES(event.module),
60+
Esql.message_values = VALUES(message),
61+
Esql.event_action_values = VALUES(event.action),
62+
Esql.process_executable_values = VALUES(process.executable),
63+
Esql.host_id_values = VALUES(host.id),
64+
Esql.user_name_values = VALUES(user.name),
65+
Esql.destination_ip_values = VALUES(destination.ip)
66+
by Esql.source_ip
67+
| where Esql.event_module_distinct_count >= 2
68+
| keep Esql.alerts_count, Esql.source_ip, Esql.destination_ip_values, Esql.host_id_values, Esql.user_name_values, Esql.event_module_values, Esql.message_values, Esql.process_executable_values
69+
'''
70+
note = """## Triage and analysis
71+
72+
### Investigating Elastic Defend and Network Security Alerts Correlation
73+
74+
This rule correlate any Elastic Defend alert with suspicious events from Network Security datasources like Palo Alto Networks (PANW), Fortinet Fortigate and Suricata by host.ip and source.ip.
75+
76+
### Possible investigation steps
77+
78+
- Review the alert details to identify the specific host and users involved.
79+
- Investiguate the network alerts by destination.ip and message.
80+
- 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.
81+
- 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.
82+
- 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.
83+
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
84+
85+
### False positive analysis
86+
87+
- IP address ranges overlap where the host.ip value from the Elastic Defend alert is unrelated to the source.ip value from the Network Security alert.
88+
- Alerts from routine administrative tasks may trigger multiple alerts. Review and exclude known benign activities such as scheduled software updates or system maintenance.
89+
- Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise.
90+
- Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening.
91+
- Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score.
92+
- User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities.
93+
94+
### Response and remediation
95+
96+
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
97+
- Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved.
98+
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
99+
- Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks.
100+
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
101+
- 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.
102+
- 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."""
103+
104+
105+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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 correlates any Elastic Defend alert with an email security related alert by target user name. This may indicate
10+
the successful execution of a phishing attack.
11+
"""
12+
from = "now-1h"
13+
interval = "45m"
14+
language = "esql"
15+
license = "Elastic License v2"
16+
name = "Elastic Defend and Email Alerts Correlation"
17+
risk_score = 73
18+
rule_id = "c562a800-cf97-464e-9d6f-84db91e86e10"
19+
severity = "high"
20+
tags = [
21+
"Use Case: Threat Detection",
22+
"Rule Type: Higher-Order Rule",
23+
"Resources: Investigation Guide",
24+
"Data Source: Elastic Defend",
25+
"Domain: Email",
26+
"Domain: Endpoint"
27+
]
28+
timestamp_override = "event.ingested"
29+
type = "esql"
30+
31+
query = '''
32+
from logs-* metadata _id
33+
// Email or Elastic Defend alerts where user name is populated
34+
| where
35+
(event.category == "email" and event.kind == "alert" and destination.user.name is not null) or
36+
(event.module == "endpoint" and event.dataset == "endpoint.alerts" and user.name is not null)
37+
38+
// extract target user name from email and endpoint alerts
39+
| eval email_alert_target_user_name = CASE(event.category == "email", destination.user.name, null),
40+
elastic_defend_alert_user_name = CASE(event.module == "endpoint" and event.dataset == "endpoint.alerts", user.name, null)
41+
| eval Esql.target_user_name = COALESCE(email_alert_target_user_name, elastic_defend_alert_user_name)
42+
| where Esql.target_user_name is not null
43+
44+
// group by Esql.target_user_name
45+
| stats Esql.alerts_count = COUNT(*),
46+
Esql.event_module_distinct_count = COUNT_DISTINCT(event.module),
47+
Esql.event_module_values = VALUES(event.module),
48+
Esql.message_values = VALUES(message),
49+
Esql.event_action_values = VALUES(event.action),
50+
Esql.process_executable_values = VALUES(process.executable),
51+
Esql.host_id_values = VALUES(host.id),
52+
Esql.source_user_name = VALUES(source.user.name),
53+
Esql.rule_name_values = VALUES(rule.name)
54+
by Esql.target_user_name
55+
// alert when same user is observed in an endpoint and email alert
56+
| where Esql.event_module_distinct_count >= 2
57+
| keep Esql.alerts_count, Esql.event_module_values, Esql.host_id_values, Esql.source_user_name, Esql.target_user_name, Esql.message_values, Esql.rule_name_values, Esql.event_action_values
58+
'''
59+
note = """## Triage and analysis
60+
### Investigating Elastic Defend and Email Alerts Correlation
61+
62+
This rule correlates any Elastic Defend alert with an email security related alert by target user name.
63+
64+
### Possible investigation steps
65+
- Review the alert details to identify the specific host and users involved.
66+
- Investigate the individual alerts for the target user name and see if they are related.
67+
- Review all emails received from Esql.source_user_name and if there are other impacted users.
68+
- 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.
69+
- Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity.
70+
71+
### False positive analysis
72+
- Legitimate email marked as suspicious.
73+
- Legitimate file or behavior marked as suspicious by Elastic Defend.
74+
- Unrelated alerts where the target user name is too generic.
75+
76+
### Response and remediation
77+
- Isolate the affected host from the network immediately to prevent further lateral movement by the adversary.
78+
- Conduct a thorough forensic analysis of the host.
79+
- Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated.
80+
- Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise.
81+
- 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.
82+
- 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."""

0 commit comments

Comments
 (0)