How DNS attacks work — cache poisoning, hijacking, tunnelling, DGA and fast-flux
DNS is a foundational protocol, which makes it a foundational target. This article walks through the major attack families an operator should expect to defend against, explains the mechanism behind each, and notes the practical mitigations — most of which are baked into a modern protective resolver.
Cache poisoning
A recursive resolver caches answers it receives from authoritative servers. If an attacker can convince the resolver to cache a forged answer, every downstream client that asks the same question for the duration of the TTL gets the wrong IP.
The classic 2008 Kaminsky attack exploited the small entropy of the original DNS transaction ID — only 16 bits, easily brute-forced over UDP. Mitigations include source-port randomisation (RFC 5452), DNS cookies (RFC 7873) and ultimately DNSSEC validation, which makes forged answers fail cryptographically.
In 2020 the SAD DNS research showed that ICMP rate-limit side channels could re-enable an off-path attacker to guess the source port, so the threat is not retired. Validating resolvers and TLS-protected stub transports remain the durable answer.
DNS hijacking
Hijacking is the broader family of attacks where the entire resolver answer is rewritten — not just a single cached entry. It can happen at several layers:
| Layer | Example |
|---|---|
| Endpoint | Malware rewriting /etc/resolv.conf or the registry |
| Router | Default-credential CPE replacing the upstream resolver |
| ISP | Transparent DNS proxies on UDP/53 |
| Registrar | Credential theft followed by NS record changes |
The 2019 wave of registrar-level hijacks documented in the DNSpionage and Sea Turtle campaigns showed that this is not a theoretical attack. Encrypted DNS (DoH or DoT) plus registrar-side multi-factor and registry lock are the standard defences. Protective DNS does not stop a credentialed attacker from rewriting your zone, but it does stop on-path rewriting of queries from the endpoint.
Tunnelling
DNS tunnelling encodes arbitrary payloads in subdomain labels or TXT records, treating DNS as a covert transport. A device infected with tunnelling malware issues high-frequency queries like 7a3f...long-base32-payload.attacker.example, and the authoritative server replies with answers that carry the next slice of data. Because DNS is rarely blocked outright, the channel often survives perimeter controls.
Detection signals include:
- Queries with high-entropy labels and unusually long names.
- Volume that scales linearly with data transfer rather than with user activity.
- Disproportionate TXT/NULL record traffic.
- Repeated queries to the same uncommon parent domain.
You can replicate the shape of the traffic in a lab with iodine or dnscat2. Protective resolvers score per-client query rate and label entropy, and SecDNS surfaces high-confidence tunnelling alerts in the per-device view.
Domain Generation Algorithms
A DGA produces a stream of pseudo-random domains based on a seed (often the current date). The malware tries to resolve each in turn until one succeeds; the operator only needs to register a small number of them ahead of time to maintain communication. Famous families include Conficker, Necurs and the Mirai-derived botnets.
DNSSEC does not help here — the attacker controls the registered domains and signs them correctly. The right answer is reputation-based: NRD (newly registered domain) feeds, algorithmically-generated-domain classifiers, and tenant-scoped allowlists for legitimate apps that use ephemeral subdomains.
Fast-flux
Fast-flux rotates the A records (single flux) and sometimes the NS records (double flux) of a botnet's domains on TTLs of 60 seconds or less. By the time a takedown notice reaches the hoster, the infrastructure has moved.
RPZ (RPZ explained) is purpose-built for this — its response-IP and NS-name triggers let one rule cover an entire flux network even as individual indicators churn. Combining flux detection with NRD quarantine catches most of the long tail.
NXDOMAIN abuse
Two unrelated patterns share the NXDOMAIN label:
- NXDOMAIN flooding — huge volumes of queries for non-existent names hammer an authoritative server. Cache misses force real work and degrade legitimate clients. Response Rate Limiting (RRL) is the standard mitigation.
- NXDOMAIN hijacking — an upstream resolver replaces an
NXDOMAINanswer with an ad page. More a quality issue than a security incident, but it breaks software that expects authoritative answers. Encrypted DNS to a trusted resolver eliminates it.
Defensive baseline
A reasonable baseline for any organisation:
- Validate DNSSEC at the resolver.
- Pin endpoints to an encrypted resolver via MDM, DoH or DoT.
- Subscribe to NRD, DGA and fast-flux feeds via RPZ.
- Log every query and alert on tunnelling-shaped anomalies.
All four are first-class features in SecDNS — see What is protective DNS? for how they fit together.
Further reading
- Glossary: DNS, DNSSEC, RPZ, protective DNS
- Features: DNSSEC validation, DNS over HTTPS, DNS over TLS
- Learn: DNSSEC explained, RPZ explained, Why DNS filtering?