Opscraft
DNS record types · Lesson 6 of 7 · 4 min read

Response codes, DNSSEC and DNS security

Reading dig status

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4242
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
Status Meaning Typical cause
NOERROR with answers Success —
NOERROR, ANSWER: 0 (NODATA) The name exists, but has no record of that type Asked for AAAA on an IPv4-only name; MX on a name with only A
NXDOMAIN The name doesn't exist Typo, record not created, wrong zone, negative cache
SERVFAIL The resolver couldn't get a valid answer Broken delegation (lame NS), unreachable authoritative servers, DNSSEC validation failure
REFUSED Server won't answer Querying a non-recursive server for another zone, ACLs

Flags: qr response, aa authoritative answer, rd recursion desired, ra recursion available, ad authenticated data (DNSSEC validated), tc truncated (retry over TCP).

Enlarge diagramNOERROR + answerNOERROR, empty (NODATA)NXDOMAINSERVFAILREFUSEDthe name exists and has this typethe name exists, but not this typethe name does not exist at allthe server could not answer: broken delegation, DNSSEC failurethe server will not answer you (policy)
Figure 1. Reading the status in dig. NXDOMAIN and "NOERROR with no answer" are different, and SERVFAIL points at the servers rather than the name.
Swipe sideways to see all of it, or tap to open it full screen.

DNSSEC

DNSSEC signs DNS records so validating resolvers can detect forged or tampered answers (cache poisoning, on-path manipulation):

  • Each zone has keys (DNSKEY); records get signatures (RRSIG); the parent publishes a DS record that vouches for the child's key — a chain of trust from the root.
  • It protects integrity and authenticity, not confidentiality (use DoT/DoH for privacy).
  • Route 53 supports DNSSEC signing for public hosted zones (with a KMS key) and DNSSEC validation in the Route 53 Resolver.
  • Misconfiguration symptom: SERVFAIL from validating resolvers (Google 8.8.8.8, Cloudflare 1.1.1.1) while non-validating resolvers still work — e.g. after a key rollover went wrong or the DS record at the registrar no longer matches. Test with dig +dnssec, delv, or DNSViz.
Enlarge diagramroot (.)trust anchor builtinto resolvers.comDS: vouches forexample.com's keyexample.comDNSKEY signs itsrecordsA record + RRSIGthe signature theresolver checksDSDSRRSIGA broken link (e.g. a DS left behind after changing providers) makes validating resolvers return SERVFAIL.
Figure 2. DNSSEC is a chain of signatures from the root down. Each parent publishes a DS record vouching for its child's key.
Swipe sideways to see all of it, or tap to open it full screen.

Subdomain takeover

A dangling CNAME points at a resource you no longer own: promo.example.com CNAME acme-promo.s3-website.ap-south-1.amazonaws.com after the bucket was deleted, or a CNAME to a deleted Heroku/Azure/GitHub Pages app. An attacker creates a resource with that name and now serves content on your subdomain — phishing, cookie theft, bypassing CSP.

Prevention: delete DNS records before (or together with) the resources they point to, manage both in the same IaC so they're destroyed together, and regularly audit CNAMEs/aliases for targets that no longer exist (tools and AWS Security Hub/third-party scanners can help).

Enlarge diagrampromo.example.comCNAME (forgotten)old-promo bucketdeleted by you……recreated byattackerserves their contentDelete DNS records with (or before) the resources they point to; manage both in the same Terraform.
Figure 3. Subdomain takeover: a CNAME left pointing at a resource you deleted lets someone else claim that resource and serve content on your domain.
Swipe sideways to see all of it, or tap to open it full screen.