What is DNS Cache Poisoning?
DNS Cache Poisoning (also known as DNS spoofing) is an attack where fraudulent DNS data is injected into a recursive resolver's cache, causing the resolver to return an incorrect, attacker-controlled IP address to unsuspecting clients.
Because DNS predominantly relies on the connectionless User Datagram Protocol (UDP), it inherently lacks the cryptographic handshakes and statefulness of protocols like TCP. If an attacker can successfully forge a UDP response packet and trick a recursive resolver into accepting it before the legitimate authoritative server responds, the resolver will cache the malicious record.
Once the cache is poisoned, every user relying on that resolver (which could be an entire corporate network or ISP) will be transparently routed to adversary-in-the-middle infrastructure or phishing sites without any browser warnings.
The Kaminsky attack explained
In 2008, security researcher Dan Kaminsky revolutionized DNS cache poisoning by discovering a flaw that made it mathematically trivial to poison almost any resolver on the internet.
Before Kaminsky, attackers struggled to poison caches because resolvers would not issue a new query (and open a new window for forged responses) if the record was already cached. Attackers had to wait for the TTL to expire.
The Kaminsky attack bypassed this using the "birthday paradox" and a flood of queries for randomized, non-existent subdomains. By querying 123xyz.bank.com, the attacker forced the resolver to constantly ask the authoritative server for answers it didn't have. Since the attacker didn't care about 123xyz, they could repeatedly attempt to inject an out-of-bailiwick "glue" record alongside the forged response, claiming the authoritative nameserver for all of bank.com was actually controlled by the attacker.
Real attack flow
A typical Kaminsky-style poisoning attack unfolds as a high-speed race condition:
- The Lure: The attacker queries the victim's recursive resolver for
random1.example.com. - The Outbound Query: The resolver, having a cache miss, generates an outbound UDP query to the legitimate nameserver, assigning it a 16-bit Transaction ID (TXID).
- The Flood: The attacker immediately blasts thousands of forged UDP responses back to the resolver, guessing different TXIDs.
- The Collision: If one of the forged packets contains the correct TXID and arrives before the legitimate response, the resolver accepts the malicious payload.
;; Example of a forged response with malicious glue
random1.example.com. IN A 192.168.1.99
;; Additional Section (The Poison)
example.com. IN NS attacker-ns.com.
attacker-ns.com. IN A 10.0.0.50
Why resolvers were vulnerable
Legacy DNS architecture was remarkably fragile due to limited entropy.
To validate a response, older resolvers only checked two things: the destination IP (the resolver itself) and the 16-bit Transaction ID. Because a 16-bit field only holds 65,536 possible values, an attacker simply had to blast 65,536 packets to guarantee a collision. Combined with predictable, static source ports (e.g., UDP 53) on outbound queries, the guess space was exceptionally small.
Primary defenses: DNSSEC signature validation
The only mathematically robust defense against cache poisoning is DNSSEC.
DNSSEC fundamentally shifts the trust model from "matching ephemeral ports and IDs" to "verifying cryptographic signatures." Even if an attacker successfully executes a Kaminsky race condition, guesses the TXID, and beats the legitimate packet, a validating resolver will simply drop the forged response because it lacks the valid RRSIG cryptographic signature.
Secondary defenses
While DNSSEC is the long-term fix, the industry adopted several probabilistic mitigations to drastically increase the mathematical difficulty of poisoning:
- Source Port Randomization: Instead of sending all outbound queries from UDP port 53, modern resolvers select a random high port (expanding the guess space from 65k to over 4 billion).
- 0x20 Encoding: Randomizing the capitalization of the query (e.g.,
eXaMpLe.CoM) and enforcing that the authoritative server replies with the exact same case. - Strict Bailiwick Rules: Resolvers were hardened to strictly reject "out-of-bailiwick" data, refusing to cache arbitrary A records included in the additional section that do not directly pertain to the queried zone.
Tip
The 2008 Kaminsky vulnerability was so severe that it prompted an unprecedented, coordinated secret patching effort across all major vendors (Microsoft, Cisco, BIND, etc.) before the details were publicly disclosed.
Testing your resolver's randomization
You can test the entropy of your network's recursive resolver using specialized diagnostic tools. The standard method is querying a custom authoritative server designed to echo back the source port and TXID it received.
Using dig against OARC's testing infrastructure:
dig +short porttest.dns-oarc.net TXT
The response will evaluate whether your resolver has "POOR", "GOOD", or "GREAT" source port randomization.
Cache TTL and the poisoning window
The Time-To-Live (TTL) value dictates how long a record stays in the cache. While lower TTLs are great for agility, they also increase the frequency that a resolver must query the authoritative server, inadvertently opening more windows (race conditions) for an attacker to attempt a poisoning flood. Modern mitigation relies on entropy and DNSSEC rather than manipulating TTLs.
Modern resolver protections
Modern recursive resolver software implements rigorous anti-poisoning features by default:
- BIND: Enables
port-randomizationand strictdnssec-validation auto;by default in modern releases. - Unbound: Built specifically for resilience, enforcing strict bailiwick rules and 0x20 encoding natively.
- PowerDNS Recursor: Features sophisticated spoofing detection and will actively throttle responses that appear to be part of a poisoning flood.
How CyberFurl Helps
Automated monitoring. Zero manual work.
CyberFurl checks whether your authoritative nameservers and DNS resolvers have DNSSEC validation enabled — the primary defense against Kaminsky-style cache poisoning attacks. By cross-validating your DNS responses against DNSSEC signatures and monitoring for unexpected record changes, CyberFurl detects poisoning attempts and resolver misconfigurations before they redirect your users to attacker-controlled infrastructure.
