T1584.002 Elastic Security · Elastic

Detect DNS Server in Elastic Security

Adversaries may compromise third-party DNS servers to support operations. By gaining control over DNS infrastructure, adversaries can alter DNS records to redirect organizational traffic, facilitate credential harvesting, or redirect users to adversary-controlled infrastructure mimicking legitimate services. This technique is used by threat actors including Sea Turtle and LAPSUS$, who modified NS records and DNS configurations to intercept traffic at scale. Unlike acquiring new DNS infrastructure (T1583.002), this involves compromising existing, trusted DNS servers — making detection harder due to the perceived legitimacy of the infrastructure.

MITRE ATT&CK

Tactic
Resource Development
Technique
T1584 Compromise Infrastructure
Sub-technique
T1584.002 DNS Server
Canonical reference
https://attack.mitre.org/techniques/T1584/002/

Elastic Detection Query

Elastic Security (Elastic)
eql
any where
  (
    event.category == "network" and
    event.type == "connection" and
    destination.port == 53 and
    network.direction == "outbound" and
    not destination.ip in ("8.8.8.8", "8.8.4.4", "1.1.1.1", "1.0.0.1", "9.9.9.9") and
    not cidrMatch(destination.ip, "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8")
  )
  or
  (
    event.category == "registry" and
    event.type in ("creation", "change") and
    wildcard(registry.key, "*\\Services\\Tcpip\\Parameters*") and
    registry.value in ("NameServer", "DhcpNameServer", "SearchList", "DhcpDomain")
  )
high severity medium confidence

Detects T1584.002 DNS Server compromise via two signals: (1) outbound TCP/UDP connections to port 53 targeting public IPs not in the authorized resolver list, excluding RFC1918 and loopback ranges; and (2) Windows registry modification events targeting DNS configuration values (NameServer, DhcpNameServer, SearchList, DhcpDomain) under the HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters key tree. Uses Elastic ECS fields from Endpoint or Winlogbeat/Sysmon ingestion.

Data Sources

Elastic Endpoint SecurityWinlogbeat with Sysmon moduleAuditbeat

Required Tables

logs-endpoint.events.network-*logs-endpoint.events.registry-*winlogbeat-*

False Positives & Tuning

  • Endpoints configured to use legitimate public resolvers not in the hardcoded authorized list (e.g., OpenDNS 208.67.222.222, Cloudflare for Teams 162.159.x.x, or internal enterprise forwarders) — the authorized IP list must be expanded to match the organization's DNS policy before deploying
  • Windows DHCP client writing DhcpNameServer and DhcpDomain registry values as part of normal IP lease acquisition or renewal — especially frequent in dynamic environments with short DHCP lease times or frequent network changes
  • VPN clients (GlobalProtect, Cisco AnyConnect, Pulse Secure) that redirect DNS to tunnel-local resolvers by modifying NIC-specific DNS registry keys under Tcpip\Parameters\Interfaces upon tunnel establishment
Download portable Sigma rule (.yml)

Other platforms for T1584.002


Testing Methodology

Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Configure Rogue DNS Server via Registry

    Expected signal: Sysmon Event ID 13 (Registry Value Set): TargetObject containing 'Tcpip\Parameters\Interfaces' and RegistryValueName 'NameServer', with Details '127.0.0.1', Image=reg.exe. Security Event ID 4657 (if object access auditing is enabled for registry). The initiating process reg.exe is unusual for a NameServer modification — legitimate changes come from svchost.exe (DHCP client).

  2. Test 2Direct DNS Query to Rogue Resolver

    Expected signal: Sysmon Event ID 3 (Network Connection): DestinationIp=8.8.8.8, DestinationPort=53, Image=nslookup.exe. Sysmon Event ID 22 (DNS Query): QueryName=microsoft.com, Image=nslookup.exe. If 8.8.8.8 is not in the authorized DNS list, the DeviceNetworkEvents alert fires.

  3. Test 3Modify DNS Server via PowerShell

    Expected signal: Sysmon Event ID 1 (Process Create): Image=powershell.exe, CommandLine containing 'Set-DnsClientServerAddress' and 'ServerAddresses'. Sysmon Event ID 13 (Registry Value Set): TargetObject under Tcpip\Parameters\Interfaces with NameServer value changed, Image=powershell.exe. PowerShell ScriptBlock Logging Event ID 4104 with full command content.

  4. Test 4DNS Query to Multiple Non-Authorized Resolvers

    Expected signal: Three separate Sysmon Event ID 3 (Network Connection) events: DestinationPort=53 to 8.8.8.8, 1.1.1.1, and 9.9.9.9 respectively, Image=nslookup.exe. Three Sysmon Event ID 22 (DNS Query) events for example.com. Sysmon Event ID 1 for cmd.exe and nslookup.exe process creations.

Unlock Pro Content

Get the full detection package for T1584.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections