WakeWill blog

How DNS Works, and How Attackers Abuse It

How a DNS lookup works step by step, and the DNS attacks every IT team should know: hijacking, spoofing, tunnelling and subdomain takeover.

Cover image for: How DNS Works, and How Attackers Abuse It

Every time you open a website, send an email or a program checks for updates, the Domain Name System (DNS) translates a name into an IP address. Because almost everything depends on it, DNS is also a favourite tool for attackers.

A DNS lookup, step by step

When your laptop wants to reach wakewill.blog:

  1. It checks its own cache.
  2. If the answer is not there, it asks a recursive resolver, usually run by your ISP, your company or a public service.
  3. The resolver asks a root server where to find .blog domains.
  4. The root points to the top-level domain (TLD) servers for .blog.
  5. The TLD servers point to the domain’s authoritative name servers.
  6. The authoritative server answers with the IP address, and the resolver caches it for the time set by its TTL (time to live).

Common record types: A (IPv4 address), AAAA (IPv6), CNAME (alias), MX (mail server), TXT (text, used for SPF, DKIM and DMARC email security and domain verification) and NS (name servers).

How attackers abuse DNS

DNS hijacking. An attacker who gets into a domain’s registrar account or DNS provider can point the domain to their own server and intercept traffic or email. Protect registrar accounts with strong MFA and enable registry lock for important domains.

Spoofing and cache poisoning. Fake answers are injected into a resolver’s cache so users are sent to the wrong IP. DNSSEC prevents this by signing DNS records cryptographically.

DNS tunnelling. Malware hides data inside DNS queries, for example long, random-looking subdomains, to sneak data out or receive commands, because DNS is allowed through almost every firewall. Watch for unusually long names, high query volumes to one domain and lots of TXT queries.

Subdomain takeover. A CNAME still points to a cloud service (for example an old storage bucket or app) that was deleted. An attacker claims that resource and now controls content on your subdomain. Clean up DNS records when you remove services.

Typosquatting and lookalike domains. Domains such as wakewiII.blog (with capital I’s instead of l’s) are registered for phishing. Monitor new registrations that look like your brand.

DNS-based DDoS. Open resolvers can be abused to amplify attacks. Never run an open recursive resolver on the internet.

Defensive checklist

  • MFA and registry lock on your domain registrar.
  • DNSSEC on important domains.
  • SPF, DKIM and DMARC (set to p=reject when ready) against email spoofing.
  • Company devices use resolvers you control or trust, with DNS logging.
  • Alerts for DNS tunnelling patterns and newly registered lookalike domains.
  • Regular review of DNS records to remove dangling CNAMEs.

Key takeaways

  • DNS resolves names in a chain: cache, resolver, root, TLD, authoritative server.
  • Attackers use DNS to redirect, spy, exfiltrate data and phish.
  • Lock down registrar accounts, sign with DNSSEC, log DNS and clean old records.

This guide was prepared with AI assistance.

Spotted an error or have more information? Contact the editor.