DNS poisoning, also called DNS cache poisoning or DNS spoofing, is an attack in which false DNS records are inserted into a resolver's cache so that queries for a real domain return an attacker's IP address instead of the real one. Victims are sent to fake websites without any visible warning, because the domain name in the browser stays correct. DNSSEC, source-port randomization and encrypted DNS are the main defenses.
Key takeaways
- DNS poisoning corrupts a resolver's cache, so every user of that resolver is sent to the attacker's server until the poisoned record expires.
- The attack exploits DNS over UDP: a forged reply that matches the query and transaction ID and arrives first is accepted and cached.
- DNSSEC stops poisoning by cryptographically signing DNS records, so a resolver can reject forged answers.
You type your bank's address, the address bar shows the right name, and the page looks familiar — but you are not on your bank's server. That is the quiet danger of DNS poisoning: the name is right, the address behind it is wrong, and nothing on screen tells you.
What is DNS poisoning?
DNS poisoning is an attack in which false information is entered into a DNS resolver's cache, so that queries for a real domain name return an attacker's IP address instead of the genuine one. It is also known as DNS cache poisoning or DNS spoofing.
DNS is the Internet's phone book. When you type a domain name, a resolver translates it into an IP address and your browser connects to that address. Resolvers cache answers for a period set by the record's time to live (TTL), so repeat queries are fast. If a false answer gets cached, the resolver keeps handing it out to every user until the TTL expires or the cache is flushed.
The attack is dangerous because it is invisible to the victim. The domain in the address bar is spelled correctly, there is no suspicious link to spot, and the poisoned entry affects everyone using the same resolver — a whole company, school or ISP customer base at once.
How does DNS poisoning work?
An attacker forges a DNS response that looks like it came from the domain's authoritative nameserver, and gets the resolver to accept and cache it before the genuine response arrives. The forged reply must match the outstanding query, including its transaction ID.
Classic DNS runs over UDP, which has no handshake and no built-in way to verify who sent a packet. As Cloudflare explains, an attacker can send a UDP message pretending to be a response from a legitimate server simply by forging the header data. If the resolver accepts it, the false record is cached.
The attack usually follows four steps:
- Force a query. The attacker gets the resolver to look up the target domain, for example by tricking a user into loading a page that references it.
- Flood forged replies. The attacker sends many fake responses, each guessing the 16-bit transaction ID — only 65,536 possible values — and claiming to be from the authoritative server.
- Win the race. If a forged reply arrives before the genuine one and matches the query, the resolver accepts it as legitimate.
- Serve the lie. The poisoned record is cached and handed to every user of that resolver until its TTL expires.
RFC 5452 sets out the matching rules a resolver should apply: the question section must match an outstanding query, the ID must match, the response must come from the address the query was sent to, and it must arrive on the same address and port the query left from. The first response matching all four conditions is accepted — which is why the race matters.
What is the difference between DNS poisoning, spoofing and hijacking?
These terms overlap and are often used interchangeably, but they describe different points in the same attack chain. Poisoning is the result, spoofing is the technique, and hijacking usually means taking control of DNS settings or accounts.
| Attack | What happens | Who is affected | How long it lasts |
|---|---|---|---|
| DNS cache poisoning | False records are stored in a resolver's cache | Everyone using that resolver | Until the TTL expires or the cache is flushed |
| DNS spoofing | Forged DNS responses are sent to a resolver or device | The targeted resolver or user | Until the forged data is discarded |
| DNS hijacking | Attacker changes DNS settings, registrar records or router config | Visitors to the hijacked domain | Until the settings are restored |
| Pharming | Users are redirected to fake sites, often via poisoned DNS or malware | Anyone who visits the targeted site | As long as the redirect is in place |
| On-path (MitM) DNS attack | Attacker intercepts DNS traffic on the network and alters answers | Users on that network segment | While the attacker holds the position |
DNS hijacking is the most direct variant: instead of racing a resolver, the attacker logs into a registrar account or compromises a router and changes where the domain points. That is why registrar accounts need strong passwords and two-factor authentication, and why router admin credentials should never stay at their defaults. Our guide to securing your Wi-Fi covers the router side.
What happened in the 2008 Kaminsky attack?
In 2008, security researcher Dan Kaminsky disclosed a flaw that made cache poisoning dramatically more practical, turning a theoretical race into a repeatable attack. The coordinated disclosure, tracked as CVE-2008-1447, prompted emergency patches across the industry.
Before Kaminsky's finding, an attacker who lost the race had to wait: the genuine answer was cached, and no new upstream query would happen until the record expired. Kaminsky's insight removed the wait. By querying random, non-existent subdomains — a1.example.com, then a2.example.com, and so on — he could force a fresh upstream query every time, opening a new race on demand.
Worse, the forged reply did not have to carry a fake address for the throwaway subdomain. It could carry fake delegation data, redirecting the resolver's queries for the whole domain to the attacker's nameserver. One successful guess could poison an entire zone.
The fix was source-port randomization: resolvers stopped sending every query from the same UDP port and started picking a random source port for each one. Combined with the 16-bit transaction ID, that expanded the guessing space from 65,536 possibilities to roughly 4 billion, making the race far harder to win. The change was standardized in RFC 5452, published in January 2009.
What can attackers do with a poisoned DNS cache?
A poisoned cache is a redirect that users cannot see coming, so attackers use it as the first step in larger crimes. The most common goals are credential theft, malware delivery and traffic interception.
- Credential theft. Victims land on a pixel-perfect copy of a bank, email or cloud login page and hand over their username and password.
- Malware delivery. The fake site serves a malicious download, or a poisoned record for a software update server delivers a trojanized update.
- Traffic interception. Email and other traffic routed through the attacker's server can be read or altered, including the verification messages used to issue TLS certificates.
- Censorship. Several governments have intentionally poisoned DNS caches inside their countries to block access to specific websites, as Cloudflare documents in its cache poisoning guide.
- Ad fraud and scams. Popular sites are redirected to pages full of ads, fake support numbers or tech-support scams.
RFC 5452 warns that any party that temporarily controls DNS can reroute most kinds of Internet transactions — including the verification steps for acquiring a TLS certificate for a domain. That is why a poisoning attack can undermine even encrypted connections if the attacker can also obtain a certificate.
How do you know if DNS has been poisoned?
Poisoning is hard to spot because the domain name looks correct, but there are signals worth checking when a familiar site behaves strangely. The strongest check is comparing DNS answers from different resolvers.
- Certificate warnings. Your browser warns that a site's certificate is invalid or belongs to a different name. Never click through this warning on a site where you log in.
- Different answers. The same domain resolves to a different IP address on your network than it does through a trusted public resolver such as 1.1.1.1 or 8.8.8.8.
- Logins fail or look different. A familiar login page looks subtly altered, asks for unusual details, or your saved password does not autofill.
- Unexpected redirects. You are sent to unfamiliar pages, support numbers or download prompts from a site you know.
- Traffic spikes or odd logs. On a network you manage, resolvers show unusual query volumes or responses from unexpected source addresses.
If you suspect poisoning, stop entering credentials, switch to a trusted resolver, and check the domain with our free DNS lookup tool to see which records are actually published. For a website you own, a poisoned resolver is a user-side problem — but you can still check your own records and confirm your DNSSEC signatures are valid.
How does DNSSEC prevent DNS poisoning?
DNSSEC, the Domain Name System Security Extensions, stops cache poisoning by adding cryptographic signatures to DNS records, so a validating resolver can detect a forged answer and reject it. It was designed precisely because plain DNS has no way to verify that data is authentic.
The system works through a chain of trust. Each zone signs its records with a zone-signing key, publishing the signatures as RRSIG records and the public key as a DNSKEY record. A key-signing key signs the public zone-signing key, and the parent zone publishes a DS record containing a hash of that key — linking trust from the root zone down through each level, as Cloudflare's DNSSEC guide explains.
When a resolver receives an answer, it checks the signature against the public key. A forged record fails validation and is discarded instead of cached. That closes the race that cache poisoning depends on: guessing the transaction ID is no longer enough, because the attacker cannot forge a valid signature without the zone's private key.
DNSSEC has limits. It signs answers but does not encrypt them, so it does not hide which domains you look up. It also cannot help if the authoritative server itself is compromised, or if the zone owner never signed the zone at all. Adoption has grown steadily but is still far from universal, which is why the other defenses below still matter.
How can you protect your network and website from DNS poisoning?
Protection works on two sides: as a website owner, sign your zone with DNSSEC; as a user or network operator, use resolvers that validate DNSSEC and encrypt your queries. Both sides matter, because poisoning can strike either one.
For website owners:
- Enable DNSSEC. Sign your zone and publish the DS record with your registrar. Many DNS providers, including Cloudflare, can do this with a single switch.
- Lock your registrar account. Use a strong unique password, hardware-key two-factor authentication and a registrar lock so DNS records cannot be changed by an attacker.
- Monitor your records. Watch for unexpected changes to A, MX and nameserver records, and alert on them.
For users and network operators:
- Use a validating resolver. Choose a resolver that validates DNSSEC and supports encrypted DNS (DoT or DoH), such as 1.1.1.1 or 9.9.9.9.
- Patch DNS software and routers. Source-port randomization and 0x20 randomization are standard in modern resolvers, but only if the software is up to date.
- Close open resolvers. A recursive resolver that answers anyone on the Internet can be abused for poisoning and for amplification attacks. Restrict recursion to your own users.
- Use HTTPS and HSTS. A valid certificate check is a second line of defense: a fake site cannot present a valid certificate for your real domain.
- Enable DNS over HTTPS in the browser. It encrypts queries between your browser and the resolver, blocking on-path tampering on public Wi-Fi.
The bottom line
DNS poisoning works because the original DNS protocol trusted every answer it received. A forged reply that arrives first and matches the query is cached and served to everyone, with no visible warning to the user.
The fix is layered: DNSSEC to authenticate answers, modern resolvers with randomized ports, encrypted DNS to block on-path tampering, and locked-down registrar and router accounts. Start by checking your own domain with the free DNS lookup tool and confirming your zone is signed.
Frequently asked questions
What is DNS poisoning in simple terms?
DNS poisoning is when an attacker tricks a DNS server into storing a wrong address for a website. After that, everyone who asks that server for the site is sent to the attacker's fake version instead, while the address bar still shows the real domain name.
Is DNS poisoning the same as DNS spoofing?
The two terms are used interchangeably. DNS spoofing is the broader act of sending forged DNS data, while DNS cache poisoning is the specific result: the forged data ends up stored in a resolver's cache and is served to users until it expires or is removed.
Can DNS poisoning affect my home Wi-Fi?
Yes, if your router or the DNS resolver it uses is compromised. Attackers have poisoned home routers by exploiting weak admin passwords or unpatched firmware, then redirected every device on the network. Keep router firmware updated and change the default admin password.
Does HTTPS protect me from DNS poisoning?
Partly. HTTPS encrypts your traffic, and a fake site cannot present a valid certificate for the real domain, so your browser should warn you. But attackers can still use poisoning to send you to a look-alike domain, or to intercept traffic before the TLS connection starts.
How long does a poisoned DNS record last?
Until the record's time to live, or TTL, expires, or until an administrator flushes the cache manually. TTLs are commonly set between a few minutes and 24 hours, so a poisoned entry can keep redirecting users for hours.
What is the Kaminsky attack?
In 2008, researcher Dan Kaminsky showed that DNS cache poisoning was far more practical than previously believed. By querying random subdomains that were never cached, he could force a resolver to make fresh upstream queries again and again, giving him unlimited chances to slip in a forged reply. The disclosure, tracked as CVE-2008-1447, led to source-port randomization.
How do I check if my DNS is poisoned?
Compare the IP address your DNS returns for a well-known site with the address returned by a trusted resolver such as 1.1.1.1 or 8.8.8.8. Unexpected certificate warnings, logins failing on familiar sites, or being sent to unfamiliar pages are also warning signs.
Does DNSSEC fully prevent DNS poisoning?
DNSSEC prevents forged answers from being accepted by resolvers that validate signatures, which covers the classic cache-poisoning attack. It does not encrypt DNS traffic, hide which sites you visit, or protect you if the authoritative server itself is compromised.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against Cloudflare's DNS learning guides, RFC 5452 on forged DNS answers and RFC 4033 on DNSSEC.
How we write and fact-check →