resources background

Blog

What Is DNS Cache Poisoning? Risks and How to Prevent It

Written By Qasim, WhoisFreaks Team Published: November 05, 2025, Last Updated: May 11, 2026

Quick Answer: DNS cache poisoning is a cyberattack where forged DNS records are injected into a resolver's cache, causing users to be redirected to malicious sites even when typing the correct domain name. Attackers exploit the lack of cryptographic verification in the DNS protocol to plant false IP-to-domain mappings. The attack is silent by design: the browser's address bar shows the legitimate domain while the underlying IP address belongs to an attacker.

This guide covers how DNS cache poisoning works, the risks it creates, how to detect it, and the technical controls that prevent it, including how WhoisFreaks DNS tools help catch poisoning attempts before they cause harm.

How DNS Caching Works

Before looking at the attack itself, it helps to understand what DNS resolvers cache and why. When a device needs to reach a website, it sends a query to a DNS resolver. The resolver contacts the authoritative name server for that domain, retrieves the IP address, and returns it to the device. To avoid repeating this full lookup for every subsequent request to the same domain, the resolver stores the answer in its cache for a period defined by the domain owner. This period is the time-to-live (TTL).

Caching happens at multiple layers. Your browser maintains its own DNS cache. Your operating system maintains a separate one. Your ISP's resolver maintains another, and it serves many clients simultaneously. Each layer answers requests from its stored data before querying further upstream. This efficiency is what attackers target. If any one of these caches stores a forged record, every device relying on that cache receives the wrong IP address until the poisoned entry expires or is cleared.

How DNS Cache Poisoning Works

How DNS Cache Poisoning Works

DNS resolvers query authoritative servers and cache the responses to speed up future lookups. Attackers target the trust gap in this process: DNS resolvers do not, by default, cryptographically verify that a response came from the legitimate authoritative server. Four main methods exploit this gap.

  • Man-in-the-Middle (MITM) attacks: The attacker positions themselves between the user's device and the DNS resolver. When the resolver sends a query for a domain's IP address, the attacker intercepts it and injects a forged response containing a fraudulent IP. Because DNS commonly uses UDP, which has no handshake and no session verification, the resolver accepts the first matching response it receives. If the attacker's forged reply arrives before the legitimate authoritative response, the poisoned record enters the cache.
  • Transaction ID Guessing (Kaminsky Attack): The Kaminsky attack, demonstrated publicly in 2008, showed how a threat actor can flood a resolver with forged responses across thousands of subdomain queries simultaneously, racing to match the transaction ID and source port of a pending DNS query. By sending thousands of guessed responses in rapid succession, the attacker can poison a high-value domain record without intercepting any actual traffic. This attack prompted the widespread adoption of source port randomization as a partial mitigation and remains a benchmark for evaluating DNS resolver security.
  • DNS server hijacking or compromise: Rather than forging responses externally, adversaries can compromise the DNS server itself through software vulnerabilities or stolen administrative credentials. Once inside, they modify authoritative DNS records to return attacker-controlled IPs. Because the changes originate from the authoritative server, resolver caches across thousands of clients pick up the poisoned records without any external indication of tampering.

In all cases, the resolver's cache ends up holding a false domain-to-IP mapping. Every subsequent query for that domain returns the attacker's IP, redirecting users to fraudulent sites.

Note: Malware that modifies a device's local hosts file or substitutes its configured DNS resolver is a related but distinct threat. It requires local access or code execution on the target machine, not a network-layer attack against a resolver. It is better classified as a local privilege escalation or endpoint compromise issue rather than DNS cache poisoning.

What Are the Risks of DNS Cache Poisoning?

What Are the Risks of DNS Cache Poisoning?

DNS cache poisoning creates a direct path to several high-impact attacks.

  • Credential theft and phishing: Attackers redirect users to fake login pages that look identical to banking, email, or enterprise portals. The browser's address bar shows the correct domain name, so users have no obvious signal that anything is wrong. Passwords, MFA codes, and session tokens entered on the fake site go directly to the attacker.
  • Malware and ransomware delivery: A poisoned cache can send users to a site that installs malware through browser exploits (drive-by downloads) or prompts them to download fake software updates. Ransomware groups have used DNS poisoning as an initial access vector in multi-stage intrusions.
  • Disruption of software and security updates: When DNS entries for update servers are poisoned, endpoints stop receiving legitimate patches. Security software fails to update its signature databases. The same devices that most need protection become progressively more exposed, because their defenses are quietly degrading.
  • Censorship and access blocking: State-level actors use DNS poisoning to block access to targeted domains. Queries for blocked sites return invalid IPs or receive no response, denying access at the DNS layer without filtering traffic at the packet level. Users in affected regions cannot reach the legitimate IP because their resolver has been poisoned.
  • Brand and reputational damage: When customers are redirected from a business's domain to a fake site, the resulting credential theft and phishing incidents reflect badly on the organization even after the technical issue is resolved. Customer trust takes longer to recover than the DNS records themselves.

How to Detect DNS Cache Poisoning

Detection is harder than prevention because the attack is designed to be invisible to end users. Several indicators are reliable at the network and application layer.

Unexpected certificate warnings. When a poisoned cache redirects a user to an attacker-controlled site, that site's TLS certificate will not match the expected domain. Browsers display a security warning. Individual users frequently dismiss these, but security teams that monitor certificate mismatch events across their infrastructure can catch poisoning early and centrally.

DNS response anomalies. A resolver returning an IP address that falls outside the expected range for a domain is a strong signal. DNS monitoring tools that compare live resolver responses against authoritative records can flag these discrepancies automatically and continuously.

Sudden record changes. A domain's A record, NS record, or MX record changing without a corresponding administrative action is a major warning sign. Monitoring services that track record changes in near-real-time can alert security teams within minutes of an unauthorized modification.

User-reported redirect anomalies. End users sometimes notice that a familiar site looks different, shows unfamiliar login prompts, or presents a certificate warning. These reports, if collected and acted on quickly, can surface poisoning events that technical monitoring missed.

Security teams can also proactively verify DNS record integrity by querying the DNS Lookup tool against known-good IP baselines and comparing current responses against historical records in the DNS History API.

How to Prevent DNS Cache Poisoning

Defending against DNS cache poisoning requires multiple controls working in parallel. No single measure is sufficient on its own.

How to Prevent DNS Cache Poisoning
  • Deploy DNSSEC (DNS Security Extensions): DNSSEC (DNS Security Extensions) adds cryptographic signatures to DNS records. Resolvers that support DNSSEC validation can verify that a response came from the legitimate authoritative server and was not modified in transit. Without a valid signature, the response is discarded. Global DNSSEC adoption remains below 30%, meaning a significant share of the internet is still unprotected. For any domain handling financial transactions, user authentication, or email delivery, DNSSEC is a baseline requirement.

    Two operational realities are worth knowing before deployment. First, DNSSEC only works end-to-end when both the domain owner has signed their records and the resolver validates those signatures. A signed domain queried by a non-validating resolver gets no protection. Second, key rollover operations, if misconfigured, can cause DNSSEC validation failures that make the domain unreachable. Test rollovers in a staging environment and monitor validation status after any key change.
  • Use Encrypted DNS Protocols: DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT) encrypt the communication between a client device and its resolver. An on-path attacker cannot inject forged responses into an encrypted channel. Configuring endpoints to use DoH or DoT with a trusted resolver closes the injection window that MITM-based cache poisoning exploits.

    One limitation: DoH and DoT protect the path between the client and the resolver, but the resolver itself remains a trust point. If the resolver is compromised or operated by a malicious party, encrypted transport does not help. The choice of resolver matters as much as the protocol. For organizations, using an internal resolver or a well-audited public resolver paired with DNSSEC validation provides stronger assurance than DoH/DoT alone.
  • Enable Source Port Randomization: Modern DNS resolvers randomize the source port used in outgoing queries. This directly counters the Kaminsky-class attack by increasing the entropy an attacker must guess to inject a matching forged response. Any DNS resolver software that does not randomize source ports by default should be updated or replaced.
  • Monitor DNS Records Continuously: Monitoring tools that compare a domain's live DNS records against its expected state can detect poisoning before it impacts significant traffic. Automated alerts on unauthorized changes to A, NS, or MX records give security teams time to respond. The Domain Monitoring service and DNS Checker API from WhoisFreaks automate this comparison and send alerts when records change unexpectedly.
  • Apply Short TTLs on High-Risk Records: A shorter TTL limits how long a poisoned entry remains active in any resolver's cache before it is refreshed from the authoritative source. For records tied to authentication, payment infrastructure, or email delivery (MX records), a TTL of 300 seconds limits the poisoning exposure window. Very short TTLs increase query volume on authoritative servers, so apply them selectively to high-value records.
  • Keep DNS Software Patched: DNS server software has a well-documented history of high-severity vulnerabilities. Maintaining current patch levels, restricting administrative access, and auditing DNS server configurations regularly reduces the attack surface for server-level compromise. DNS infrastructure should receive the same patch urgency as public-facing web servers.
  • Educate Users to Report Warning Signs: Technical controls are the primary defense, but end users are sometimes the first to notice something is wrong. Training users to report unexpected certificate warnings, unfamiliar site appearances, or login prompts on sites that don't normally require authentication can surface poisoning events that automated monitoring missed. Users should understand that a correct domain name in the browser address bar does not confirm they are on the legitimate site.

Together, these controls significantly reduce the probability of successful DNS cache poisoning. DNSSEC handles the cryptographic verification gap. Encrypted protocols close the injection window. Monitoring catches changes that bypass the first two controls. The combination covers the attack surface systematically.

How WhoisFreaks Supports DNS Security

WhoisFreaks provides domain and DNS intelligence tools that support both proactive detection and post-incident analysis of DNS cache poisoning. The platform covers over 12 billion DNS records across 1,500+ top-level domains (WhoisFreaks DNS database, as of May 2026).

WhoisFreaks Tools for DNS Security
  • DNS Lookup and DNS History APIs: The DNS Lookup API retrieves current DNS records (A, AAAA, NS, MX, CNAME, TXT) for any domain in real time. Security teams can query it programmatically to verify that a domain's current IP address matches its known-good state. The DNS History API provides a complete timeline of past DNS configurations, which is critical during incident investigation: it shows exactly when a record changed, what it changed from, and what it changed to.
  • WHOIS API and Domain Monitoring: The WHOIS API retrieves ownership and registration data for any domain: registrar, name servers, registrant contact, creation and expiry dates. An unexpected registrar transfer or nameserver change is often the first detectable signal of a domain hijack before DNS-layer attacks take effect. The Domain Monitoring service watches target domains continuously and sends alerts when ownership or configuration changes, giving security teams early warning before users are affected.
  • IP Security Lookup API: When a poisoned cache redirects traffic to an unfamiliar IP, the IP Security Lookup API can classify that IP against known threat intelligence, including malicious infrastructure classifications, risk scores, and geolocation data. This accelerates triage: a redirected IP that matches known malicious hosting confirms an active poisoning incident rather than a routine DNS change.
  • DNS Database and Subdomains Database: For large-scale DNS analysis, the DNS Database provides bulk access to DNS configurations across millions of domains. Security teams can query it to identify patterns: domains sharing suspicious nameservers, unusual NS record concentrations, or subdomains pointing to known-malicious IPs. The Subdomains Database extends this to subdomain enumeration, which helps detect attacker-registered subdomains used as part of broader DNS poisoning or hijacking campaigns.

Conclusion

DNS cache poisoning exploits a structural weakness in how DNS resolvers handle trust. The attack is silent, effective, and difficult for end users to detect without technical controls in place. Preventing it requires DNSSEC, encrypted DNS protocols, source port randomization, continuous record monitoring, and patch management working together.

WhoisFreaks provides the DNS intelligence layer that makes proactive defense practical. The DNS Lookup, DNS History, and Domain Monitoring APIs let security teams verify record integrity continuously, detect unauthorized changes in near-real time, and investigate incidents with a complete historical record. Start monitoring your domains today at WhoisFreaks.

Frequently Asked Questions

Explore frequently asked questions to better understand our features, functionality, and usage.

What is the difference between DNS cache poisoning and DNS hijacking?

DNS cache poisoning injects false records into a resolver's cache without modifying the domain's authoritative DNS records. DNS hijacking modifies the authoritative records themselves, typically by compromising the registrar account or DNS hosting provider. Poisoning is temporary (limited to the TTL duration); hijacking persists until the legitimate domain owner corrects the authoritative records.

Is it dangerous to flush my DNS cache?

No. Flushing the DNS cache on your device or resolver clears stored records and forces fresh lookups from authoritative servers. If your cache was poisoned, flushing it removes the forged entries. It is a safe and often recommended first step when DNS resolution issues are suspected.

What are the symptoms of DNS cache poisoning?

The most common signs are unexpected redirects to unfamiliar sites, browser certificate warnings on sites you visit regularly, sites that look different from normal, and login prompts appearing on sites that don't usually require them. At the network level, DNS responses returning IPs outside the expected range for a domain are a reliable technical indicator.

Does DNSSEC fully prevent DNS cache poisoning?

Not by itself. DNSSEC only protects queries resolved by a validating resolver against a DNSSEC-signed domain. If the resolver doesn't validate, the signed domain gets no protection. If the domain isn't signed, the resolver has nothing to verify. In practice, this means DNSSEC coverage depends on both the domain owner and the resolver operator taking action independently. Many networks use non-validating resolvers, leaving DNSSEC-signed domains still exposed on that network path.

Is source port randomization enough to stop Kaminsky-class attacks today?

Port randomization raises the entropy an attacker must guess to land a forged response, but it doesn't eliminate the risk. Research has shown that network conditions like NAT devices can reduce effective port entropy by collapsing the randomized source port to a narrower range. The practical defense against Kaminsky-class attacks is port randomization combined with DNSSEC validation: randomization reduces the attack's probability of success while DNSSEC validation makes a successful guess useless because the forged response lacks a valid cryptographic signature.

How should a domain owner protect against DNS cache poisoning?

Domain owners should enable DNSSEC through their DNS provider, use a registrar with strong account security features (MFA, registry lock), and monitor DNS records continuously for unauthorized changes. Monitoring services that alert on NS record, A record, or MX record changes give domain owners early warning of poisoning or hijacking attempts before users are affected.