Skip to content

Lesson 7 of 9 · 27m

Cache Poisoning: From Kaminsky to Modern Resolver Defenses

Why DNS cache poisoning mattered, what attackers exploited, and how source-port randomization, cookies, TCP, and encryption changed the game.

In 2008, Dan Kaminsky showed that DNS was not just vulnerable in theory. Recursive resolvers could be tricked into accepting forged answers at scale, poisoning caches for banks, mail providers, and software update systems. The lesson still matters: availability and authenticity are different properties, and vanilla DNS historically provided only availability.

The poisoning race

A recursive resolver asks an authoritative server for a name. If an attacker can guess the transaction ID and source port, they can race a forged UDP answer back before the legitimate answer arrives.

attacker -> resolver: forged answer for bank.example
legit authoritative server -> resolver: real answer, too late
resolver cache: forged answer retained until TTL expires

The Kaminsky insight was about forcing many lookups. By querying random nonexistent sibling names, the attacker created repeated races while smuggling in malicious delegation data for the parent domain.

Defenses that raised the bar

  • Transaction ID randomization: only 16 bits, so insufficient by itself.
  • Source-port randomization: expanded the guessing space dramatically.
  • Query name case randomization (0x20 encoding): extra entropy when both sides preserve case.
  • DNS cookies: client/server tokens make blind spoofing much harder.
  • TCP fallback and larger cookies reduce some UDP spoofing paths.
  • Encrypted transport protects the client-to-resolver path, not necessarily resolver-to-authoritative.

Test resolver behavior carefully

dig @resolver example.net TXT +noall +answer
dig @resolver example.net TCP +tcp +noall +answer

You generally do not 'test cache poisoning' on infrastructure you do not operate. What you can audit is configuration: recursion restrictions, response rate limiting, DNS cookies, software version, egress filtering, and whether the resolver is open to the world.

Spoofing is a network problem too

Routers should prevent source-address spoofing with BCP 38-style egress filtering. If a network allows arbitrary forged source addresses, protocol-level defenses are doing all the work. Resolver operators should also avoid forwarding through unpredictable middleboxes that normalize entropy away.

Field notes

  • A poisoned cache can outlive the original attack because TTL controls how long the lie persists.
  • Short TTLs reduce exposure windows but do not prevent poisoning.
  • Open resolvers are both abuse amplifiers and operational risks; restrict recursion to intended clients.
  • Modern encrypted DNS protects user-to-resolver privacy and integrity. It does not validate that authoritative DNS data is correct.

Was this lesson helpful?

Sign in to rate