Interview Prep/Networking/DNS & Service Discovery

How do you prevent subdomain takeover from dangling DNS records?

AdvancedScenarioDNS & Service Discovery
Answer

Situation read → A CNAME pointing to a deleted cloud resource can be claimed by an attacker.

What I'd do →

  1. Inventory all DNS records through exports from Route 53: aws route53 list-resource-record-sets --hosted-zone-id Z123
  2. Scan CNAMEs for NXDOMAIN or provider takeover fingerprints with tools like subjack or nuclei
  3. Make decommission steps delete DNS first
  4. Put DNS in Terraform so resource and record share a lifecycle
  5. Alert on new CNAMEs to third-party domains

Why → The record outlives the resource, and anyone who can claim the target name gets your domain's trust.

Interview tip → Say DNS belongs in the same pull request as the infrastructure it points to.

All Networking questions Roadmap: Networking for DevOps

More on DNS & Service Discovery