SecDNS

How DNS attacks work — cache poisoning, hijacking, tunnelling, DGA and fast-flux

A field guide to the most common DNS-borne attacks — cache poisoning, hijacking, tunnelling, DGA, fast-flux and NXDOMAIN abuse — with the mitigations protective DNS typically applies.

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:

LayerExample
EndpointMalware rewriting /etc/resolv.conf or the registry
RouterDefault-credential CPE replacing the upstream resolver
ISPTransparent DNS proxies on UDP/53
RegistrarCredential 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:

  1. 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.
  2. NXDOMAIN hijacking — an upstream resolver replaces an NXDOMAIN answer 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

Frequently asked questions

Is cache poisoning still a real threat in 2025?

Yes. The Kaminsky-class attacks from 2008 led to source-port randomisation and wider DNSSEC adoption, but research like the 2020 SAD DNS work showed that side channels can still rebuild the entropy attackers need. Cache poisoning is harder, not obsolete.

How can I tell if my DNS has been hijacked?

Compare answers from your local resolver with a trusted second opinion — for example, run dig against your normal resolver and against 1.1.1.1 over DoH, and check whether the IPs match. Persistent disagreements on well-known names are a strong signal something is rewriting your traffic.

What is DNS tunnelling actually used for?

Operationally, attackers use it to exfiltrate data or run command-and-control over a channel that often escapes inspection. Legitimate uses exist too — captive-portal redirection and security-research tooling — which is why detection focuses on volume, entropy and TXT-record patterns rather than on the technique itself.

Will DNSSEC stop DGA malware?

No. DGAs generate domains that the attacker also registers, so the resolved answers are technically valid. DNSSEC protects against tampering in transit; defeating DGAs requires threat intelligence on the registered domains and behavioural detection.

How does protective DNS catch fast-flux?

Fast-flux infrastructure rotates A records on short TTLs and may rotate NS records too. RPZ feeds can target the response IP and the NS name, not just the QNAME, so a single rule can cover an entire flux network. SecDNS curated feeds include fast-flux indicators by default.