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).
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.
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).