Back to Learning CenterSecurity

How DNS poisoning works and how teams can defend against it

By Samuel ChenardAugust 11, 20267 min read

In brief

DNS poisoning works when a resolver caches a forged DNS answer. Learn how cache poisoning redirects users and how to validate and defend DNS.

How DNS poisoning works and how teams can defend against it

DNS poisoning, also called DNS cache poisoning, works when an attacker causes a recursive DNS resolver to cache a forged answer for a domain. Users of that resolver can then be sent to an attacker-controlled IP address until the cached data expires or is removed. Teams defend against it with DNSSEC validation, hardened resolvers, encrypted resolver connections, and checks that compare resolver answers with authoritative DNS.

At a glance

Quick takeaways

  • DNS cache poisoning puts forged DNS data in a recursive resolver's cache.
  • A forged response must arrive before the legitimate response and match values the resolver expects.
  • Source-port randomization and transaction-ID randomness make forged responses harder to guess, but they do not authenticate DNS data.
  • DNSSEC lets validating resolvers reject unsigned or incorrectly signed answers for signed zones.
  • DNS over HTTPS and DNS over TLS protect the client-to-resolver path, not a compromised resolver or authoritative DNS account.
  • A public lookup can reveal a current DNS difference, but it cannot prove the production resolver path or future DNS state.

How DNS poisoning works

A recursive resolver receives a DNS question, obtains an answer from authoritative DNS infrastructure, and caches that answer for its time to live, or TTL. The cache lets the resolver answer later requests without querying the authoritative server again.

Cache poisoning occurs when the resolver accepts fabricated DNS data as though it came from an authoritative server. RFC 5452's guidance for resisting forged DNS answers explains that a forged response must match the pending query's question, transaction ID, destination address, and source port. An attacker tries to send enough plausible responses before the legitimate answer arrives.

If the forged answer is cached, the impact can extend beyond one device. Every client using that resolver can receive the false answer until the resolver discards it. The false record might point a web name at a phishing host, redirect an API endpoint, or return a fraudulent MX record for mail routing.

DNS poisoning is different from a registrar or DNS-provider account takeover. In an account takeover, the attacker changes authoritative records or delegation. In cache poisoning, the authoritative record can remain correct while a resolver distributes false cached data. Both incidents can produce a mismatch between what users receive and what the domain owner intended.

DNS security guidance from NIST treats DNSSEC, encrypted DNS, protective DNS services, and logging as separate defensive layers. That separation matters because each control addresses a different part of the DNS path.

Decision flow for comparing a resolver answer with authoritative DNS and selecting the next DNS-poisoning response
Source: Palisade.

When the answer changes

The right response depends on where the suspicious answer appears.

  • If one workstation receives an unexpected answer while authoritative DNS and independent resolvers agree, inspect that workstation's configured resolver, local hosts file, VPN, router, and endpoint security evidence. This may be a local configuration problem or an on-path issue rather than resolver cache poisoning.
  • If one recursive resolver returns an answer that differs from authoritative DNS, preserve the resolver response, TTL, query time, resolver address, and authoritative answer. Treat the resolver as potentially poisoned or misconfigured until its operator investigates.
  • If authoritative DNS returns the unexpected answer, cache flushing will not fix the incident. Review DNS-provider access, registrar access, delegation records, DNS change history, and recovery procedures.
  • If the zone is DNSSEC-signed and a validating resolver reports validation failure, do not bypass the failure by disabling validation. A signature or delegation problem can interrupt resolution, but accepting unvalidated data removes the integrity protection DNSSEC provides. RFC 4033 defines the DNSSEC security model.
A resolver answer can legitimately differ by geography, CDN routing, load balancing, or a planned DNS change. The usable decision rule is to compare the exact record type and queried name against the authoritative answer, then confirm whether the difference is expected in the relevant network and time window.

A worked DNS comparison

Use a domain you administer or have permission to test. First, query the recursive resolver that produced the suspicious result. Then query an authoritative nameserver for the same record.

Terminalbash
# Illustrative only. Replace the names and resolver with authorized values.

# Query the resolver used by the affected client. dig www.yourdomain.com A @resolver.example.net

# Query an authoritative nameserver without recursion. dig www.yourdomain.com A @ns1.yourdomain.com +norecurse

# Check DNSSEC-related response information. dig yourdomain.com SOA @resolver.example.net +dnssec

Do not publish internal resolver names, customer domains, tokens, or full incident logs when sharing results.

Compare these evidence points:

  • The fully qualified name and record type, such as www.yourdomain.com A.
  • The returned values and TTLs.
  • The responding server and query timestamp.
  • The ad flag, which indicates that a security-aware resolver authenticated data when DNSSEC validation succeeds. RFC 4035 defines the authenticated-data flag and validator behavior.
  • The authoritative response and any approved DNS change record.
A mismatch alone does not identify the cause. It does establish where to continue: the affected resolver, the authoritative zone, or the client path.

What to do next

Start with the evidence you have.

  • With a suspicious browser or application result, capture the domain, record type, time, resolver address, returned answer, and any certificate warning. Query the same name through the affected resolver and an authoritative nameserver.
  • With control of the authoritative zone, evaluate DNSSEC signing and maintain the DS, DNSKEY, and signing process carefully. DNSSEC protects signed DNS data only when the chain of trust is correctly deployed and validation is enabled.
For email domains, DNS integrity also affects MX, SPF, DKIM, and DMARC lookups. The email security learning center covers the controls that depend on those records. The DMARC checker can inspect DMARC records. After resolving an incident, retain authoritative and resolver responses with timestamps so the team can distinguish cached data from an authorized DNS change.

Check the DNS answer from public resolvers

Use Palisade's DNS lookup tool to inspect the current public DNS response for the affected name and record type. Compare it with an authoritative query and the response seen by the affected client before changing DNS.

Start with Palisade

Palisade can analyze DMARC aggregate-report data, identify sending sources and authentication or alignment issues, and propose a next DMARC policy step for human review. It does not prove that a DNS poisoning incident occurred, control a resolver's cache, or guarantee future DNS integrity.

Evidence

Sources and further reading

Questions readers ask

Frequently asked questions

Make email authentication easier to manage

Start in Palisade.

Get started

Share this article

Samuel Chenard

Written by

Samuel Chenard

CEO & Co-Founder, Palisade

Samuel Chenard is the CEO and co-founder of Palisade, AI-first DMARC software for IT teams and MSPs, from one domain to thousands.

More from Samuel

Related articles and tools