4 Dec 2026Security news updated around the clock

DNS

DNS turns names into addresses. Almost every connection starts with it, which makes it a rich detection source and a favorite channel for attackers.

ProtocolsAdvancedUpdated 23 min read

Overview

The Domain Name System (DNS) translates names that people use, such as portal.example.com, into the IP addresses that networks use. It also answers other questions: which servers receive mail for a domain, which domain controllers serve an Active Directory domain, and which text records prove who owns a domain.

DNS is a distributed, hierarchical database. No single server knows every name. Root servers know where the top-level domains such as .com are served, those servers know which servers are authoritative for example.com, and those servers hold the actual records. A recursive resolver walks this chain on behalf of clients and caches the results.

Classic DNS runs on port 53 over UDP, with TCP for large answers and zone transfers. Newer forms encrypt the traffic: DNS over TLS on port 853 and DNS over HTTPS on port 443.

Defenders care for two opposite reasons. DNS is one of the best detection sources there is: almost every connection a machine makes starts with a lookup, so DNS logs show which hosts talk to which destinations, often before any other traffic. And DNS is one of the most abused protocols: attackers use it for command and control, for data theft, to hide infrastructure that changes by the hour, to redirect whole domains, and to flood victims with traffic. Inside Windows networks, DNS is also how clients find domain controllers, so attacks on internal DNS feed directly into attacks on Kerberos and NTLM.

History and evolution

YearMilestoneWhy it matters for security
1970s to 1983ARPANET hosts are listed in one HOSTS.TXT file maintained centrallyThe model DNS replaced. The hosts file still exists on every machine and still overrides DNS
1983Paul Mockapetris publishes the first DNS specifications (RFC 882 and RFC 883)DNS is designed for a small, trusted network, without authentication
1987RFC 1034 and RFC 1035The core specifications still in use today
1999EDNS0 (RFC 2671, now RFC 6891)Allows larger UDP responses and option fields. Larger responses later make amplification attacks more powerful
2005DNSSEC (RFC 4033 to 4035)Signed records that resolvers can verify
2008Dan Kaminsky's cache poisoning attack (CVE-2008-1447)Forced resolvers worldwide to randomize source ports
2010The DNS root zone is signed with DNSSECA chain of trust from the root becomes possible
2016DNS over TLS (RFC 7858)Encrypts traffic between client and resolver
2018DNS over HTTPS (RFC 8484)Hides DNS inside ordinary HTTPS. Browsers adopt it, which bypasses enterprise resolvers unless managed
2022DNS over QUIC (RFC 9250)Encrypted DNS over UDP port 853

Where DNS is used in enterprise networks

  • Every client lookup goes to internal resolvers, which in Windows networks are usually the domain controllers running Active Directory-integrated DNS.
  • Internal resolvers forward unknown names to an upstream service: the internet provider, a public resolver, or a protective DNS service that blocks known-bad domains.
  • Active Directory depends on DNS to work at all. Clients find domain controllers through SRV records, and computers register their own names through secure dynamic updates.
  • Public DNS for the company's own domains is hosted by a registrar, a DNS provider, or a CDN. It holds the website, mail (MX), and email authentication records (SPF, DKIM, DMARC).
  • Cloud services, certificate issuance (CAA records and DNS-based validation), and content delivery networks all rely on DNS answers.

A single workstation makes thousands of DNS lookups a day. That volume is noisy, but it is also stable for each machine, which is what makes anomalies stand out.

Architecture and components

ComponentWhat it isWhat it holds
Stub resolverThe DNS client in the operating systemA small local cache and the address of the configured resolver
hosts fileLocal name list checked before DNSStatic mappings. Malware sometimes edits it to redirect or block sites
Recursive resolverThe server that answers clients by asking other serversA cache of answers, each kept for its time to live (TTL)
ForwarderA resolver that passes queries to another resolver instead of resolving them itselfCommon in enterprises: internal servers forward to an upstream service
Root serversThe top of the hierarchy. There are 13 named root server identities, each served from many locationsReferrals to top-level domain servers
TLD serversServers for top-level domains such as .com, .ae, or .orgReferrals to each domain's authoritative servers
Authoritative serverThe server that holds a domain's recordsThe zone: the definitive records for that domain
ZoneA portion of the namespace managed as one unitRecords, a start of authority (SOA) record, and name server (NS) records
Primary and secondary serversCopies of a zone. Secondaries copy from the primary with zone transfersThe same zone data
Active Directory-integrated zoneA Windows zone stored in the directory and replicated with itRecords, plus permissions on each record
DNSSEC keysA key-signing key (KSK) and a zone-signing key (ZSK) per signed zoneSignatures (RRSIG) on records, and a delegation signer (DS) record in the parent zone

How DNS resolution works step by step

  1. An application asks the operating system for portal.example.com. The stub resolver checks the hosts file and its own cache.
  2. On a miss, the stub sends a query to its configured resolver with the Recursion Desired (RD) flag set.
  3. The resolver checks its cache. On a miss, it asks a root server, which replies with a referral to the .com servers.
  4. The resolver asks a .com server, which replies with a referral to the authoritative servers for example.com.
  5. The resolver asks an example.com authoritative server, which returns the answer with the Authoritative Answer (AA) flag set.
  6. The resolver caches the answer for its TTL and returns it to the client, which then connects to the address.

In practice the resolver almost never starts at the root: the .com referral and popular answers are already in its cache.

sequenceDiagram
  participant C as Client stub resolver
  participant R as Recursive resolver
  participant Root as Root server
  participant TLD as .com server
  participant A as example.com authoritative
  C->>R: Query portal.example.com A, recursion desired
  R->>Root: Query portal.example.com A
  Root->>R: Referral to .com servers
  R->>TLD: Query portal.example.com A
  TLD->>R: Referral to example.com servers
  R->>A: Query portal.example.com A
  A->>R: Authoritative answer with TTL
  R->>C: Answer, cached for the TTL

DNS in Active Directory

Active Directory cannot work without DNS, and several well-known attack paths start here.

How clients find domain controllers: a domain-joined machine queries SRV records such as _ldap._tcp.dc._msdcs.corp.local and _kerberos._tcp.corp.local. It receives a list of domain controllers, then sends a short LDAP query over UDP 389 to pick one in its own site. Domain controllers register these records themselves through the Netlogon service.

How records are stored: Active Directory-integrated zones live in the directory, in the DomainDnsZones and ForestDnsZones partitions, and replicate with it. Each record is a directory object with its own permissions. Secure dynamic updates mean only the computer that registered a name can change it.

Where it goes wrong:

  • Record creation by any user. By default, Authenticated Users hold the "Create all child objects" permission on Active Directory-integrated zones, so any domain account can create a record name that does not exist yet, and becomes its owner. An attacker can add a wildcard record, or a name that clients look up but that does not exist, and point it at their own machine. Clients that resolve it then send authentication to the attacker, which feeds directly into NTLM relay.
  • WPAD. Browsers and Windows look up wpad to find a proxy configuration. The Windows DNS server blocks wpad and isatap by default with its global query block list, but that protection is often removed during troubleshooting.
  • DnsAdmins. Members of the DnsAdmins group can configure the DNS server service to load a DLL, and the service runs as SYSTEM on domain controllers. DnsAdmins membership is effectively control of the domain and should be treated as such.

Packet-level anatomy

Transport and ports

PortProtocolUse
53/UDPClassic DNSMost queries and responses
53/TCPClassic DNSTruncated responses, zone transfers, and any query (RFC 7766 requires TCP support)
853/TCPDNS over TLS (DoT)Encrypted client to resolver
443/TCPDNS over HTTPS (DoH)Encrypted DNS inside ordinary HTTPS
853/UDPDNS over QUIC (DoQ)Encrypted DNS over QUIC
5353/UDPMulticast DNS (mDNS)Local network name discovery
5355/UDPLLMNRWindows local name resolution fallback, a common poisoning target

When a UDP response does not fit, the server sets the Truncated (TC) flag and the client retries over TCP. EDNS0 lets the client advertise a larger UDP buffer. 1232 bytes is the widely recommended size, because it avoids IP fragmentation, which some poisoning attacks exploit.

Every DNS message starts with a 12-byte header.

FieldSizePurposeSecurity note
ID16 bitsMatches responses to queriesMust be random. With source port randomization it is the main defense against spoofed answers
QR1 bit0 for a query, 1 for a responseNone
Opcode4 bits0 standard query, 4 NOTIFY, 5 UPDATEUPDATE messages from unexpected sources mean someone is trying to change records
AA1 bitAuthoritative AnswerSet by the server that owns the zone
TC1 bitTruncatedTriggers a retry over TCP
RD1 bitRecursion DesiredSet by clients
RA1 bitRecursion AvailableAn authoritative server that answers with RA set to external clients is an open resolver
Z1 bitReserved, must be zeroNon-zero values point to unusual tools
AD1 bitAuthentic Data: the resolver validated the answer with DNSSECOnly meaningful if the path to the resolver is trusted
CD1 bitChecking Disabled: the client asks the resolver not to validateNone
RCODE4 bitsResponse codeSee the table below
QDCOUNT, ANCOUNT, NSCOUNT, ARCOUNT16 bits eachNumber of questions, answers, authority records, and additional recordsResponses with very large counts can indicate amplification or tunneling

Question and resource records

The question holds a name (QNAME), a type (QTYPE), and a class (QCLASS, almost always 1 for Internet).

Names are encoded as labels, each prefixed with its length: portal.example.com becomes 06 portal 07 example 03 com 00. Each label can be at most 63 bytes, and a full name at most 255 bytes. Tunneling tools fill these limits with encoded data.

Every answer, authority, and additional record has the same format:

FieldSizePurpose
NAMEVariableThe owner name. Often a 2-byte compression pointer: the top two bits set (0xC0) plus a 14-bit offset to a name earlier in the message
TYPE16 bitsRecord type
CLASS16 bits1 for Internet
TTL32 bitsSeconds the record may be cached
RDLENGTH16 bitsLength of the data
RDATAVariableThe record data

Record types

TypeValueHoldsSecurity note
A1IPv4 addressThe most common query
NS2Name server for a zoneChanges to NS records at the registrar are how domains get hijacked
CNAME5Alias to another nameA CNAME pointing to a deleted cloud resource enables subdomain takeover
SOA6Zone authority and timersNone
NULL10Arbitrary dataRare in normal traffic. Used by tunneling tools
PTR12Reverse lookup, address to nameReverse sweeps reveal internal naming
MX15Mail serverChanges redirect a company's email
TXT16Free textSPF, DKIM, DMARC, and domain verification. Also the favorite carrier for tunneling and command and control
AAAA28IPv6 addressNone
SRV33Service locationActive Directory domain controller discovery
OPT41EDNS0 pseudo-recordCarries buffer size and options
DS, RRSIG, NSEC, DNSKEY, NSEC343, 46, 47, 48, 50DNSSEC dataLarge responses, so useful for amplification
SVCB, HTTPS64, 65Service binding, including encrypted ClientHello configurationNone
IXFR, AXFR251, 252Incremental and full zone transfersA full zone transfer to an unknown host hands over a map of the network
ANY255All records for a nameHistorically abused for amplification. Many servers now return a minimal answer (RFC 8482)
CAA257Which certificate authorities may issue certificates for the domainLimits certificate misissuance

Response codes

RCODENameMeaningDetection value
0NOERRORSuccessNormal
1FORMERRThe server could not parse the queryBursts can point to malformed tunneling traffic or fuzzing
2SERVFAILThe server failed to answerSpikes can mean DNSSEC validation failures, upstream outages, or attacks on the resolver
3NXDOMAINThe name does not existA host producing many NXDOMAIN answers is a classic sign of malware cycling through generated domains
4NOTIMPNot implementedRare
5REFUSEDThe server will not answerExternal REFUSED answers show someone testing your servers for open recursion

EDNS0 options

The OPT record carries the client's UDP buffer size, the DNSSEC OK (DO) bit, and options such as EDNS Client Subnet (option 8, which passes part of the client's address to authoritative servers), DNS Cookies (option 10, which helps resist spoofing), and Padding (option 12, which hides message sizes in encrypted DNS).

Example decoded response

An illustrative response as Wireshark shows it:

Domain Name System (response)
    Transaction ID: 0x5c3a
    Flags: 0x8180 Standard query response, No error
        1... .... .... .... = Response: Message is a response
        .000 0... .... .... = Opcode: Standard query (0)
        .... .0.. .... .... = Authoritative: Server is not an authority for domain
        .... ..0. .... .... = Truncated: Message is not truncated
        .... ...1 .... .... = Recursion desired: Do query recursively
        .... .... 1... .... = Recursion available: Server can do recursive queries
        .... .... ..0. .... = Answer authenticated: Answer was not authenticated by the server
        .... .... .... 0000 = Reply code: No error (0)
    Questions: 1
    Answer RRs: 1
    Authority RRs: 0
    Additional RRs: 1
    Queries
        portal.example.com: type A, class IN
    Answers
        portal.example.com: type A, class IN, addr 203.0.113.25
            Time to live: 300
    Additional records
        <Root>: type OPT
            UDP payload size: 1232

Zeek writes every query and response pair to dns.log, with fields including query, qtype_name, rcode_name, AA, TC, RD, RA, answers, and TTLs. An illustrative line for the same lookup:

query=portal.example.com  qtype_name=A  rcode_name=NOERROR  AA=F  TC=F  RD=T  RA=T  answers=203.0.113.25  TTLs=300.0

Configuration in practice

Resolvers and internal DNS servers

SettingDefaultRecommendedWhy
Who may query the resolverVaries by productInternal networks onlyAn open resolver gets used for amplification attacks against others
Recursion on authoritative-only serversOften onOffPublic authoritative servers should only answer for their own zones
Source port randomization (Windows: socket pool)On. Windows uses a pool of 2,500 ports by defaultOn, with a larger pool on busy resolversMakes spoofed answers much harder to land
DNSSEC validationVaries by productOn, after testingRejects forged answers for signed domains
Global query block list (Windows)Blocks wpad and isatapKeep itStops WPAD and ISATAP spoofing through DNS
Query logging (Windows: DNS Server Analytical log)OffOn, sent to your SIEMWithout it, there is no record of what each host looked up
Protective DNS or response policy zonesNot configuredBlock known-bad and newly registered domainsStops many malware and phishing lookups at the first step

Zones and records

SettingDefaultRecommendedWhy
Zone transfersVaries by zone typeOnly to named secondary serversPrevents anyone from downloading the full zone
Dynamic updates on Active Directory-integrated zonesSecure onlySecure onlyOnly authenticated computers can register names
Record creation by Authenticated Users in Active Directory-integrated zonesAllowedRemoved, or pre-create a harmless wildcard recordStops attackers from adding records that capture authentication
DnsAdmins group membershipUsually small, rarely reviewedEmpty or Tier 0 administrators onlyMembership leads to code execution on domain controllers
Response rate limiting on public authoritative serversOffOnLimits your servers' usefulness in reflection attacks

The perimeter and the registrar

SettingRecommendedWhy
Outbound 53/UDP, 53/TCP, and 853Allowed only from internal resolversForces all DNS through servers you log and control
DNS over HTTPS in browsers and WindowsManaged by policy: off, or pointed at your own resolverUnmanaged DoH bypasses your logs and blocking
Registrar and DNS provider accountsMulti-factor authentication, registry lock where offeredDomain hijacking usually starts with a stolen registrar password
CAA recordsPresent, listing only the certificate authorities you useLimits who can issue certificates for your domain
SPF, DKIM, and DMARCPublished, with DMARC set to rejectStops others from sending email as your domain

Security model and common misconfigurations

Classic DNS has no authentication and no encryption. A resolver accepts the first answer that matches its question, its transaction ID, and its source port. Everyone on the path can read every lookup.

The newer layers each fix part of this:

  • DNSSEC proves that records came from the zone owner and were not changed. It does not hide anything, and it only protects zones that are signed.
  • DNS over TLS, HTTPS, and QUIC encrypt the path between the client and its resolver. The resolver still sees every query, and the resolver's own upstream lookups may still be plain DNS.
  • No layer protects against a compromised registrar account, because the attacker then publishes legitimate-looking records for your domain.

The misconfigurations behind most DNS incidents:

  • Clients allowed to send DNS straight to the internet, bypassing internal resolvers
  • Browsers using public DoH services, so internal logs and blocking see nothing
  • No DNS query logging, or logs kept only a few days
  • Open recursion on internet-facing servers
  • Zone transfers allowed to any host
  • Default record-creation permissions in Active Directory-integrated zones
  • Stale DnsAdmins membership
  • Registrar accounts without multi-factor authentication
  • CNAME records left pointing to cloud resources that no longer exist

Attacks against DNS

Cache poisoning and spoofed answers

How it works: the attacker tries to get a resolver to accept a forged answer before the real one arrives, so the resolver caches a wrong address and hands it to every client. Dan Kaminsky showed in 2008 that by asking for many random names under the target domain, an attacker gets unlimited tries and can inject a forged referral for the whole domain (CVE-2008-1447). Later research, such as the SAD DNS attack in 2020, used side channels to guess the source port.

Prerequisites: the ability to send spoofed packets to the resolver, and a resolver with weak randomization or no DNSSEC validation for the target zone.

ATT&CK: T1557 (Adversary-in-the-Middle).

On the wire and in logs: bursts of queries for random names under one domain, many responses arriving for the same query, and answers for a well-known domain suddenly changing to an unfamiliar address.

Domain and DNS hijacking

How it works: instead of fooling resolvers, the attacker changes the real records. They steal the credentials for a registrar or DNS provider account and change the NS or A records, often just long enough to obtain valid TLS certificates and capture email or VPN logins. In 2019, CISA issued Emergency Directive 19-01 after a campaign that hijacked government domains this way. Home and small office routers with changed DNS settings are a smaller-scale version of the same idea.

ATT&CK: T1584.002 (Compromise Infrastructure: DNS Server).

On the wire and in logs: changes in your own public records that nobody requested. Certificates issued for your domains that you did not request, visible in certificate transparency logs. Registrar login alerts from unfamiliar locations.

Tunneling and command and control

How it works: malware encodes data into query names and receives commands in TXT, NULL, or CNAME answers from a domain the attacker controls. Because almost every network lets DNS through, the channel survives where other traffic is blocked. See the full DNS Tunneling entry.

ATT&CK: T1071.004 (Application Layer Protocol: DNS), T1572 (Protocol Tunneling), and T1048 (Exfiltration Over Alternative Protocol).

On the wire and in logs: many unique, long, random-looking subdomains under one registered domain from one host, unusual record types such as TXT and NULL from workstations, and regular timing.

Domain generation algorithms

How it works: malware computes a list of domain names from a seed, often the date, and tries them until one resolves. The attacker only needs to register one name from each day's list, which makes blocklists slow to keep up. The Conficker worm used this method at large scale in 2008 and 2009.

ATT&CK: T1568.002 (Dynamic Resolution: Domain Generation Algorithms).

On the wire and in logs: one host producing bursts of NXDOMAIN answers for random-looking names across many top-level domains, followed by one name that resolves.

Fast flux

How it works: the attacker's domain returns a rapidly changing set of IP addresses with very short TTLs, usually compromised machines acting as proxies. Taking down any single address does not take down the service.

ATT&CK: T1568.001 (Dynamic Resolution: Fast Flux DNS).

On the wire and in logs: a domain whose answers change on almost every lookup, TTLs of seconds to a few minutes, and addresses spread across many unrelated networks and countries.

Reflection and amplification attacks

How it works: the attacker sends small queries with the victim's address forged as the source to open resolvers or authoritative servers that return large answers. The servers flood the victim. DNS can multiply the attacker's traffic many times over, especially with large TXT, ANY, or DNSSEC responses.

ATT&CK: T1498.002 (Network Denial of Service: Reflection Amplification).

On the wire and in logs: your servers sending large volumes of responses to an address that sent you no real queries, and many requests for the same large record.

Reconnaissance

How it works: attackers map a network through DNS before attacking it: full zone transfers (AXFR) from misconfigured servers, reverse lookups across address ranges, brute force of common subdomain names, and certificate transparency logs that list every name a certificate was issued for.

ATT&CK: T1590.002 (Gather Victim Network Information: DNS).

On the wire and in logs: AXFR or IXFR queries from hosts that are not secondary servers, and one source sweeping PTR queries across a range.

Subdomain takeover

How it works: a record such as shop.example.com still points with a CNAME to a cloud service that the company deleted. The attacker registers the same resource name with the cloud provider and now serves content on the company's subdomain, which is useful for phishing and for stealing cookies scoped to the parent domain.

ATT&CK: T1584.001 (Compromise Infrastructure: Domains).

On the wire and in logs: this happens outside your network. Find it by regularly checking every CNAME in your public zones against the cloud resources you actually own.

Attacks on DNS servers themselves

DNS server software is a high-value target because it is reachable by design. SIGRed (CVE-2020-1350) was a wormable remote code execution flaw in the Windows DNS server, triggered by a malicious response to a query the server made. Because Windows DNS usually runs on domain controllers, exploitation meant domain compromise. KeyTrap (CVE-2023-50387) showed that crafted DNSSEC records could tie up validating resolvers with expensive calculations. Patch DNS servers on the same priority as internet-facing systems.

Abuse of Active Directory DNS

How it works: an attacker with any domain account adds a record to an Active Directory-integrated zone (for example, a name that a server keeps trying to resolve, or a wildcard), points it to their own machine, and captures or relays the NTLM authentication that follows.

ATT&CK: T1557.001 (Adversary-in-the-Middle: Name Resolution Poisoning and SMB Relay).

On the wire and in logs: with "Audit Directory Service Changes" turned on, domain controllers log Event 5137 (a directory object was created) for each new dnsNode object. A wildcard record appears as an object named * (DC=*), and any record created by an ordinary user account deserves a look. On the network, lookups that suddenly resolve to a workstation address.

Detection engineering

Log sources

SourceWhat it recordsWhat to look for
Resolver query logs (Windows DNS Server Analytical log, BIND query log, protective DNS logs)Which client asked for which name and type, and the answerTunneling patterns, DGA bursts, lookups of known-bad domains
Zeek dns.logEvery query and response seen on the wire, with flags, answers, and TTLsThe same patterns, plus DNS that never reached your resolvers
Zeek conn.log or firewall logsConnections to 53, 853, and known DoH endpoints on 443DNS that bypasses internal resolvers
Passive DNS historyHow each domain resolved over timeNewly observed domains, fast flux, infrastructure reuse
DNS Server audit log and directory change events (Event 5137 for new dnsNode objects)Record and zone changesRecords created by unexpected accounts, wildcard records, zone setting changes
Registrar and DNS provider audit logsAccount logins and record changes for your public domainsChanges nobody requested
Certificate transparency monitoringCertificates issued for your domainsCertificates you did not request

Example detections

Tunneling by unique subdomains, as pseudo-SQL over Zeek data. registered_domain() stands for whatever function your platform uses to reduce a name to the part a person can register, based on the Public Suffix List.

SELECT orig_h,
       registered_domain(query) AS domain,
       COUNT(DISTINCT query) AS unique_names,
       AVG(LENGTH(query)) AS avg_length
FROM dns_log
WHERE ts > now() - INTERVAL '1 hour'
GROUP BY orig_h, registered_domain(query)
HAVING COUNT(DISTINCT query) > 500 AND AVG(LENGTH(query)) > 40;

Expected false positives: some security products, content delivery networks, and anti-spam lookups use long generated names. Baseline for a week and add them to an allow list.

Domain generation algorithm activity, by NXDOMAIN rate per host:

SELECT orig_h,
       COUNT(*) AS lookups,
       SUM(CASE WHEN rcode_name = 'NXDOMAIN' THEN 1 ELSE 0 END) AS nxdomain
FROM dns_log
WHERE ts > now() - INTERVAL '15 minutes'
GROUP BY orig_h
HAVING SUM(CASE WHEN rcode_name = 'NXDOMAIN' THEN 1 ELSE 0 END) > 100
   AND SUM(CASE WHEN rcode_name = 'NXDOMAIN' THEN 1 ELSE 0 END) > 0.5 * COUNT(*);

Expected false positives: misconfigured applications retrying a dead name, and browsers probing for intranet names. Those repeat the same few names; DGA traffic does not.

DNS that bypasses your resolvers:

SELECT orig_h, resp_h, resp_p, COUNT(*) AS connections
FROM conn_log
WHERE resp_p IN (53, 853)
  AND orig_h NOT IN (SELECT ip FROM approved_resolvers)
  AND NOT is_private(resp_h)
  AND ts > now() - INTERVAL '1 day'
GROUP BY orig_h, resp_h, resp_p;

Add known DoH endpoints on port 443 to the same check using a maintained list of public DoH server addresses.

Zone transfer attempts, as Sigma-style YAML over Zeek DNS data:

title: DNS zone transfer request from an unapproved host
logsource:
  product: zeek
  service: dns
detection:
  selection:
    qtype_name:
      - AXFR
      - IXFR
  filter_secondaries:
    id.orig_h|cidr:
      - 10.0.10.5/32
  condition: selection and not filter_secondaries
falsepositives:
  - Secondary servers not yet added to the filter
level: high

Prevention and hardening

In order of impact:

  1. Force all DNS through internal resolvers. Block outbound 53 and 853 from everything except those resolvers, and manage DNS over HTTPS through browser and Windows policy.
  2. Log every query, on the resolvers and on network sensors, and keep the logs for at least 90 days. DNS logs are often the only record of what an infected machine contacted.
  3. Add protective DNS or response policy zones that block known-malicious and newly registered domains.
  4. Protect your registrar and DNS provider accounts with multi-factor authentication, turn on registry lock for critical domains where your registrar offers it, and monitor certificate transparency logs for your domains.
  5. Restrict zone transfers to named secondaries, turn off recursion on authoritative servers, and turn on response rate limiting on public servers.
  6. Patch DNS servers quickly. SIGRed showed that a DNS flaw on a domain controller is a domain-wide incident.
  7. Lock down Active Directory-integrated zones: remove record creation for Authenticated Users or pre-create a harmless wildcard record, and keep the wpad entry in the global query block list.
  8. Treat DnsAdmins as a Tier 0 group, and review its membership.
  9. Turn off LLMNR and NetBIOS name resolution, which attackers use when DNS lookups fail.
  10. Turn on DNSSEC validation on your resolvers, and sign your public zones once you have a tested key rollover process.
  11. Remove dangling CNAME records, and publish CAA records for your domains.
  12. Publish SPF, DKIM, and DMARC with a reject policy for every domain, including ones that send no email.

Incident response and remediation

When DNS abuse is suspected:

  1. Scope from the logs. Find every host that queried the suspicious domain, when they started, and what they did next.
  2. Block or sinkhole the domain at your resolvers. Pointing it at an internal sinkhole also reveals any infected host you missed, because it keeps trying.
  3. Investigate the hosts behind the queries as compromised, not only the domain.
  4. After cache poisoning, flush resolver caches once the cause is fixed, and confirm answers for the affected names match the authoritative servers.
  5. After a hijack of your own domains: regain control of the registrar account, restore the correct records, rotate all registrar and DNS provider credentials, and revoke any TLS certificates issued while the attacker controlled the domain. Treat credentials entered on hijacked sites (VPN, webmail) as stolen.
  6. In Active Directory, look for records created by unexpected accounts, wildcard records, and changes to the global query block list. Check DnsAdmins membership and whether the DNS server is configured to load a plugin DLL.
  7. Preserve DNS logs and passive DNS data for the investigation before they roll over.

Real-world cases

  • CVE-2008-1447: Dan Kaminsky's cache poisoning attack. A coordinated, multi-vendor patch release in July 2008 added source port randomization to resolvers worldwide.
  • CVE-2020-1350, SIGRed: a remote code execution flaw in the Windows DNS server, rated 10.0. The flaw had existed in the code for about 17 years and could spread from server to server without user interaction.
  • CVE-2023-50387, KeyTrap: crafted DNSSEC records could make validating resolvers spend excessive CPU, enough for a single packet to stall a resolver for a long time. Major resolver vendors patched it in early 2024.
  • Mirai and Dyn, October 2016: a botnet of compromised internet-connected devices flooded Dyn, a major DNS provider, making many large websites unreachable for parts of a day. It showed how much of the internet depends on a few DNS providers.

DNS in the news

News stories tagged with DNS. This list updates on its own while the page is open.

    No news stories are tagged with this topic yet.

    Frequently asked questions

    Does DNS over HTTPS make DNS monitoring impossible?

    Not if you manage it. Block public DoH services and turn browser DoH off or point it at your own resolver through policy. Your resolvers then still see and log every query. Unmanaged DoH is what removes visibility.

    Why does Active Directory need DNS?

    Clients find domain controllers, Kerberos services, and global catalog servers through DNS SRV records, and computers register their own names in DNS. If DNS fails or is poisoned, logons, Group Policy, and replication fail or can be redirected.

    Should we sign our public zones with DNSSEC?

    It protects your records from forgery for every resolver that validates. The risk is operational: a mistake during key rollover makes your domain unreachable for validating resolvers. Sign once you have a tested rollover process, or use a DNS provider that automates it.

    Which DNS logs should a SOC keep?

    Client query logs from your resolvers, ideally with the answers, plus network sensor data such as Zeek dns.log to catch DNS that bypasses your resolvers. Keep at least 90 days. Add registrar audit logs and certificate transparency alerts for your own domains.

    Is DNS over TCP suspicious?

    Not by itself. Large answers, DNSSEC responses, and zone transfers use TCP, and it is a normal fallback. A workstation sending a steady stream of TCP DNS to one external domain is different and is worth checking for tunneling tools.

    References and further reading

    Found a technical error in this entry? Tell us and we will fix it.