Kaminsky DNS Cache Poisoning
A flaw in DNS itself let attackers forge the internet's address book. The fix was patched in secret across vendors on one day.
- Severity
- Front-page news
- Difficulty
- advanced
- Companies
- ISC (BIND), Microsoft, Cisco
- Tech
- DNS, UDP, Cache poisoning, DNSSEC
- Root cause
- insecure defaults, injection / unsafe parsing
The story
Quick (1 min)
In 2008, security researcher Dan Kaminsky found a way to trick the internet's address book, DNS, into giving out fake answers.
When your computer asks "where is example.com?", a DNS server (resolver) asks around and remembers (caches) the answer. Kaminsky showed attackers could flood a resolver with forged replies and get one accepted, a cache poisoning attack. After that, everyone using that resolver would be sent to the attacker's server for a real website, email system or login page.
The flaw was in how DNS itself worked, so it affected many vendors' software. They worked together in secret and released patches on the same day, 8 July 2008. Details leaked about two weeks later.
The lesson: protocols that rely on guessable numbers for security will eventually be guessed. Add randomness, or better, signatures (DNSSEC).
Keep reading to the end to earn XP.Read. XP earned.
Engineer (2 min)
How a resolver accepts answers. A resolver sends a UDP query with a 16-bit transaction ID and accepts the first reply that matches the ID (and the question). If an attacker can send a forged reply with the right ID before the real one arrives, the resolver caches the forgery.
Weaknesses CERT listed (VU#800113):
- Small transaction ID space: 16 bits, so on average 32,768 guesses if the ID is truly random. Some implementations had weak randomness.
- Multiple outstanding identical queries: these enable a "birthday attack", raising the odds of a match.
- Fixed source port: many resolvers used one port for all queries (sometimes 53/udp), so the port added no extra guessing.
Kaminsky's trick. Normally, once www.example.com is cached, an attacker has to wait for the TTL to expire before trying again. Kaminsky avoided that by asking about random sibling names like 83.example.com, which are never cached. Each lookup is a fresh chance to race a forged reply, and the forged reply can include referral information for the target domain itself. With many sibling names in a row, the attacker gets endless attempts.
The fix. Source port randomisation: send each query from a random UDP port, adding roughly 16 more bits the attacker must guess. That's a mitigation within the current protocol. CERT noted that only protocol changes such as DNSSEC can fully prevent poisoning. NAT/PAT devices that rewrite ports can undo the randomisation.
Interview takeaway: unauthenticated UDP protocols rely on unpredictability; maximise entropy and move towards cryptographic authentication.
Keep reading to the end to earn XP.Read. XP earned.
Deep dive (2 min)
Timeline
- 1999: Dan Bernstein (djbdns) had already reported the small transaction ID problem; djbdns used source port randomisation (Wikipedia).
- Early 2008: Kaminsky discovers a practical, fast way to poison most caching resolvers (Wikipedia).
- 8 July 2008: coordinated patches released by many DNS vendors. CVE-2008-1447 published (NVD); CERT VU#800113 issued.
- 21 July 2008: details leak before Kaminsky's planned 30-day embargo. They are pulled down but mirrored (Wikipedia).
- August 2008: Kaminsky presents at Black Hat (Wikipedia).
Who was affected
NVD's CVE-2008-1447 names BIND 8 and 9 before specific patched versions, Microsoft DNS in Windows 2000 SP4, XP SP2/SP3 and Server 2003 SP1/SP2, and "other implementations." Wikipedia notes djbdns, PowerDNS, MaraDNS, Secure64 and Unbound were not vulnerable. CERT stresses caching resolvers, open or not, were most at risk, and stub resolvers too.
Impact of a successful attack (CERT)
"An attacker with the ability to conduct a successful cache poisoning attack can cause a nameserver's clients to contact the incorrect, and possibly malicious, hosts for particular services. Consequently, web traffic, email, and other important network data can be redirected to systems under the attacker's control."
Wikipedia adds examples: website impersonation, email interception, and abusing "Forgot my password" flows.
CERT's recommended mitigations
- Patch nameservers and stub resolvers to randomise source ports per query.
- Restrict who can ask for recursion. This limits exposure but doesn't stop attackers on authorised hosts.
- Watch for NAT/PAT devices that reduce port randomness.
- Long term: protocol changes such as DNSSEC.
The disclosure debate
Kaminsky coordinated in secret with vendors and delayed full details. Wikipedia notes he drew some backlash from the security community for not disclosing immediately. It's a frequently cited example of multi-vendor coordinated disclosure.
Severity
NVD rates CVE-2008-1447 at CVSS 3.1 base score 6.8.
Keep reading to the end to earn XP.Read. XP earned.
Failure replay
Step by step, what broke and what it hit next. Showing the key steps. Switch to Engineer or Deep dive for every step.
- NormalResolverhealthy
A caching resolver sends UDP queries with a 16-bit ID, often from a fixed port, and caches the first matching reply.
Affects: Authoritative server
- AttackAttackercompromised
The attacker makes the resolver look up random sibling names like 83.example.com that are never cached.
Affects: Resolver
- AttackAttackercompromised
For each lookup, the attacker floods forged replies guessing the transaction ID. Each forgery carries a referral for the real domain.
Affects: Resolver
- AttackResolvercompromised
One forged reply wins the race. The resolver caches attacker-chosen records for the target domain.
Affects: Users
- After poisoningUserscompromised
Everyone using that resolver is sent to the attacker's servers for web, email or login traffic.
- Jul 8, 2008Resolverrecovering
Coordinated patches add per-query source port randomisation, about 16 more bits for attackers to guess.
Affects: Authoritative server
- Long termAuthoritative serverhealthy
DNSSEC lets resolvers verify signed answers, the full fix CERT pointed to.
Affects: Resolver
Impact
- Who was affected
- Most caching DNS resolvers and many stub resolvers, including BIND 8/9 and Microsoft DNS; some implementations (djbdns, PowerDNS, Unbound and others) were not vulnerable.
- How long
- Disclosed with coordinated patches on 8 July 2008; details leaked on 21 July 2008; exposure lasted until each resolver was patched.
- Cost
- not disclosed
Lessons
- Security that depends on guessing a small number (16 bits) is fragile; add entropy wherever possible.
- Attackers find ways to get unlimited attempts; sibling names bypassed TTL protection.
- Coordinated disclosure can patch a whole ecosystem at once.
- Mitigations within a weak protocol help, but cryptographic authentication (DNSSEC) is the real fix.
Quiz
How large is the DNS transaction ID field?
The answer is 16 bits. CERT notes a 16-bit ID means about 32,768 guesses on average if it's truly random.
Check answer
16 bits. CERT notes a 16-bit ID means about 32,768 guesses on average if it's truly random.
What trick let Kaminsky's attack bypass the TTL defence?
The answer is Querying random, uncached sibling names so every lookup was a fresh chance to inject records for the target. Unique names like 83.example.com had no cache entry, so each one gave a new race.
Check answer
Querying random, uncached sibling names so every lookup was a fresh chance to inject records for the target. Unique names like 83.example.com had no cache entry, so each one gave a new race.
What was the main patch released on 8 July 2008?
The answer is Source port randomisation for each query. Random source ports add about 16 bits an attacker must also guess.
Check answer
Source port randomisation for each query. Random source ports add about 16 bits an attacker must also guess.
According to CERT, what can fully prevent cache poisoning?
The answer is Protocol changes such as DNSSEC. Port randomisation reduces success chances by orders of magnitude, but only DNSSEC-style authentication fully prevents it.
Check answer
Protocol changes such as DNSSEC. Port randomisation reduces success chances by orders of magnitude, but only DNSSEC-style authentication fully prevents it.
Interview prep
Try answering out loud before you open the model answer.
- security
Explain how DNS cache poisoning works and how Kaminsky's 2008 technique made it practical.
Show model answer
Resolvers accept the first UDP reply matching the transaction ID and question. An attacker who forges a reply with the correct 16-bit ID before the real one arrives gets it cached. Previously, once a name was cached the attacker had to wait for the TTL to expire. Kaminsky queried random, uncached sibling names (like 83.example.com), so every query was a new race, and the forged reply included referral records for the real domain. That gave unlimited fast attempts. Mitigation: source port randomisation (about 16 more bits), restricting recursion, and ultimately DNSSEC.
A strong answer hits:
- First matching reply wins
- 16-bit transaction ID is guessable
- Sibling-name trick bypasses TTL
- Port randomisation and DNSSEC
How did your answer compare? - behavioural
You discover a vulnerability that affects many vendors and the protocol itself. How would you handle disclosure?
Show model answer
Coordinate before going public: contact a coordinator like CERT/CC, bring in major vendors under embargo, agree a single release date so patches ship together, and prepare clear guidance for operators. Plan for leaks; Kaminsky's details leaked about two weeks after the patches. Balance the time vendors need against the risk of independent discovery, and publish full details once patches are widely available.
A strong answer hits:
- Use a coordinator (CERT/CC)
- Embargo and a simultaneous release
- Operator guidance
- Plan for leaks
How did your answer compare? - system design
You run a recursive DNS resolver for a large network. What would you do to protect it against cache poisoning?
Show model answer
Use well-maintained resolver software with random transaction IDs and per-query source port randomisation, and make sure NAT or firewalls don't undo that randomisation. Restrict recursion to your own clients rather than running an open resolver. Enable DNSSEC validation so forged answers fail signature checks. Monitor for unusual volumes of unmatched responses. Keep the software patched.
A strong answer hits:
- Random IDs and source ports
- Check NAT doesn't reduce randomness
- No open recursion
- DNSSEC validation and monitoring
How did your answer compare?
Go deeper
- AdvisoryVU#800113 — Multiple DNS implementations vulnerable to cache poisoningCERT/CC, link checked 2026-11-25
- AdvisoryCVE-2008-1447 DetailNIST National Vulnerability Database, link checked 2026-11-25
- ArticleDan Kaminsky — Flaw in DNSWikipedia, link checked 2026-11-25