DNS Cache Poisoning: Detection, Response, and Prevention

Server racks connected by glowing network paths, with one red path diverted to an unintended destination.

You can tell when DNS has lied to your network, but only after you rule out the ordinary causes that look identical at first glance. A DNS cache poisoning attack plants a forged record in a resolver’s cache, and every client that trusts that resolver follows the false answer until the record expires or someone removes it. To detect DNS cache poisoning, compare what your resolver returns against a direct query to the domain’s authoritative nameserver (with DNSSEC validation on), then rule out stale TTLs, CDN geo-answers, split-horizon views, and local hosts overrides before you treat the mismatch as an attack.

Server racks connected by glowing network paths, with one red path diverted to an unintended destination.

That order of operations matters in practice. If you flush the cache first, you destroy the only evidence of what clients were told. If you blame the resolver first, you can miss a compromised registrar account or a tampered authoritative zone, which no amount of cache clearing will fix.

PacketTools was built by an engineer with over 28 years in enterprise networking and security, and its free browser tools (DNS Lookup, the DNS Propagation Checker, and the SSL/TLS Checker) log no IPs, queries, or test data. That makes them useful during an incident, when you want an outside view of DNS without leaving a trail. The workflow below lets you confirm or rule out poisoning, preserve evidence, repair the right layer, and harden your resolvers with DNSSEC validation, which encryption alone does not provide.

How Do False DNS Answers Become Trusted Cache Entries?

A network security engineer monitors a deceptive DNS response entering a server cache.

A resolver trusts any reply that matches the question it asked, and classic DNS gives it no built-in way to check who wrote that reply. Caching turns one accepted forgery into a shared answer, and the 2008 Kaminsky disclosure showed how practical that forgery had become.

How Do Resolvers Cache Domain Names and IP Addresses?

When your laptop needs an IP address for a domain name, its stub resolver asks a recursive DNS resolver. That resolver checks its DNS cache first. On a miss, it walks the hierarchy (root, TLD, then the authoritative nameserver) through DNS recursion and stores the final DNS record for the time-to-live (TTL) the authoritative server attached.

DNS caching is why resolution feels instant. A record with a 3600-second TTL can answer thousands of DNS queries from memory for an hour. The trade-off is that the resolver cache holds whatever it accepted, good or bad, until the TTL runs out or an admin clears it.

The cache you care about during an incident lives in several places:

  • Recursive resolver cache: shared by every client using that server, so one bad entry affects many users.
  • Forwarder cache: an on-prem DNS server forwarding to an upstream resolver keeps its own copy.
  • Operating system cache: Windows, macOS, and Linux (systemd-resolved) all cache locally.
  • Browser cache: Chrome and Firefox hold their own short-lived entries.

How Can a Forged Response Poison a Resolver Cache?

A resolver matches each reply to its outstanding question using a handful of fields: the query name and type, the destination port it sent from, and a 16-bit transaction ID. Because most DNS runs over UDP, there’s no handshake proving the reply came from the server the resolver asked. The difference between DNS over TCP or UDP is exactly why spoofed datagrams are possible at all.

A cache poisoning attack succeeds when a forged response matches those fields and arrives before the legitimate one. Academic work describes two broad paths: an attacker can poison the cache by compromising an authoritative DNS server or by forging a response to a recursive query. Other routes include on-path tampering and exploiting resolver software bugs.

Once accepted, the false IP address is served to every client that asks for that name. Wikipedia describes the result as corrupt data causing the name server to return an incorrect result record, for example the wrong IP address.

What Did Dan Kaminsky’s 2008 Discovery Change?

Before 2008, defenders assumed a forger had to win a narrow race once per TTL. Dan Kaminsky showed that an attacker could trigger fresh lookups for random, nonexistent subdomains, getting unlimited attempts, and use forged replies to overwrite delegation data for the whole parent domain. Guessing a 16-bit transaction ID became a matter of seconds to minutes.

The coordinated fix was source port randomization. Resolvers began sending each query from an unpredictable UDP port, multiplying the values an attacker must guess alongside the transaction ID. BIND, Microsoft DNS, and other vendors patched together.

Randomization raised the bar without closing the protocol gap. Side-channel research keeps finding ways to infer ports; a 2026 USENIX Security paper reports that under certain conditions the cache can often be poisoned with as few as 3-4 spoofed packets. Cryptographic validation is what ends the guessing game.

What Damage Can a Poisoned Resolver Cause?

A cybersecurity analyst examines a network diagram showing traffic diverted to a suspicious server.

A poisoned resolver silently redirects every user behind it, so the damage scales with how many clients share that cache. The most common outcomes are credential theft, blocked updates, and malware delivery, while HTTPS limits but does not erase the risk.

How Can Redirected Traffic Enable Phishing and Data Theft?

DNS poisoning turns phishing into a trap that careful users still fall into. Your staff can type the correct domain, from a bookmark, with no suspicious link involved, and still land on a phishing website, because the redirect happens before the browser connects.

The usual targets are login portals, webmail, VPN gateways, and payment pages. A malicious website that mirrors your SSO page collects usernames, passwords, and sometimes MFA codes relayed in real time. That data theft is quiet: the attacker can proxy the session onward so the user sees nothing wrong.

Non-browser traffic is exposed too. API clients, SMTP relays, and scripts with weak certificate checks will connect to whatever IP address DNS hands them.

Can Poisoning Disrupt Services or Malware Protection?

Yes. Redirecting or black-holing a name breaks anything that depends on it, from SaaS apps to license servers. In incident reviews, the first symptom is frequently a help-desk ticket about one app failing while everything else works.

Security tooling is a high-value target. If endpoint agents can’t reach their vendor’s update domains, security updates and signature downloads stall, leaving machines on stale protection. Worse, an attacker who controls an update or software-download hostname can push malware distribution through a channel your users already trust, setting up a malware infection that looks like routine patching. Signed updates blunt this; unsigned installers and scripts do not.

What Protection Does HTTPS Provide Against Redirection?

HTTPS with TLS is your strongest safety net after a redirect. A browser connecting to a poisoned IP address still demands a certificate valid for the real domain, and an attacker without that certificate triggers a hard warning.

That protection has limits you should plan around:

  • Users who click through certificate warnings defeat it.
  • Plain HTTP pages and HTTP-to-HTTPS redirects without HSTS can be intercepted before the upgrade.
  • An attacker who also controls DNS for a domain can sometimes obtain a domain-validated certificate, which is why authoritative compromise is more dangerous than resolver poisoning.
  • Internal apps with self-signed certificates train users to ignore warnings.

HSTS preloading and strict certificate validation in non-browser clients close most of these gaps.

How Can You Verify Suspected Poisoning Without Jumping to Conclusions?

Conflicting DNS answers prove only that two resolvers disagree. FIRST’s DNS abuse guidance makes the point directly: it can be hard to confirm the intent, as an incorrect cache result may be just a mistake. Work through benign explanations first, then isolate which layer produced the bad answer.

Keep the terms straight as you go. DNS spoofing is any forged answer; DNS hijacking is the broader category of redirecting resolution, including changed client settings or a tampered registrar; cache poisoning is the specific case where the forgery lands in a shared cache.

Is the Difference Caused by Stale Records, CDNs, or Split-Horizon DNS?

Most “poisoning” tickets turn out to be one of these:

  • Stale records after a change: if someone updated an A record an hour ago and the old TTL was 86400, resolvers will serve the previous IP address legitimately until it expires. A DNS propagation checker shows that pattern clearly: some locations on the old value, some on the new, both values owned by you.
  • CDN and GeoDNS answers: Akamai, CloudFront, and similar platforms return different IPs by region on purpose. Check whether the differing IP belongs to the provider’s published ranges and whether the CNAME chain points to their hostname.
  • Split-horizon DNS: your internal servers answer intranet.company.com with a private 10.x address while public resolvers return a public one, or nothing.

If the “wrong” IP sits in your provider’s ASN or your own address space, you’re almost certainly looking at one of these.

Is the Change in a Cache, a Hosts File, or Authoritative DNS?

Locate the layer that changed before you fix anything. Each points to a different problem and a different owner:

Where the bad answer appears Likely cause Who owns the fix
One machine only Hosts file entry, malware, or changed local DNS settings Endpoint team
All clients on one resolver Resolver cache poisoning or a bad forwarder DNS/network team
Every resolver worldwide, including authoritative Compromised authoritative DNS server, registrar, or zone edit Domain owner, registrar
Authoritative NS set differs from registry Delegation hijack at the registrar Domain owner, registrar

On Windows, check C:WindowsSystem32driversetchosts; on macOS and Linux, /etc/hosts. Confirm the client’s configured resolver matches policy, since malware like DNSChanger simply repointed clients to attacker servers. If the authoritative answer itself is wrong, the problem is upstream of any cache, and you should review DNS delegation records at the registry.

Compare A, AAAA, CNAME, and NS Answers With PacketTools and Direct Queries

Query each record type three ways: through the suspect resolver, through an independent public resolver, and directly against the authoritative DNS server. With dig:

  • dig @10.0.0.53 portal.company.com A +dnssec (your resolver)
  • dig @1.1.1.1 portal.company.com A +dnssec (independent view)
  • dig NS company.com +trace to find and query the authoritative server

Repeat for AAAA, CNAME records, and NS. Attackers sometimes alter only the IPv6 answer or a CNAME target, so checking A alone misses them. Note the TTL in each response: a poisoned entry shows a TTL counting down from a value the authoritative server never published.

PacketTools’ DNS Lookup gives you the same comparison from outside your network without logging the query, which is useful when you don’t want an investigation visible in third-party analytics. The FIRST guidance adds one condition: to be certain, DNSSEC validation must be on for the query to the authoritative server, and a validated authoritative answer must fail to match the cached one. Broader steps to troubleshoot DNS issues help when the mismatch turns out to be configuration.

Use PacketTools’s SSL/TLS Checker to Investigate Certificate Warnings

A sudden certificate warning on a familiar site is one of the best early signals of redirection. Run the hostname through PacketTools’ SSL/TLS Checker from outside your network and compare it with what an affected client sees.

Look at these details:

  • Issuer and subject: does the certificate chain to the CA you normally use?
  • SAN list: does it include the exact hostname?
  • Serial number and fingerprint: do they match the certificate from an unaffected network?
  • Validity dates: a certificate issued hours ago, from an unexpected CA, deserves scrutiny.

If the outside check shows your normal certificate while affected clients receive something else, the redirect is happening inside your DNS traffic path. If both views show an unfamiliar new certificate, suspect authoritative or registrar compromise.

What Should You Do When Poisoning Is Suspected?

Collect evidence first, cut off exposure second, repair the source third, and clear caches only after that. Reversing the order erases what you need to scope the incident.

Preserve DNS Answers, TTLs, Timestamps, and Resolver Evidence

Before anyone touches the DNS cache, capture what it holds. Save full dig output (with timestamps and remaining TTLs) for the affected names from the suspect resolver and from authoritative servers.

Then dump the resolver state:

  • BIND: rndc dumpdb -cache, which writes named_dump.db
  • Unbound: unbound-control dump_cache
  • Windows DNS Server: Show-DnsServerCache in PowerShell

Export query logs, DNSSEC validation failure logs, and firewall flow records for the window in question. A short packet capture on port 53 at the resolver can show unexpected bursts of responses. Hash and store everything with UTC timestamps so it stands up in a later review.

Contain Exposure and Repair the Affected Resolver or Configuration

Containment means stopping new clients from receiving the bad answer. Common moves include repointing DHCP or VPN-pushed DNS to a known-good resolver, or temporarily blocking the malicious IP at the firewall. You can change DNS settings on critical endpoints manually if DHCP leases are long.

Then fix the cause you identified. That can mean patching resolver software, closing an open recursive resolver to the internet, correcting a bad forwarder, removing a hosts file entry, or locking the registrar account and restoring zone records. If an internal forwarder sends a zone to the wrong upstream, review each conditional forwarder rule.

Flush Affected Caches After Evidence Collection and Source Remediation

Flush only after the source is fixed; otherwise the bad record repopulates on the next lookup. Clear every layer, top to bottom:

  • Resolver: rndc flushname portal.company.com (BIND), unbound-control flush portal.company.com, or Clear-DnsServerCache
  • Forwarders and any upstream caches you control
  • Clients: ipconfig /flushdns on Windows, sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS, resolvectl flush-caches on Linux
  • Browsers: restart, or clear host cache at chrome://net-internals/#dns

Platform-specific steps to flush the DNS cache cover other OS versions.

Recheck Resolution and Investigate Possible Credential Exposure

Rerun the same DNS queries against the repaired DNS server and confirm the answers match the validated authoritative response. Check from several networks, since clients on long DHCP leases or remote VPNs may still use the old path.

Then treat it as a possible data theft incident. Pull proxy and firewall logs for connections to the malicious IP during the exposure window, identify which users reached it, and force password resets and session revocation for them. Review SSO logs for logins from unfamiliar locations that followed the exposure.

Which Defenses Reduce the Risk of Future Poisoning?

DNSSEC validation on your resolvers is the defense that addresses forged answers directly; patching, randomization, and monitoring narrow the window around it. Encrypted transports protect a different leg of the path.

How Do DNSSEC Signing and Resolver Validation Work Together?

Domain Name System Security Extensions add cryptographic signatures (RRSIG records) to zone data, with a chain of trust running from the root through DS records at each parent. A forged answer without a valid signature fails the check.

Both halves are required. The domain owner must sign the zone and publish the DS record at the registrar; your resolver must validate. Turn validation on with dnssec-validation auto; in BIND, auto-trust-anchor-file in Unbound, or by enabling validation on Windows Server resolvers.

Watch for SERVFAIL responses afterward. FIRST notes that validation failures in logs can highlight potential incidents, though some come from misconfigured domains.

Harden BIND and Other Resolvers With Updates and Response Checks

Resolver bugs keep producing new poisoning paths, so apply security updates for BIND, Unbound, PowerDNS, and Windows DNS promptly. Subscribe to vendor advisories.

Core hardening steps for DNS security best practices:

  • Restrict recursion to your own networks with allow-recursion ACLs
  • Keep source port randomization on, and avoid NAT devices that rewrite ports sequentially
  • Enable 0x20 case randomization where supported
  • Run separate servers for authoritative and recursive roles
  • Limit cache TTL ceilings (max-cache-ttl) to shorten exposure

Why Do DoH, DoT, and VPNs Not Replace DNSSEC?

DNS over HTTPS and DNS over TLS encrypt the hop between your client and its resolver, and a VPN tunnels that hop too. They stop on-path tampering on that link, such as a hostile Wi-Fi network.

None of them verifies the data. If the resolver at the other end has a poisoned cache, encryption delivers the forged answer securely. End-to-end encryption of transport and authenticity of records are separate properties, and DNSSEC provides the second. A DNS leak test confirms your encrypted or VPN resolver is the one in use.

Monitor DNS Changes and Keep Amplification Defenses in Perspective

Monitor your own critical names continuously: compare A, AAAA, MX, and NS answers against expected values from several vantage points, and alert on change. Registrar lock and MFA on registrar accounts block the most damaging hijacks.

Response rate limiting (RRL) belongs on authoritative servers to blunt DNS amplification attacks, which abuse your DNS traffic to flood third parties. RRL is worth running, but it targets volume abuse and does nothing to validate answers.

Restore Trust by Verifying the Source, Not Just Clearing the Cache

A cleared cache fixes DNS resolution for one TTL; a verified source fixes it for good. When answers conflict, compare your resolver against a DNSSEC-validated authoritative query, then eliminate stale TTLs, CDN geo-routing, split-horizon views, and hosts file overrides before calling it DNS cache poisoning.

If the evidence holds, preserve resolver dumps and logs, contain exposure, repair the layer that failed, and flush caches last. Close the gap with DNSSEC validation on your resolvers, signed zones you own, prompt patching, and change monitoring on your critical names. Your next step: run dig +dnssec against your top five business domains today and confirm each returns the ad flag through your production resolver.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *