Opscraft
How DNS works behind the scenes · Lesson 8 of 9 · 3 min read

DNS security and abuse

Cache poisoning

An attacker tricks a resolver into caching a forged answer (e.g. pointing your bank's name to their server). Classic attacks (the 2008 Kaminsky attack) raced forged responses with guessed query IDs. Defences:

  • Random query IDs and source ports (makes guessing infeasible), 0x20 case randomisation.
  • DNSSEC — cryptographic signatures that validating resolvers check; a forged answer fails validation.
  • Encrypted transport (DoT/DoH) between client and resolver.
Enlarge diagramResolverReal authoritativeAttackerwithout protection the first matching reply wins and is cached for everyonewith DNSSEC the forged reply has no valid signature and is thrown awaybank.example.com?forged: bank.example.com = attacker IPgenuine answer
Figure 1. Cache poisoning: an attacker races a forged answer to the resolver. Random IDs and ports make guessing hard; DNSSEC lets the resolver reject forgeries outright.
Swipe sideways to see all of it, or tap to open it full screen.

Amplification and open resolvers

DNS amplification sends small queries with the victim's spoofed source IP to open recursive resolvers, which send much larger responses to the victim — a DDoS multiplier. Never run an open resolver on the internet; restrict recursion to your own networks, and use response rate limiting on authoritative servers.

Exfiltration and tunnelling

Because DNS is allowed almost everywhere, malware and attackers tunnel data in DNS queries (<base64-chunk>.attacker.example). Mitigate with Route 53 Resolver DNS Firewall (block known-bad domains, or allow-list only needed domains for locked-down workloads), Resolver query logging and anomaly detection (GuardDuty analyses VPC DNS logs).

Hijacking

Attackers who take over your registrar account or delegation can redirect your entire domain. Protect with MFA, registry/registrar locks, monitoring NS changes, and DNSSEC.

Why companies run internal DNS

Private names for internal services, split-horizon views, central control and logging of lookups, forwarding to on-prem, and security filtering — on AWS via private hosted zones, Resolver endpoints, DNS Firewall and query logging.