Skip to content
Pwnversity
NET-DNSATTACKSadvanced · 5 min · upd. 2026-10

DNS Attacks

T1557T1071.004

DNS is the phone book of the Internet and, since all traffic starts by resolving a name, manipulating it has huge impact: you can redirect victims to fake servers, intercept traffic, exfiltrate data over a covert channel or enumerate an organization’s entire infrastructure. This page covers attacks against DNS, from recon to active manipulation (the protocol fundamentals are in DNS Fundamentals).

DNS is trusting by design: a client accepts the first valid reply it receives, and caches speed things up but widen the surface. The attacker strikes at three points: recon (pulling records that reveal infrastructure), the path (replying before or instead of the legitimate server) and the channel (using DNS as a covert tunnel because it is almost always allowed outbound). Defence combines DNSSEC, restricting transfers and monitoring anomalous queries.

flowchart LR
    V[Victim] -->|"bank.com?"| R[Resolver]
    R -->|"query"| NS[Authoritative server]
    A["Attacker (MITM or cache poisoning)"] -. "faster<br/>forged reply" .-> R
    R -->|"attacker's IP"| V
    V -->|"connects"| F["Fake server (phishing)"]
  • Zone transfer (AXFR): if misconfigured, it hands over the whole zone.
  • DNS spoofing / cache poisoning: reply with fake IPs to redirect victims.
  • DNS exfiltration / tunneling: smuggle data encoded in DNS queries (covert channel).
  • Subdomain takeover: claim a subdomain with a dangling CNAME (see Subdomain Takeover).
  • DNS rebinding: bypass the Same-Origin Policy toward internal services.
  • Insecure dynamic DNS: update records without authentication.
Ventana de terminal
# find the NS and request the full zone
dig NS target.com
dig axfr @ns1.target.com target.com

If it works, you get every record (subdomains, internal IPs, mail servers). An open AXFR is a classic finding: it hands over the complete map of the domain.

This means replying to DNS queries faster than the legitimate server (in a MITM) or poisoning a resolver’s cache:

Ventana de terminal
# in a MITM (see net-mitm): answer the victim's query with your IP
bettercap -iface eth0
# inside the console:
# set dns.spoof.domains bank.com
# dns.spoof on

It was also classically exploited through resolver randomness flaws: the Kaminsky attack (2008) demonstrated practical cache poisoning and drove the adoption of source port randomization and, longer term, DNSSEC.

DNS is usually allowed outbound even on restricted networks, so it serves as a covert channel. Data is encoded in the subdomains of a query toward the attacker-controlled authoritative server, for example data.encoded.in.base32.attacker.com. Tools such as iodine, dnscat2 or dns2tcp build a full tunnel (C2, exfiltration) over DNS. It is useful for exfiltrating data or keeping C2 when other ports are blocked (see Firewall and IDS Evasion).

An attacker’s domain resolves first to its own IP (to load the JavaScript in the victim’s browser) and, shortly after, to an internal IP of the victim. The JavaScript, still belonging to the “same” domain, thus bypasses the Same-Origin Policy and attacks internal services (routers, local APIs) from the browser.

  • Restrict zone transfers to authorized secondaries (ACL on the DNS).
  • DNSSEC (record signing) against spoofing/poisoning; keep source port randomization.
  • Monitor anomalous queries: high volume to one domain, long or random subdomains (tunneling), unusual TXT records.
  • Filter and inspect outbound DNS (DNS firewall, block external resolvers, Protective DNS).
  • Against rebinding: validate Host/Origin on internal services and block DNS replies pointing to private IPs from external resolvers.
  • Clean up stale records to prevent subdomain takeover (see Subdomain Takeover).
  • Zone transfer (AXFR) on the domain’s NS
  • DNS spoofing in a MITM (redirect to controlled host)
  • DNS tunneling feasibility (is outbound DNS allowed?)
  • Subdomain takeover (dangling CNAMEs — Subdomain Takeover)
  • DNS rebinding toward internal services
  • Check DNSSEC and resolver randomness
  • Stale records that enable takeover
  • Blue: monitoring of anomalous queries