dns security · 16 min read
Infrastructure Hygiene: A Technical Guide to Auditing Your DNS Records
Learn how to run a repeatable DNS record audit that surfaces stale records, dangling CNAMEs, and misconfiguration risks before attackers or outages find them first.
A rigorous dns record audit for security systematically identifies dangling pointers, resolves email authentication loopholes, and eliminates unmaintained hostnames before adversaries exploit them. DNS records govern identity. Performing a DNS record audit for security isolates orphaned cloud infrastructure, prevents subdomain takeover attacks, and maintains zone integrity across distributed engineering teams.
DNS records are simple text pointers, but they establish routing and trust boundaries across modern cloud systems. When an engineer deprovisions an Amazon S3 bucket, a Heroku application, or a Kubernetes ingress controller without deleting the corresponding authoritative DNS record, that record remains active. The pointer stays live. The hostname continues resolving to a released external resource or IP address. To maintain infrastructure hygiene, Site Reliability Engineers and DevOps teams need systematic visibility into every resource record across all corporate domains.
Why a DNS record audit belongs in your security program
Authoritative DNS is an exposed attack surface. Dangling records, forgotten development subdomains, and overly permissive zone configurations give attackers direct entry points into corporate infrastructure. If an external record points to an unallocated cloud asset, any third party can register that underlying asset and inherit TLS certificates, session cookies, and user credentials directed to your domain.
Organizations separate operational hygiene audits from defensive security audits:
- Hygiene audits verify operational accuracy. They detect stale entries, eliminate redundant records, confirm team ownership, and validate consistent Time-to-Live (TTL) values across zones.
- Security audits evaluate exploit exposure. They identify subdomain takeover vectors, check public zone data leaks, examine cryptographic posture through DNSSEC, and validate cryptographic email authentication headers.
Audit your zones regularly. Engineering teams run full audits quarterly. Audits are mandatory during corporate acquisitions, post-cloud migrations, and major organizational handoffs, when teams frequently discover dozens of forgotten subdomains created by departed contractors or former product squads. Establishing a scheduled review cycle creates measurable operational advantages: fewer takeover vulnerabilities, faster resolution during active service incidents, and cleaner drift tracking in your infrastructure-as-code (IaC) repositories.
Build the inventory: what a complete zone snapshot must contain
Map every domain first. You cannot audit unmapped infrastructure. A comprehensive audit requires building an exhaustive catalog of every domain owned by the enterprise, including production zones managed by central platform teams, legacy domains parked at external registrars, and promotional domains launched independently by regional marketing teams.
Per the resource record format established in IETF RFC 1035, standard zone entries define discrete types, TTLs, and resource data classes. To transform standard zone data into an actionable security audit trail, augment raw resource records with internal operational metadata:
- Full canonical record name, including deep subdomains.
- Record type, covering A, AAAA, CNAME, ALIAS, TXT, MX, NS, SRV, and CAA.
- TTL values, flagging configurations that cache responses for excessively long durations.
- Resolved routing target, such as external hostnames, IPv4 addresses, or IPv6 blocks.
- Designated engineering team or system owner.
- Deployment environment, differentiating production, staging, dev, or sandbox workloads.
- Last-modified timestamp and original creation source, identifying whether the record was set via IaC, an automated script, or a manual console session.
Plain zone dumps lack context. A zone dump lists what exists, but it fails to explain why it exists or who is accountable for it. Operational metadata eliminates ambiguity. Without this operational context, an engineer who discovers an unresolvable staging endpoint cannot distinguish between an obsolete test record and an active deployment waiting for traffic.
To implement this inventory practically, pull zone records programmatically through authoritative APIs and commit the resulting snapshots to version control. DNSCove does not offer AXFR zone transfer or secondary-DNS operation in v1. Teams rely on secure API endpoints and console operations to extract complete record states. Version control diffs track drift. Storing your snapshots in Git makes pull request diffs a reliable audit trail across teams. If you are consolidating disparate records into declarative pipelines, follow our guide on DNS record bulk import best practices to structure raw zone files without syntax errors, and review our tutorial on managing DNS with Terraform to automate configuration tracking.
Identifying stale DNS records without breaking production
Identifying stale dns records requires a strict definition of operational staleness. A record is stale if it exhibits any of the following criteria:
- It handles zero legitimate query traffic over an extended operational window.
- Its designated engineering owner or team no longer exists within the organization.
- Its target IP address, container cluster, or SaaS tenant has been deprovisioned.
- It has been functionally replaced by a newer endpoint, leaving the legacy path unmaintained.
Cloud infrastructure changes rapidly. Automated cloud infrastructure is the most common generator of obsolete entries. Fast-moving teams regularly spawn ephemeral environments for continuous integration previews, run temporary proofs-of-concept on third-party platforms, or replace cloud load balancers during architecture modernizations. When the underlying virtual hosts vanish, the public DNS mapping often stays behind. Deleting unverified records carries risk. External B2B partners, legacy desktop applications, or mobile client builds might still hardcode an old hostname that platform teams assume is dead, meaning an abrupt removal causes immediate user-facing outages.
Use a phased retirement protocol. To safely decommission records while identifying stale DNS records, use a four-phase retirement protocol:
- Inspect DNS query metrics from your recursive resolvers and check edge load balancer access logs to confirm zero inbound HTTP or TCP sessions arrive across a full 30-day operating period.
- Mark the record metadata with a pending-deletion tag in your tracking repository and notify technical stakeholders across the organization.
- Lower the record's TTL to 300 seconds (5 minutes). Short TTLs accelerate recovery. If an unexpected service relies on the record after deletion, a short TTL ensures that restoring the record propagates to caching resolvers almost instantaneously. Read our analysis on the impact of DNS record TTL on caching to choose appropriate staging intervals.
- Monitor resolver logs for an additional full business reporting cycle. If no traffic hits the endpoint, delete the record from the authoritative zone. Keep the historical Git commit so the change can be reverted instantly if an edge case emerges.
DNS misconfiguration risks that audits should catch
Audits must target specific dns misconfiguration risks that create operational instability or leave infrastructure vulnerable to remote abuse. Errors accumulate over time. Both automated CI/CD pipelines and manual administrative updates contribute to these common zone flaws.
Dangling hostnames and released cloud targets
Dangling records invite takeover attacks. Dangling CNAMEs and A records are critical vulnerabilities. If a record points to a decommissioned AWS Elastic Load Balancer, an Azure App Service slot, an orphaned GitHub Pages site, or a released static IP address, an external adversary can claim that asset on the host platform. Once claimed, the attacker serves malicious content from your legitimate subdomain, bypasses Same-Origin Policy protections, reads authentication cookies, and mounts targeted phishing campaigns.
Wildcard records absorbing unauthorized traffic
Wildcards mask broken routing. Overly broad wildcard records (such as *.example.com) quietly mask broken configurations. If an engineer makes a typo while referencing an internal host, the wildcard rule catches the query and directs the user to a generic gateway. Wildcards also expose internal infrastructure names, returning affirmative responses for arbitrary subdomain requests and complicating boundary access control models.
Forgotten subzone delegations
Subzone delegations can dangle. Parent zones frequently delegate operational authority for subdomains to auxiliary systems via NS records. If a development team creates dev.example.com using custom nameservers on a cloud provider, then dissolves that provider account without removing the parent NS records, the delegation dangles. Attackers can recreate the targeted zone on that cloud provider and gain absolute authoritative control over that entire organizational subzone.
Missing or permissive email authentication
Email spoofing thrives on missing or misconfigured TXT resource records. Every public zone must declare strict policies for Sender Policy Framework (SPF), DomainKeys Identified Mail (DKIM), and Domain-based Message Authentication, Reporting, and Conformance (DMARC). As detailed in the standard IETF RFC 7208 specification for SPF, an email receiver verifies authorizing boundaries by evaluating published SPF mechanisms. Missing records, permissive +all fallback qualifiers, syntax typos, or configurations exceeding the strict 10-lookup evaluation limit allow spammers to spoof outbound communications using your apex domain.
Absent certificate authority authorization
Restrict certificate issuance strictly. Without explicit CAA records, any globally trusted Certificate Authority (CA) can issue an SSL/TLS certificate for your domain name. Audits must verify that CAA records exist and explicitly restrict issuance to chosen CAs (such as Let's Encrypt or DigiCert). Including an iodef tag ensures your platform security operations center receives automated alerts whenever an unauthorized party requests a certificate for your domain.
Fragile apex configurations
CNAME at apex violates standards. RFC 1035 prohibits configuring standard CNAME records at the zone apex because apex nodes require SOA and NS records, which cannot coexist alongside a CNAME. Teams that point naked domains to dynamic cloud hostnames often resort to hardcoded A records, which fail when downstream cloud IP pools rotate. DNSCove supports apex ALIAS records (CNAME-at-apex flattening, like Route53 Alias) with serve-stale protection. Flattening resolves the target canonical name down to raw A/AAAA addresses at the authoritative layer, preventing broken apex records and preserving resolution resilience during upstream disruptions. For architectural recommendations, review our guide to managing apex ALIAS records and flattening.
Security-specific checks: takeover, exposure, and DNSSEC posture
Routine hygiene clears operational clutter, but security-focused audits demand aggressive verification of external targets, data privacy, and cryptographic trust chains. Verify every pointer thoroughly.
Systematic takeover triage
Follow every CNAME chain completely. Do not stop at checking the immediate pointer of a DNS record. Script recursive lookups that follow every CNAME chain to its absolute termination point, querying the hosting provider's public API or verifying HTTP response status codes for each resolved target:
- If a CNAME targets an S3 bucket (e.g.,
target.s3.amazonaws.com), verify that the underlying bucket exists in your AWS account and has not been deleted. - If an endpoint points to a SaaS content provider, verify that the tenant account remains fully registered and active.
- If a record resolves to an Elastic IP or virtual machine address, confirm the IP address is actively associated with a running instance within your cloud VPC inventory.
Internal network data leakage
Keep private topologies hidden. Public authoritative zones should not expose private infrastructure topology. Inspect all public records for private allocations, internal hostnames, and exposed credentials:
- RFC 1918 private IPv4 allocations (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) and carrier-grade NAT blocks. - Hostnames identifying internal corporate environments, such as
corp-vpn.int,k8s-control-plane.internal, or database instances. - TXT records leaking private tokens, cleartext staging passwords, or unredacted infrastructure provisioning notes left behind by automation scripts.
Internal network endpoints belong on private resolvers or split-horizon architectures. Placing private addresses inside public zone files provides external threat actors with free reconnaissance data.
Cryptographic DNSSEC chain validation
Validate your trust chain. Auditing DNSSEC posture requires verifying the complete cryptographic chain of trust from the root zone down to your operational records. A broken DNSSEC configuration prevents validating recursive resolvers from serving your zone, generating outages for users on validating resolvers like Google Public DNS or Cloudflare Resolver. Validate that your registrar's parent zone carries accurate Delegation Signer (DS) records matching the Key Signing Key (KSK) active in your zone.
DNSCove signs zones with DNSSEC. Enabled with one click for any delegated zone, signing is included across all plans without extra charge. Algorithm 13 (ECDSA P-256/SHA-256), NSEC3 with RFC 9276 parameters (0 iterations, no salt), and CDS/CDNSKEY published per RFC 7344/8078 for registrar automation. Zone signing keys are held in the control plane under AWS KMS and do not reside on the authoritative nameservers. Signatures are refreshed automatically before expiry. Zone-signing keys roll automatically on a 90-day pre-publish schedule, which requires nothing from the customer. The key-signing key is rolled on operator demand, because a KSK roll requires a DS change at the registrar.
Automating DS synchronizations using child signals relies on IETF RFC 8078, which governs how parent registries ingest CDS and CDNSKEY records. For deeper technical analysis of these cryptographic parameters, read our breakdown of ECDSA P-256 DNSSEC key management.
Automate the audit: tooling, APIs, and continuous drift detection
Automate every recurring check. Manual quarterly audits catch accumulated errors, but automation prevents insecure configurations from ever reaching production. Implement a multi-layered verification pipeline across your environments:
- Write a scheduled ingestion pipeline that pulls complete authoritative record inventories through your DNS provider's administrative API into your core repository.
- Deploy monitoring workers across multiple geographic regions to query hostnames continuously via UDP and TCP, confirming that targets match the expectations stored in IaC configurations.
- Run linting checks inside continuous integration workflows on every pull request that modifies zone files, blocking commits that violate internal rules such as missing TTL declarations or broad wildcards.
DNSCove does not expose a Route 53 wire-compatible API in v1; you manage DNS through DNSCove's own JSON API, console, and Terraform guides, and migrate off Route 53 with a one-step zone import. Review our guide comparing the DNSCove JSON API to the AWS Route 53 API to structure your automated ingestion pipelines cleanly.
Scan your zone repositories weekly. Schedule a weekly background job to scan your zone repositories for records missing required ownership tags, and run a monthly automated reconciliation job that iterates through all CNAME targets to send test probes that identify dropped tenants before external scanners discover them. Keep audit reports in the same Git repository alongside your declarative zone files, ensuring drift alerts and remediation tasks live directly inside your engineering teams' daily operational workflow.
Turning findings into a remediation plan
Prioritize remediation by risk. An audit that produces a sprawling list of unprioritized warnings will be ignored by busy engineering teams. Convert raw audit data into an actionable remediation backlog prioritized by exploit severity.
| Severity | Finding Category | Example Failure Condition | Mandatory SLA |
|---|---|---|---|
| P0: Critical | Subdomain Takeover | CNAME pointing to an unregistered third-party cloud bucket | 4 hours |
| P1: High | Email Authentication Vulnerability | Missing SPF record, or a record containing +all fallback mechanisms |
24 hours |
| P2: Medium | Topology and Boundary Leakage | Internal RFC 1918 IPs or unredacted staging keys present in public records | 72 hours |
| P3: Low | Operational Staleness | A or TXT records confirmed dead, with zero traffic across a 30-day window | Next Sprint |
Triage vulnerabilities by severity. Assign remediation tickets based on structured ownership tags. If an audited record lacks an identifiable owner, automatically route the ticket to the platform infrastructure lead and set an unowned-asset deprecation clock. Attach JSON snapshots to tickets. Attach the full JSON snapshot directly to the remediation ticket so engineers can review historical context before altering production routing.
After closing remediation tickets, re-run your automated audit suite to confirm the changes fixed the vulnerability without introducing collateral damage. Document known exceptions in code. Certain legacy entries may be load-bearing for obscure systems: document those specific exceptions inside an explicit whitelist file in your repository, marking them as formally accepted operational risks.
A quarterly DNS audit checklist for 2026
Use this technical checklist to conduct quarterly DNS audits across your organizational infrastructure. Run it alongside our comprehensive SRE DNS infrastructure audit checklist and our guide on auditing DNS configuration for resilience.
1. Zone discovery and inventory reconciliation
- Query registrar APIs to verify every registered domain name owned by the business.
- Confirm that every active zone is managed through an approved infrastructure-as-code repository.
- Ensure all individual records carry metadata fields identifying team ownership, target environment, and intent.
2. Staleness and resolution testing
- Cross-reference edge access logs against your inventory to identify records receiving zero queries over a full 30-day period.
- Identify records pointing to deprovisioned cloud balancers, retired server instances, or obsolete third-party services.
- Execute a phased deprecation process: flag the asset, lower the TTL to many seconds, monitor for traffic anomalies, and decommission.
3. Exploit detection and perimeter hygiene
- Trace all CNAME and ALIAS destinations recursively to ensure underlying targets are registered and active.
- Eliminate unused wildcard records that mask resolution failures or expose internal names.
- Scrub public zones of internal RFC 1918 IP addresses, development subdomains, and proprietary staging notes.
4. Identity, email, and cryptographic posture
- Inspect TXT records for valid SPF syntax without permissive fallbacks, keeping evaluation lookups under the hard RFC limit of 10.
- Audit DKIM selector publications and confirm that DMARC is set to an enforcement mode of
quarantineorreject. - Verify CAA records to explicitly authorize only approved Certificate Authorities for SSL/TLS issuance.
- Confirm DNSSEC validation across all zones, checking that DS records at the registrar match authoritative DNSKEY parameters.
Architecture determines operational risk. DNSCove runs two unicast authoritative nameservers (ns1 in NYC, ns2 in Frankfurt), not an anycast network. DNSCove does not include dedicated DDoS scrubbing in v1. Factor these architectural characteristics into your availability targets, disaster recovery plans, and upstream transit designs.
Frequently asked questions
How often should I run a DNS record audit for security?
Run full audits quarterly. Organizations should execute a thorough audit quarterly. Automated linting and drift detection should run continuously inside your CI/CD pipelines for every pull request modifying zone files. You should also run targeted audits immediately after company acquisitions, during cloud migrations, and following major engineering reorganizations.
What is a dangling DNS record and why is it a takeover risk?
Dangling records point nowhere. A dangling DNS record points to a deprovisioned, deleted, or unallocated hosting resource, such as a cloud storage bucket, container host, or SaaS tenant. Attackers can claim that dangling target resource on the downstream platform, allowing them to control the subdomain, serve malicious files, steal session cookies, and bypass security boundaries.
Can I audit DNS records without zone transfer access?
Yes. Many modern authoritative DNS providers disable unauthenticated AXFR transfers for security reasons.
Which DNS records protect email during an audit?
SPF, DKIM, and DMARC establish email authenticity. SPF (TXT) defines which sending servers may deliver mail on your domain's behalf, DKIM provides a cryptographic signature confirming message contents were not modified in transit, and DMARC specifies how receiving mail servers must handle messages that fail SPF or DKIM evaluations.
How do I safely delete a stale DNS record without causing an outage?
Phase the deletion gradually. First, verify that edge routers, recursive resolvers, and load balancers have observed zero query traffic over a 30-day operating window. Next, reduce the record's TTL to 300 seconds to allow for rapid rollbacks. Wait through an entire business reporting cycle while monitoring resolver metrics. If zero traffic hits the host, remove the record from your zone file via version control so the deletion can be instantly reverted if a legacy dependency surfaces.
Then wire the API into your CI so drift gets caught before it ships.
- No AWS account required
- Zero-downtime Route 53 cutover
- Apex ALIAS / ANAME to any target
- DNS as code — Terraform, CloudFormation
Straight answer: DNSSEC signing isn't available yet — it's on the roadmap. Everything else here works today. Authoritative nameservers: ns1.dnscove.com, ns2.dnscove.org.