DNS Server
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.
// Part 1: Detect endpoints querying non-authorized DNS servers (port 53 to unexpected destinations)
let AuthorizedDNSServers = dynamic(["8.8.8.8", "8.8.4.4", "1.1.1.1", "1.0.0.1", "9.9.9.9"]); // Customize with your org's DNS IPs
let InternalRanges = dynamic(["10.", "172.16.", "172.17.", "172.18.", "172.19.", "172.20.", "172.21.", "172.22.", "172.23.", "172.24.", "172.25.", "172.26.", "172.27.", "172.28.", "172.29.", "172.30.", "172.31.", "192.168."]);
DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemotePort == 53
| where RemoteIPType == "Public"
| where not(RemoteIP has_any (AuthorizedDNSServers))
| where not(LocalIP has_any (InternalRanges))
| project Timestamp, DeviceName, LocalIP, RemoteIP, RemotePort, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName
| extend Indicator = "Rogue DNS Server Query"
| union (
// Part 2: Detect DNS configuration changes via registry (changing DNS server settings)
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_all ("SYSTEM", "CurrentControlSet", "Services", "Tcpip", "Parameters", "Interfaces")
| where RegistryValueName in~ ("NameServer", "DhcpNameServer", "SearchList", "DhcpDomain")
| where ActionType in~ ("RegistryValueSet", "RegistryKeyCreated")
| project Timestamp, DeviceName=DeviceName, LocalIP="", RemoteIP=RegistryCurrentValueData, RemotePort=53, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName
| extend Indicator = "DNS Configuration Changed"
)
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Developers or researchers intentionally using alternative public DNS resolvers (1.1.1.1, 9.9.9.9, 8.8.8.8) for testing — common on developer workstations if these are not in the authorized list
- VPN clients that change DNS server assignments upon connecting, particularly split-tunnel configurations that use provider DNS
- DHCP lease renewals that legitimately update DhcpNameServer registry values as part of normal network operations
- Containerization platforms (Docker Desktop, WSL2) that configure their own virtual DNS resolvers pointing to non-standard IPs
- Mobile hotspot tethering or public WiFi usage where the DHCP-assigned DNS differs from corporate infrastructure
References (11)
- https://attack.mitre.org/techniques/T1584/002/
- https://www.fireeye.com/blog/threat-research/2019/01/global-dns-hijacking-campaign-dns-record-manipulation-at-scale.html
- https://www.crowdstrike.com/blog/widespread-dns-hijacking-activity-targets-multiple-sectors/
- https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html
- https://blog.talosintelligence.com/2019/04/seaturtle.html
- https://blogs.cisco.com/security/talos/angler-domain-shadowing
- https://www.proofpoint.com/us/threat-insight/post/The-Shadow-Knows
- https://cybercx.com.au/blog/keys-to-the-saas-kingdom/
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceregistryevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1584.002/T1584.002.md
Unlock Pro Content
Get the full detection package for T1584.002 including response playbook, investigation guide, and atomic red team tests.