-
Notifications
You must be signed in to change notification settings - Fork 611
[New] Alerts in Different ATT&CK Tactics by Host #5343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Samirbous
wants to merge
9
commits into
main
Choose a base branch
from
multi-alert-host-esql
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+206
−1
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
64dfae9
[New] Alerts in Different ATT&CK Tactics by Host
Samirbous 5ddc408
Update multiple_alerts_risky_host_esql.toml
Samirbous c6a9e66
Update multiple_alerts_risky_host_esql.toml
Samirbous d160a0c
Update multiple_alerts_risky_host_esql.toml
Samirbous f542103
Update multiple_alerts_risky_host_esql.toml
Samirbous e5ded41
Update multiple_alerts_risky_host_esql.toml
Samirbous 35a998b
Update non-ecs-schema.json
Samirbous dc3eeb7
++
Samirbous 8bdba21
Update multiple_alerts_edr_elastic_defend_by_host.toml
Samirbous File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
rules/cross-platform/multiple_alerts_edr_elastic_defend_by_host.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| [metadata] | ||
| creation_date = "2025/11/19" | ||
| maturity = "production" | ||
| updated_date = "2025/11/19" | ||
|
|
||
| [rule] | ||
| author = ["Elastic"] | ||
| description = """ | ||
| This rule uses alert data to determine when multiple alerts from Elastic Defend involving the same host are triggered. | ||
| Analysts can use this to prioritize triage and response, as these hosts are more likely to be compromised. | ||
| """ | ||
| from = "now-60m" | ||
| interval = "30m" | ||
| language = "esql" | ||
| license = "Elastic License v2" | ||
| name = "Multiple Elastic Defend Alerts by Agent" | ||
| risk_score = 73 | ||
| rule_id = "ab25369e-ea5e-46f1-9cd5-478a0a4a131a" | ||
| severity = "high" | ||
| tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide", "Data Source: Elastic Defend"] | ||
| timestamp_override = "event.ingested" | ||
| type = "esql" | ||
|
|
||
| query = ''' | ||
| from logs-endpoint.alerts-* metadata _id | ||
| | eval target_time_window = DATE_TRUNC(24 hours, @timestamp) | ||
| | where event.code in ("malicious_file", "memory_signature", "shellcode_thread", "behavior") and | ||
| agent.id is not null and not rule.name in ("Multi.EICAR.Not-a-virus") | ||
| | stats Esql.alerts_count = COUNT(*), | ||
| Esql.event_code_distinct_count = count_distinct(event.code), | ||
| Esql.rule_name_distinct_count = COUNT_DISTINCT(rule.name), | ||
| Esql.file_hash_distinct_count = COUNT_DISTINCT(file.hash.sha256), | ||
| Esql.process_name_distinct_count = COUNT_DISTINCT(process.entity_id), | ||
| Esql.event_code_values = VALUES(event.code), | ||
| Esql.rule_name_values = VALUES(rule.name), | ||
| Esql.message_values = VALUES(message), | ||
| Esql.file_path_values = VALUES(file.path), | ||
| Esql.dll_path_values = VALUES(dll.path), | ||
| Esql.process_executable_values = VALUES(process.executable), | ||
| Esql.process_parent_executable_values = VALUES(process.parent.executable), | ||
| Esql.process_command_line_values = VALUES(process.command_line), | ||
| Esql.process_hash_sha256_values = VALUES(process.hash.sha256), | ||
| Esql.file_hash_sha256_values = VALUES(file.hash.sha256), | ||
| Esql.dll_hash_sha256_values = VALUES(dll.hash.sha256) by agent.id | ||
| | where (Esql.event_code_distinct_count >= 2 or Esql.rule_name_distinct_count >= 3 or Esql.file_hash_distinct_count >= 2) | ||
| | keep agent.id, | ||
| Esql.alerts_count, | ||
| Esql.event_code_distinct_count, | ||
| Esql.rule_name_distinct_count, | ||
| Esql.message_values, | ||
| Esql.event_code_values, | ||
| Esql.rule_name_values, | ||
| Esql.process_executable_values, | ||
| Esql.process_parent_executable_values, | ||
| Esql.process_command_line_values, | ||
| Esql.file_path_values, | ||
| Esql.dll_path_values, | ||
| Esql.process_hash_sha256_values, | ||
| Esql.file_hash_sha256_values, | ||
| Esql.dll_hash_sha256_values | ||
| ''' | ||
| note = """## Triage and analysis | ||
|
|
||
| > **Disclaimer**: | ||
| > 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. | ||
|
|
||
| ### Investigating Multiple Elastic Defend Alerts by Agent | ||
|
|
||
| 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. | ||
|
|
||
| ### Possible investigation steps | ||
|
|
||
| - Review the alert details to identify the specific host involved and the different ATT&CK tactics that triggered the alerts. | ||
| - 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. | ||
| - 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. | ||
| - Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary. | ||
| - 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. | ||
| - Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity. | ||
|
|
||
| ### False positive analysis | ||
|
|
||
| - Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance. | ||
| - Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise. | ||
| - Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening. | ||
| - Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score. | ||
| - User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities. | ||
|
|
||
| ### Response and remediation | ||
|
|
||
| - Isolate the affected host from the network immediately to prevent further lateral movement by the adversary. | ||
| - Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved. | ||
| - Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated. | ||
| - Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks. | ||
| - Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise. | ||
| - 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. | ||
| - 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.""" | ||
| references = ["https://github.com/elastic/protections-artifacts/tree/main/yara/rules"] | ||
105 changes: 105 additions & 0 deletions
105
rules/cross-platform/multiple_alerts_risky_host_esql.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| [metadata] | ||
| creation_date = "2025/11/19" | ||
| maturity = "production" | ||
| updated_date = "2025/11/19" | ||
|
|
||
| [rule] | ||
| author = ["Elastic"] | ||
| description = """ | ||
| This rule uses alert data to determine when multiple alerts in different phases of an attack involving the same host are | ||
| triggered and where the accumulated risk score is higher than a defined threshold. Analysts can use this to prioritize | ||
| triage and response, as these hosts are more likely to be compromised. | ||
| """ | ||
| from = "now-8h" | ||
| interval = "1h" | ||
| language = "esql" | ||
| license = "Elastic License v2" | ||
| name = "Alerts in Different ATT&CK Tactics by Host" | ||
| risk_score = 73 | ||
| rule_id = "29531d20-0e80-41d4-9ec6-d6b58e4a475c" | ||
| severity = "high" | ||
| tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide"] | ||
| timestamp_override = "event.ingested" | ||
| type = "esql" | ||
|
|
||
| query = ''' | ||
| from .alerts-security.* metadata _id | ||
|
|
||
| // filter for alerts with populated risk score, excluding threat_match rules, deprecated and some other noisy ones. | ||
| | where kibana.alert.risk_score > 0 and | ||
| kibana.alert.rule.name IS NOT NULL and | ||
| host.id is not null and event.dataset is not null and | ||
| kibana.alert.rule.type != "threat_match" and | ||
| not kibana.alert.rule.name in ("Agent Spoofing - Mismatched Agent ID") and | ||
| not kibana.alert.rule.name like "Deprecated - *" | ||
|
|
||
| // extract unique counts and values by host.id | ||
| | stats Esql.alerts_count = COUNT(*), | ||
| Esql.kibana_alert_rule_name_distinct_count = COUNT_DISTINCT(kibana.alert.rule.name), | ||
| Esql.event_module_distinct_count = COUNT_DISTINCT(event.module), | ||
| Esql.event_module_values = VALUES(event.module), | ||
| Esql.kibana_alert_rule_name_values = VALUES(kibana.alert.rule.name), | ||
| Esql.threat_tactic_id_distinct_count = COUNT_DISTINCT(kibana.alert.rule.threat.tactic.id), | ||
| Esql.threat_tactic_name_values = VALUES(kibana.alert.rule.threat.tactic.name), | ||
| Esql.kibana_alert_risk_score_sum = sum(kibana.alert.risk_score), | ||
| Esql.process_executable_values = VALUES(process.executable), | ||
| Esql.process_parent_executable_values = VALUES(process.parent.executable), | ||
| Esql.process_command_line_values = VALUES(process.command_line), | ||
| Esql.process_entity_id_distinct_count = COUNT_DISTINCT(process.entity_id) by host.id | ||
|
|
||
| // divide the sum of risk scores by the total number of alerts | ||
| | eval Esql.risk_alerts_count_ratio = Esql.kibana_alert_risk_score_sum/Esql.alerts_count | ||
|
|
||
| // filter for risky hosts by risk score and unique count of rules and tactics | ||
| | 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 | ||
|
|
||
| // fiels populated in the resulting alert | ||
| | keep host.id, | ||
| Esql.alerts_count, | ||
| Esql.kibana_alert_risk_score_sum, | ||
| Esql.risk_alerts_count_ratio, | ||
| Esql.kibana_alert_rule_name_distinct_count, | ||
| Esql.event_module_values, | ||
| Esql.kibana_alert_rule_name_values, | ||
| Esql.threat_tactic_name_values, | ||
| Esql.process_executable_values, | ||
| Esql.process_parent_executable_values, | ||
| Esql.process_command_line_values | ||
| ''' | ||
| note = """## Triage and analysis | ||
|
|
||
| > **Disclaimer**: | ||
| > 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. | ||
|
|
||
| ### Investigating Alerts in Different ATT&CK Tactics by Host | ||
|
|
||
| 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. | ||
|
|
||
| ### Possible investigation steps | ||
|
|
||
| - Review the alert details to identify the specific host involved and the different ATT&CK tactics that triggered the alerts. | ||
| - 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. | ||
| - 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. | ||
| - Investigate any known vulnerabilities or misconfigurations on the host that could have been exploited by the adversary. | ||
| - 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. | ||
| - Assess the impact and scope of the potential compromise by determining if other hosts or systems have similar alerts or related activity. | ||
|
|
||
| ### False positive analysis | ||
|
|
||
| - Alerts from routine administrative tasks may trigger multiple tactics. Review and exclude known benign activities such as scheduled software updates or system maintenance. | ||
| - Security tools running on the host might generate alerts across different tactics. Identify and exclude alerts from trusted security applications to reduce noise. | ||
| - Automated scripts or batch processes can mimic adversarial behavior. Analyze and whitelist these processes if they are verified as non-threatening. | ||
| - Frequent alerts from development or testing environments can be misleading. Consider excluding these environments from the rule or applying a different risk score. | ||
| - User behavior anomalies, such as accessing multiple systems or applications, might trigger alerts. Implement user behavior baselines to differentiate between normal and suspicious activities. | ||
|
|
||
| ### Response and remediation | ||
|
|
||
| - Isolate the affected host from the network immediately to prevent further lateral movement by the adversary. | ||
| - Conduct a thorough forensic analysis of the host to identify the specific vulnerabilities exploited and gather evidence of the attack phases involved. | ||
| - Remove any identified malicious software or unauthorized access tools from the host, ensuring all persistence mechanisms are eradicated. | ||
| - Apply security patches and updates to the host to address any exploited vulnerabilities and prevent similar attacks. | ||
| - Restore the host from a known good backup if necessary, ensuring that the backup is free from compromise. | ||
| - 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. | ||
| - 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.""" | ||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to test whether this could cause performance problems, coz it looks expensive 👀