text code block:from logs-network_traffic.dhcpv4-*, packetbeat-* | eval Esql.message_type = TO_LOWER(COALESCE(network_traffic.dhcpv4.option.message_type, dhcpv4.option.message_type)), Esql.client_mac = COALESCE(network_traffic.dhcpv4.client_mac, dhcpv4.client_mac), Esql.observer_hostname = COALESCE(host.name, observer.hostname) | where Esql.message_type == "discover" and Esql.client_mac is not null and Esql.observer_hostname is not null | eval Esql.time_window = DATE_TRUNC(1 minute, @timestamp) | stats Esql.dhcpv4_discover_count = COUNT(*), Esql.dhcpv4_client_mac_count_distinct = COUNT_DISTINCT(Esql.client_mac), Esql.dhcpv4_client_mac_values = MV_SLICE(VALUES(Esql.client_mac), 0, 10) by Esql.time_window, Esql.observer_hostname | where Esql.dhcpv4_discover_count >= 75 and Esql.dhcpv4_client_mac_count_distinct >= 50 | keep Esql.observer_hostname, Esql.time_window, Esql.dhcpv4_discover_count, Esql.dhcpv4_client_mac_count_distinct, Esql.dhcpv4_client_mac_values
Install detection rules in Elastic Security
Detect Potential DHCP Starvation via High Client MAC Cardinality 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).