{"id":282,"date":"2026-11-21T09:34:00","date_gmt":"2026-11-21T17:34:00","guid":{"rendered":"https:\/\/blog.canutethegreat.com\/?p=282"},"modified":"2026-11-04T01:32:07","modified_gmt":"2026-11-04T09:32:07","slug":"dns-cache-poisoning-dnssec","status":"publish","type":"post","link":"https:\/\/blog.canutethegreat.com\/index.php\/2026\/11\/21\/dns-cache-poisoning-dnssec\/","title":{"rendered":"DNS cache poisoning and why DNSSEC still isn&#8217;t everywhere"},"content":{"rendered":"<h2>The basic poisoning problem<\/h2>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog.canutethegreat.com\/wp-content\/uploads\/2026\/10\/dns-dnssec-diagram.png\" alt=\"Kaminsky cache poisoning attack sequence vs. the DNSSEC trust chain\" \/><\/figure>\n<p>DNS over UDP has no authentication built into the base protocol. When your resolver asks an authoritative server &#8220;what&#8217;s the A record for example.com&#8221;, the response just needs to match a few fields to be accepted: source IP, destination port, query ID (a 16-bit field), and the question name. If an attacker can guess or brute-force those fields faster than the legitimate answer arrives, they can inject a forged response and your resolver caches it. Every client behind that resolver now gets routed wherever the attacker wants until the TTL expires.<\/p>\n<p>Before 2008, the main defense was the 16-bit query ID (QID). That&#8217;s 65536 possible values, which sounds like enough entropy until you realize an off-path attacker doesn&#8217;t need to win on the first try. UDP has no handshake, so you can fire thousands of spoofed packets guessing different QIDs, and if even one lands before the real answer does, you win.<\/p>\n<h2>Kaminsky&#8217;s insight (CVE-2008-1447)<\/h2>\n<p>Dan Kaminsky&#8217;s 2008 disclosure wasn&#8217;t really a new vulnerability class, people had known QID-guessing was theoretically weak since the late 90s (there&#8217;s a CERT advisory from 1997 touching on similar issues). What Kaminsky did was make the attack practical and devastating by exploiting the birthday paradox and a clever target selection trick.<\/p>\n<p>The core move: instead of trying to poison the cache entry for <code>www.example.com<\/code> directly (which only gives you one hostname), you ask the victim resolver to look up a name that doesn&#8217;t exist yet, like <code>random123.example.com<\/code>. The resolver has to go recurse out to the authoritative server for <code>example.com<\/code> to resolve it, and while that&#8217;s in flight, you flood the resolver with forged responses. Those forged responses aren&#8217;t just answering the A record query, they include a malicious NS record in the authority section, claiming that <code>example.com<\/code>&#8216;s nameserver is now at an attacker-controlled IP. If you win the race even once, you&#8217;ve poisoned the delegation for the entire domain, not just one hostname, because resolvers cache NS\/glue records too.<\/p>\n<p>The birthday paradox angle: because you can generate an essentially unlimited stream of random subdomain queries (<code>random1.example.com<\/code>, <code>random2.example.com<\/code>, &#8230;) and race each one with a flood of guesses, your odds of a single query ID collision across many attempts go up dramatically faster than people&#8217;s naive intuition about 65536 possibilities suggested. With unconstrained transmission, you can realistically win within seconds to minutes on networks with weak port randomization, not days.<\/p>\n<h2>The 0x20 and source-port fix<\/h2>\n<p>The patch deployed across the industry in July 2008 (famously coordinated across vendors before public disclosure) did two things:<\/p>\n<p>1. Randomized the UDP source port for outgoing queries, not just the QID. Combined, you now have roughly 16 bits (QID) plus around 16 bits (source port, though often less due to OS ephemeral port ranges) of effective entropy an attacker has to guess, instead of just 16.<\/p>\n<p>2. Some implementations (BIND, PowerDNS) added 0x20 encoding: randomizing the case of letters in the query name (<code>WwW.eXamPle.CoM<\/code>) and requiring the response to echo the exact same casing. This adds more entropy per query without protocol changes, since DNS is historically case-insensitive for name comparison but the wire format doesn&#8217;t strip casing.<\/p>\n<p>This was a mitigation, not a cure. Increasing entropy from 16 to roughly 32 bits raises the cost of the attack from trivial on a home connection to expensive but not impossible, especially against a resolver on a fast network with abundant bandwidth. Researchers (Herzberg and Shulman, among others) kept publishing practical variants against port-randomized resolvers for years after. The real fix was supposed to be cryptographic, which is where DNSSEC comes in.<\/p>\n<h2>What DNSSEC actually signs<\/h2>\n<p>DNSSEC doesn&#8217;t encrypt DNS traffic (that&#8217;s a separate problem, see DoH\/DoT under RFC 8484 and RFC 7858) and it doesn&#8217;t stop an attacker from seeing or forging packets at the network level. What it does is let a resolver cryptographically verify that a response actually came from the zone&#8217;s legitimate owner and wasn&#8217;t altered in transit or injected by a third party.<\/p>\n<p>The core record types:<\/p>\n<pre tabindex=\"0\" class=\"wp-block-code\"><code>RRSIG  - a signature over a set of records (an RRset)\nDNSKEY - the public key(s) for a zone\nDS     - a hash of a child zone's DNSKEY, published in the parent zone\nNSEC\/NSEC3 - proof that a name does NOT exist (authenticated denial)<\/code><\/pre>\n<p>The chain of trust works top-down from a single trust anchor, the root zone&#8217;s KSK, which is managed by ICANN\/IANA and distributed out-of-band (your resolver software ships with it, see RFC 7958 for the trust anchor format). The root signs the DS record for <code>.com<\/code>, which is the hash of <code>.com<\/code>&#8216;s DNSKEY. The <code>.com<\/code> zone&#8217;s key signs the DS record for <code>example.com<\/code>, published in <code>.com<\/code>&#8216;s zone. And <code>example.com<\/code>&#8216;s own key signs its actual records, like the A record for <code>www<\/code>.<\/p>\n<p>So when a validating resolver asks for <code>www.example.com<\/code>, it isn&#8217;t just trusting the final A record RRSIG, it&#8217;s walking the delegation chain: verify <code>example.com<\/code>&#8216;s DNSKEY against the DS record <code>.com<\/code> published, verify <code>.com<\/code>&#8216;s DNSKEY against the DS record the root published, and trust the root key because it&#8217;s baked into the resolver config. Break any link and validation fails, and depending on configuration the resolver either serves SERVFAIL or falls back to insecure behavior.<\/p>\n<p>This closes the Kaminsky-style attack vector, because an off-path attacker can forge packets all day but can&#8217;t produce a valid RRSIG without the zone&#8217;s private key. Spoofed data just fails validation and gets dropped.<\/p>\n<h2>Why it&#8217;s still not everywhere<\/h2>\n<p>Here&#8217;s where I get less enthusiastic, having watched this rollout in real time. DNSSEC requires two independent things to both happen: the zone owner has to sign their zone, and the resolver has to validate signatures. Neither side has much incentive to move first.<\/p>\n<p>Signed zones are a sizable minority. Verisign&#8217;s own numbers over the years have shown <code>.com<\/code>\/<code>.net<\/code> sitting in the low single-digit percentages of signed delegations for a long time, even though the TLDs themselves have been signed since 2011. Big companies with the operational maturity to handle key rollovers without breaking production tend to sign. Smaller sites, especially anyone on cheap shared DNS hosting where the provider doesn&#8217;t support DNSSEC signing in their control panel, just don&#8217;t.<\/p>\n<p>Validating resolvers are more common than signed zones, mostly because of Google Public DNS (8.8.8.8) and Cloudflare (1.1.1.1) both validating by default, which quietly protects a huge fraction of global queries. But plenty of ISP resolvers, especially outside North America and Europe, still don&#8217;t validate, and some enterprise resolvers disable it because a key rollover mistake upstream can cause a hard outage (this has happened publicly, NASA.gov had a DNSSEC misconfiguration outage in 2012, and there&#8217;ve been repeats elsewhere since).<\/p>\n<p>Then there&#8217;s the &#8220;last mile&#8221; problem I think gets underrated: DNSSEC protects the path between your resolver and the authoritative server. It does nothing for the path between your laptop and your resolver, which is usually plain UDP over whatever network you&#8217;re on, cafe wifi included. For that leg you need DoH or DoT, which are a completely separate deployment story with their own politics (ISPs don&#8217;t love DoH because it moves DNS visibility to the browser vendor).<\/p>\n<p>NSEC vs NSEC3 is a design compromise most people never think about. Authenticated denial of existence (proving <code>doesnotexist.example.com<\/code> really doesn&#8217;t resolve) needs some mechanism, and the original approach, NSEC (RFC 4034), works by returning the next actual name in the zone alphabetically: &#8220;I don&#8217;t have what you asked for, but here&#8217;s proof, because the next record I have is <code>zebra.example.com<\/code>, so nothing between you and zebra exists.&#8221; The side effect is that anyone can walk the entire zone by querying nonexistent names in sequence and reading off the NSEC chain, which fully enumerates every hostname in the zone, a real problem for anyone who considers their subdomain list sensitive (internal hostnames, pre-launch products, etc). NSEC3 (RFC 5155) fixes this by hashing the names before chaining them, so you get proof of non-existence without directly reading out the real names, at the cost of being crackable via offline dictionary\/rainbow-table attacks against the hashes if the zone uses weak salt\/iteration settings, and at the cost of noticeably more computational overhead on both signing and validation.<\/p>\n<p>None of this makes DNSSEC a bad design. It fixed the exact structural flaw Kaminsky exploited, and if you&#8217;re running authoritative DNS for anything that matters, sign your zone and use NSEC3 unless you have a specific reason not to. But treating it as solved infrastructure, the way TLS has become for HTTP, isn&#8217;t accurate yet. It&#8217;s a two-sided deployment problem where both sides are rational to wait for the other, and in the meantime cache poisoning variants keep getting published against the resolvers that still rely on entropy alone.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The basic poisoning problem DNS over UDP has no authentication built into the base protocol. When your resolver asks an authoritative server &#8220;what&#8217;s the A record for example.com&#8221;, the response just needs to match a few fields to be accepted: source IP, destination port, query ID (a 16-bit field), and the question name. If an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":296,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[295,252,294],"class_list":["post-282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","tag-cache-poisoning","tag-dns","tag-dnssec"],"_links":{"self":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/comments?post=282"}],"version-history":[{"count":2,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":540,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/posts\/282\/revisions\/540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media\/296"}],"wp:attachment":[{"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/media?parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/categories?post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.canutethegreat.com\/index.php\/wp-json\/wp\/v2\/tags?post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}