Course contentsShow
← Security
Lesson 1130 of 3,05223. Web Security - Modern Web AttacksFree lesson

DNS Cache Poisoning and Spoofing

Understanding DNS cache poisoning techniques, DNSSEC validation, and attacks that redirect traffic to malicious servers.

DNS Cache Poisoning and Spoofing

What you'll learn: How attackers manipulate DNS caches to redirect users to malicious servers, and how DNSSEC helps prevent it.

The Core Problem

DNS cache poisoning is an attack where an adversary injects false DNS records into a DNS resolver's cache, causing it to return incorrect IP addresses for domain names. Think of it like swapping the address book in a post office—when someone looks up "bank.com," they're told the wrong building.

When a DNS resolver queries authoritative nameservers, it caches responses temporarily to improve performance. An attacker who can inject forged DNS responses during this query process can poison the cache with malicious data.

How It Works

In a traditional DNS cache poisoning attack:

  1. Victim queries their DNS resolver for bank.com
  2. Resolver queries the authoritative nameserver
  3. Attacker races to send fake DNS response before the real one arrives
  4. If the attacker's forged response matches the transaction ID and arrives first, the resolver accepts it
  5. Now everyone using that resolver is directed to the attacker's server instead

DNS spoofing is similar but typically refers to individual, real-time response forgery rather than persistent cache pollution.

DNSSEC as Defense

DNSSEC (DNS Security Extensions) addresses this by adding cryptographic signatures to DNS records. Each response includes a digital signature that can be verified against a chain of trust rooted in the DNS hierarchy. If signatures don't match, the response is rejected—like requiring a notarized seal on that address book entry.

Without DNSSEC, attackers can exploit weak transaction IDs, predictable port numbers, or timing vulnerabilities to inject poisoned records that persist for hours.

Key Takeaway: DNS cache poisoning exploits the trust model of DNS caching by injecting forged records, redirecting users to malicious servers; DNSSEC provides cryptographic validation to prevent accepting tampered DNS responses.