Elastic high stable kql

Multiple DHCP Servers Responding to the Same Transaction

Identifies two or more distinct DHCP servers sending an OFFER or ACK for the same transaction ID (xid) within a short window, indicating a rogue DHCP server racing the legitimate one to win the client's handshake. This is the rogue-DHCP / adversary-in-the-middle precondition (T1557.003) and is operating-system agnostic, since it keys only on server behavior observed on the wire. Winning the race lets an attacker intercept traffic via a hostile gateway/DNS, bypass a VPN (TunnelVision), or deliver a malformed response that exploits the client's DHCP parser for code execution.

View Source

Detection Logic

from logs-network_traffic.dhcpv4-*, packetbeat-* metadata _source
| eval
    message_type = TO_LOWER(COALESCE(
        JSON_EXTRACT(_source, "network_traffic.dhcpv4.option.message_type"),
        JSON_EXTRACT(_source, "dhcpv4.option.message_type")
    )),
    Esql.transaction_id = COALESCE(
        JSON_EXTRACT(_source, "network_traffic.dhcpv4.transaction_id"),
        JSON_EXTRACT(_source, "dhcpv4.transaction_id")
    ),
    server_identifier = COALESCE(
        JSON_EXTRACT(_source, "network_traffic.dhcpv4.option.server_identifier"),
        JSON_EXTRACT(_source, "dhcpv4.option.server_identifier")
    )
| where message_type in ("offer", "ack") and Esql.transaction_id is not null and source.ip is not null
| eval Esql.time_window = DATE_TRUNC(30 seconds, @timestamp)
| stats
    Esql.count_distinct_servers = COUNT_DISTINCT(source.ip),
    Esql.values_server_ips = VALUES(source.ip),
    Esql.values_server_identifiers = VALUES(server_identifier),
    Esql.count_replies = COUNT(*)
  by Esql.time_window, Esql.transaction_id
| where Esql.count_distinct_servers >= 2
| keep Esql.transaction_id, Esql.time_window, Esql.count_distinct_servers, Esql.values_server_ips, Esql.values_server_identifiers, Esql.count_replies

Field Validations

Loading…

Comments (0)

Loading comments...