Multiple Rare Elastic Defend Behavior Rules by Host

Last updated 6 days ago on 2026-02-19
Created 6 days ago on 2026-02-19

About

Identifies hosts that triggered multiple distinct Elastic Defend behavior rules, while reducing false positives by considering only behavior rules that appear on a single host globally (via INLINE STATS). Hosts with two or more such rare behavior rules are more likely to be compromised and warrant prioritized triage.
Tags
Use Case: Threat DetectionRule Type: Higher-Order RuleData Source: Elastic DefendLanguage: esql
Severity
critical
Risk Score
99
License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

(external, opens in a new tab or window)

Query
text code block:
from logs-endpoint.alerts-* metadata _id | where event.dataset == "endpoint.alerts" and event.code == "behavior" | INLINE STATS hosts = COUNT_DISTINCT(host.id) BY rule.name // excludes rules triggering on multiple hosts to reduce potential FPs | where hosts == 1 | stats Esql.rule_name_count_distinct = COUNT_DISTINCT(rule.name), Esql.rule_name_values = VALUES(rule.name), 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_parent_command_line_values = VALUES(process.parent.command_line), Esql.process_hash_sha256_values = VALUES(process.hash.sha256), Esql.file_path_values = VALUES(file.path), Esql.dll_path_values = VALUES(dll.path), Esql.dll_hash_sha256_values = VALUES(dll.hash.sha256), Esql.user_name_values = VALUES(user.name) by host.id // at least 2 unique rules | where Esql.rule_name_count_distinct >= 2 // populate fields to use in rule exceptions | eval process.hash.sha256 = MV_FIRST(Esql.process_hash_sha256_values), process.executable = MV_FIRST(Esql.process_executable_values), process.parent.executable = MV_FIRST(Esql.process_parent_executable_values), process.command_line = MV_FIRST(Esql.process_command_line_values), user.name = MV_FIRST(Esql.user_name_values) | Keep host.id, user.name, process.executable, process.parent.executable, process.hash.sha256, process.command_line, Esql.*

Install detection rules in Elastic Security

Detect Multiple Rare Elastic Defend Behavior Rules by Host in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).