DNS Cache Poisoning: Attack Surface and Defense Layers


DNS cache poisoning remains a foundational security concern because of where DNS sits in the network stack: it’s the first step in nearly every network interaction, and most applications trust it implicitly. When an attacker successfully poisons a DNS cache, they can redirect all traffic destined for a legitimate domain to a server they control, without needing to compromise the target site itself.

The attack exploits the stateless nature of DNS. A resolver sends a query with a transaction ID, and it accepts the first valid-looking response that matches that ID. If an attacker can guess the transaction ID and respond faster than the legitimate nameserver, their forged answer gets cached. For the duration of that cache’s TTL—often minutes to hours—every user relying on that resolver will be directed to the attacker’s IP address.

Why transaction IDs aren’t enough

Early DNS implementations used sequential or predictable transaction IDs, making attacks trivial. Modern resolvers use 16-bit random IDs, which provides 65,536 possibilities. That sounds like a large space, but an attacker can flood the resolver with thousands of responses for a single query, each with a different guessed ID. With enough bandwidth and a bit of luck, they’ll hit the right one before the legitimate response arrives.

Source port randomization added another layer. Instead of sending all queries from port 53, resolvers now use random high-numbered source ports, adding another ~16 bits of entropy. An attacker now needs to guess both the transaction ID and the source port—billions of combinations. This raised the bar significantly, but blind spoofing attacks remain theoretically possible with sufficient resources and timing precision.

The DNSSEC solution and adoption gap

DNSSEC solves cache poisoning through cryptographic signing. Each DNS record comes with a signature that chains back to a trusted root. A resolver that validates DNSSEC can reject any response that doesn’t have a valid signature chain, even if the transaction ID and port match perfectly.

The challenge is deployment. DNSSEC requires action from domain owners (to sign their zones), from registrars and TLD operators (to publish DS records), and from resolvers (to validate signatures). As of recent measurements, DNSSEC validation is enabled on major public resolvers like Google Public DNS and Cloudflare’s 1.1.1.1, but signing adoption among domain owners remains incomplete. A domain without DNSSEC is still vulnerable to poisoning attacks against any resolver.

DNSSEC also introduces operational complexity. Key rollovers, signature expiration, and clock skew can all break resolution if misconfigured. The extra records increase response sizes, sometimes requiring TCP fallback. For many operators, the perceived risk of poisoning hasn’t outweighed the operational overhead.

Defense in depth beyond protocol features

Practical defenses don’t rely solely on transaction ID entropy or DNSSEC. Resolvers implement behavioral heuristics: discarding out-of-bailiwick records (responses that include data for domains the nameserver isn’t authoritative for), rate-limiting queries to prevent attackers from triggering lookups they can poison, and maintaining reputation scores for nameservers that send suspicious responses.

Some resolvers use Query Name Minimization (QNAME minimization), sending only the minimum necessary domain information at each step of recursion. This limits what an attacker observes and reduces the attack surface for injecting forged records at intermediate nameservers.

Enterprise networks often place DNS filtering proxies between users and upstream resolvers. These can apply allowlist/denylist policies and add another caching layer, which fragments the attack surface—poisoning one enterprise cache doesn’t affect others.

The shift toward encrypted transport

DNS over HTTPS (DoH) and DNS over TLS (DoT) encrypt queries between the client and resolver, preventing on-path attackers from observing which domains are being queried or injecting responses. This doesn’t stop poisoning attacks against the resolver itself, but it moves the trust boundary. Instead of trusting your local network and ISP’s resolver, you trust a specific upstream DoH/DoT provider.

This shift has implications beyond security. ISPs lose visibility into DNS traffic, which affects both network troubleshooting and content filtering policies. Enterprises deploying DoH clients may find corporate DNS policies bypassed. The centralization toward a few large DoH providers also creates new concentration risks.

Cache poisoning is a textbook example of defense in layers. No single mitigation is perfect, but transaction ID randomization, source port randomization, DNSSEC, query minimization, and encrypted transport each close different attack paths. The gap between theoretical protocol security and deployed reality remains wide, but the direction is toward making DNS harder to manipulate at every step.