Defense Evasion (TA0005)(external, opens in a new tab or window)
text code block:from logs-endpoint.* metadata _id | where event.agent_id_status is not null and agent.id is not null | stats Esql.count_distinct_host_ids = count_distinct(host.id), Esql.host_id_values = values(host.id), Esql.user_id_values_user_id = values(user.id) by agent.id | where Esql.count_distinct_host_ids >= 2 | keep Esql.count_distinct_host_ids, Esql.host_id_values, Esql.user_id_values_user_id, agent.id
Install detection rules in Elastic Security
Detect Agent Spoofing - Multiple Hosts Using Same Agent 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).