Join our Newsletter — 33% off our NHI Course
Home› Guides› DNS Record Types Security Guide (A, MX, TXT,…
Guide Network Security

DNS Record Types Security Guide (A, MX, TXT, CNAME, CAA): Risks and Safe Settings per Record

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

Most DNS compromises that hurt organisations are not exotic protocol attacks but ordinary records left pointing at the wrong place, granting the wrong party, or never cleaned up. A forgotten CNAME hands a subdomain to whoever claims the cloud resource behind it, an old TXT verification token keeps a third party trusted, and a zone with no CAA record lets any public certificate authority issue for it. This guide goes record type by record type: what each one does, how it is misused, and the setting or hygiene rule that matters. It is written for network, domain and email administrators who own public zones. For resolvers, protective DNS and encrypted DNS see the DNS Security Guide; this page stays at the level of individual records.

Key takeaways

  • Every record is a trust statement. A, AAAA and CNAME say where your name lives, MX says who receives your mail, TXT says which services may act for you, NS says who answers for you, and CAA says who may issue certificates for you.
  • Dangling records are the biggest everyday risk. A CNAME or A record left pointing at a deleted cloud resource or released IP lets someone else serve content, set cookies and obtain certificates under your name.
  • CAA is cheap and underused. RFC 8659 requires a compliant CA to check CAA before issuing; a record naming only your CAs, plus the RFC 8657 accounturi parameter, sharply narrows who can get a certificate.
  • TXT records accumulate trust. SPF includes, DKIM keys and domain verification tokens should each have an owner and an expiry, and be removed when the service is retired.
  • DNSSEC records protect the rest. DS, DNSKEY and RRSIG let resolvers detect forged answers, which also makes CAA and email policy records harder to suppress.

DNS record types at a glance

Type numbers are the IANA RR type codes.

Record (type)PurposeHow it is misusedControl that matters
A (1) / AAAA (28)Name to IPv4 / IPv6 addressPoints at a released cloud IP; exposes origin servers behind a CDN; forgotten AAAA bypasses IPv4-only filteringInventory with owner; remove before releasing the IP; treat AAAA as equal to A
CNAME (5)Alias to another nameDangling alias to a deprovisioned SaaS or cloud resource, leading to subdomain takeoverRemove alias before deleting the target; provider domain verification; scanning
MX (15)Mail exchangers for the domainPoints at a retired mail service that can be re-registered; missing on non-mail domains invites spoofingAccurate MX; null MX (RFC 7505) on domains that never receive mail
TXT (16)Free text: SPF, DKIM, DMARC, verification tokensOver-broad SPF includes; stale verification tokens; secrets placed in TXTOwner and expiry per entry; tidy SPF; never store secrets
CAA (257)Which CAs may issue certificatesAbsent, so any public CA may issueissue, issuewild, iodef, optionally accounturi
NS (2) / SOA (6)Delegation and zone authorityDelegation to a lapsed or deleted hosted zone (NS takeover); registrar account compromiseRegistrar lock and MFA; remove delegations before deleting zones
DS (43), DNSKEY (48), RRSIG (46), NSEC (47)DNSSEC chain of trust and signaturesExpired signatures or DS mismatch take the zone offline for validating resolversAutomated signing and rollover; monitoring of signature expiry

A and AAAA

  • Released cloud IPs: elastic or public IPs returned to a cloud provider's pool can be allocated to another customer. An A record still pointing there sends your users, and any cookies scoped to the parent domain, to that customer. Remove or repoint the record before releasing the IP, and prefer provider alias records that track the resource (for example Azure DNS alias records, which Microsoft documents as leaving an empty record set rather than a dangling one when the resource is deleted).
  • Origin exposure: an A record for origin.example.com or a historical record visible in passive DNS lets attackers reach a web server directly, bypassing a CDN or web application firewall. Accept origin traffic only from the CDN.
  • AAAA blind spots: hosts with IPv6 addresses published but filtered only on IPv4 are reachable around the firewall. Apply the same filtering and monitoring to both address families.

CNAME and dangling records

A CNAME says "this name is really that name". When "that name" is a hostname on a cloud or SaaS platform (an app service, storage bucket website, CDN endpoint, help-desk or landing page tool) and the resource behind it is deleted, the alias keeps pointing at a name nobody controls. Microsoft's guidance describes the result: an attacker creates a resource with the same platform hostname in their own account, and traffic to your subdomain reaches their content. Microsoft lists cookie harvesting, phishing, valid TLS certificates for the hijacked name, and XSS, CSRF and CORS bypass as consequences.

  • Decommission order: remove the DNS record as part of retiring the service, not afterwards; Microsoft recommends adding "remove DNS entry" to decommissioning checks and using delete locks on resources that carry custom domains.
  • Provider domain verification: many platforms bind a custom domain to a tenant through a TXT token. Azure App Service uses an asuid.<subdomain> TXT record containing the subscription's verification ID; Microsoft states that while it exists, no other subscription can validate that custom domain.
  • Scanning: regularly resolve every CNAME target in your zones and flag targets that return NXDOMAIN or a platform's "no such site" response. Microsoft publishes a Get-DanglingDnsRecords tool for Azure targets, and Defender for App Service alerts when a decommissioned site's custom domain remains in DNS.

The Subdomain Takeover and Dangling DNS Guide covers discovery and platform specifics in depth, and the Subdomain Takeover Response Playbook covers incident handling.

MX, TXT, SPF and DMARC

MX

  • Retired mail providers: an MX pointing at a service you no longer use can, depending on the provider, let another tenant claim your domain and receive its mail. Remove MX records with the contract.
  • Domains that never send or receive mail: publish a null MX (MX 0 ., RFC 7505), an SPF record of v=spf1 -all and a DMARC p=reject policy, so parked and brand domains cannot be used for spoofing.
  • Transport security: MTA-STS and TLS reporting use a TXT record plus an HTTPS policy file; see the SMTP Security, STARTTLS and MTA-STS Guide.

TXT and SPF

  • Publish SPF as TXT only: RFC 7208 requires SPF records to be published as TXT (type 16); the separate SPF record type was dropped.
  • Lookup limit: RFC 7208 limits the terms that cause DNS lookups (include, a, mx, ptr, exists and redirect) to 10 and recommends at most two void lookups; exceeding the limit returns permerror, which can break authentication for all mail.
  • Breadth of includes: each include authorises every customer of that sending platform's shared infrastructure to pass SPF for your domain. Remove includes for services you no longer use, avoid the deprecated ptr mechanism, and end with -all or ~all, never +all.
  • DKIM and DMARC: DKIM public keys live in TXT at <selector>._domainkey and DMARC policy at _dmarc. Retire selectors of former senders and rotate keys. The DMARC, SPF and DKIM Guide and the DMARCbis Changes Guide cover policy design.

Verification record hygiene

Verification tokens prove domain control to SaaS platforms, certificate authorities and identity providers. Each one is a standing grant: the IETF draft on domain control validation (draft-ietf-dnsop-domain-verification-techniques-13, an Internet-Draft dated 22 June 2026, intended as Best Current Practice and still subject to change) recommends:

  • Underscore names: place tokens at an application-specific underscore label (for example _service-challenge) rather than the zone apex, so the apex TXT set stays small and each token's purpose is obvious.
  • Random, expiring tokens: unique high-entropy tokens with a stated validity period.
  • Cleanup: remove one-time validation records after use, and document how persistent ones are revoked.
  • Delegated validation via CNAME: safe only when the intermediary binds each customer and domain to its token; otherwise a dangling CNAME becomes a takeover path.

Never put secrets, API keys or internal notes in TXT records; anyone can query them.

CAA and certificate issuance

CAA (Certification Authority Authorization), defined in RFC 8659 (Standards Track, November 2019, obsoleting RFC 6844), lets a domain holder state which CAs may issue certificates. Before issuing, a compliant CA must look for the relevant CAA record set, starting at the requested name and climbing towards the root until it finds one, and must not issue if the request is inconsistent with it.

PropertyEffectExample
issueAuthorises a CA to issue for the name and its subdomainsexample.com. CAA 0 issue "ca.example.net"
issuewildGoverns wildcard certificates only; when present, issue is ignored for wildcardsexample.com. CAA 0 issuewild ";" (no wildcards)
iodefWhere CAs may report violating requests (mailto:, http: or https:)example.com. CAA 0 iodef "mailto:[email protected]"
issue ";"No CA may issueParked domains
Flag 128Critical: a CA that does not understand the tag must not issueUse only for tags all your CAs support
accounturi, validationmethods (RFC 8657)Restrict issuance to named CA accounts and validation methods, where the CA supports themLimit ACME issuance to your account and to dns-01
  • Coverage: because the lookup climbs the tree, a CAA record at the apex covers subdomains unless a subdomain publishes its own. RFC 8659 leaves CNAME following to the CA's resolver, so a subdomain aliased to a third party may pick up that party's CAA policy.
  • Additive authorisations: each issue line adds a CA; list every CA you use, including those used by CDNs and SaaS platforms for your names, or their renewals will fail.
  • Detect what CAA cannot stop: CAA does not bind a mis-issuing or compromised CA, so pair it with monitoring of Certificate Transparency logs. See the Certificate Transparency Monitoring Guide for Web Teams.
  • DNSSEC: RFC 8659 strongly recommends, but does not require, DNSSEC, which helps detect suppressed CAA records.

NS, SOA and delegation risk

  • Lame and dangling delegations: NS records at the parent (or for a delegated subdomain) that point at a hosted zone you have deleted can let another customer of the same DNS provider create the zone and answer for your name. Remove the delegation first, then delete the zone, and check delegated subdomains during scans.
  • Registrar control: whoever controls the registrar account controls the NS records at the registry. Use registrar and registry locks, phishing-resistant MFA and a small set of named administrators. See the Registrar and Authoritative DNS Security Guide; hijacking of NS records at the registrar level is the pattern used by the Sea Turtle Threat Actor Profile group.
  • Zone transfers: restrict AXFR and IXFR to named secondary servers, ideally with TSIG. Open transfers publish the whole zone.

DNSSEC records

DNSSEC adds records that let a validating resolver confirm an answer came from the zone owner unaltered. RFC 4034 defines the core types:

RecordWhere it livesWhat it doesOperational risk
DNSKEY (48)Child zone apexPublic keys; flags 256 for a zone signing key and 257 when the Secure Entry Point bit is set (typically the key signing key)Key rollover errors break validation
RRSIG (46)Next to each signed record setSignature with inception and expiration timesExpired signatures make the zone fail for validating resolvers
DS (43)Parent zoneDigest of the child's key signing key, linking the chain of trustDS left at the parent after the child stops signing takes the domain offline
NSEC (47) / NSEC3 (50)Child zoneAuthenticated denial of existenceNSEC chains reveal zone names; NSEC3 parameters can create load
CDS / CDNSKEY (RFC 7344)Child zone apexChild signals the DS it wants the parent to publishParent must validate before acting
  • NSEC or NSEC3: RFC 9276 (BCP 236) advises plain NSEC unless NSEC3 features are needed, and for NSEC3 an iteration count of 0 and an empty salt, noting that NSEC3 hashing gives only moderate protection against zone enumeration.
  • Automate: use signer automation for signatures and rollovers, and CDS/CDNSKEY where your registry supports it, so DS updates do not depend on manual registrar changes.

The DNSSEC Deployment Guide covers signing, rollover and validation step by step.

How to implement record hygiene

  1. Export every public zone and record type into an inventory with an owner and a business reason per record; include delegated subdomains and records held at SaaS DNS providers.
  2. Classify by risk: CNAMEs and A records pointing at third-party platforms, NS delegations, MX, SPF includes and verification tokens first.
  3. Scan for dangling targets and fix them; then add the scan to a schedule (weekly is common) and to the decommissioning checklist.
  4. Publish CAA listing current CAs, starting with iodef to receive reports; add accounturi once every issuing account is known.
  5. Clean up TXT: remove unused SPF includes and verification tokens, confirming with each service owner. Keep the removed values for a rollback window.
  6. Change control: make zone changes through version-controlled zone files or IaC with review, so every record has a history and a change can be reverted quickly. The Domain and DNS Management Policy Template gives policy wording.
  7. Roll back safely: lower TTLs before risky changes, and if a removal breaks a service, restore the saved record and investigate before retrying.

Detection and measurement

  • What to monitor: zone change logs and SOA serials, registrar account events, CNAME and NS targets that stop resolving, new certificates for your names in Certificate Transparency logs, DNSSEC signature expiry, and DMARC aggregate reports. The DNS Logging and Detection Guide covers log sources.
MetricTarget
Records with a named owner100% of public records
Dangling CNAME, A or NS targets foundZero open longer than 24 hours
Public zones with CAA100%, including parked domains
SPF DNS lookup count per domain10 or fewer, with headroom
Verification tokens older than their stated purposeZero
Days before RRSIG expiry at the latest checkAbove your re-signing threshold

Common failure patterns

  • Delete resource, keep record: the classic subdomain takeover, usually from a marketing or test site.
  • Trust in a name nobody renewed: allow-lists and configuration that trust a domain outlive its registration; in the ForcedLeak Agentforce incident an expired domain left on a content security policy allow-list was re-registered and used as an exfiltration channel. Inventory every domain you trust, not just those you host.
  • SPF sprawl: includes for every past vendor push the record past 10 lookups and authorise shared platforms you no longer use.
  • CAA missing a CA: a CDN's managed certificates fail to renew because its CA was not listed, and the record is removed rather than fixed.
  • DS left behind: a zone moved to a new DNS provider without DNSSEC, while the old DS remains at the parent.

Framework mapping

AreaNIST SP 800-53 Rev. 5NIST CSF 2.0ATT&CK
Authoritative records and DNSSEC signingSC-20 Secure Name/Address Resolution Service (Authoritative Source)PR.DS-02T1584.002 DNS Server
Validation and resolver integritySC-21, SC-22PR.IR-01T1557 Adversary-in-the-Middle
Record inventory and dangling recordsCM-8 System Component InventoryID.AM-02T1584.001 Domains (compromise of your domains or subdomains)
Change control of zonesCM-2, CM-3PR.PS-01T1583.001 Domains (look-alike registration, monitored alongside)

NIST SP 800-81 Rev. 3, published as final in March 2026, is the current NIST DNS deployment guide; see the NIST SP 800-81 Rev. 3 Secure DNS Deployment Guide.

Practitioner checklist

  • Every public record has an owner and reason in an inventory reviewed at least quarterly.
  • Decommissioning checklists remove DNS records before cloud resources, IPs or hosted zones are deleted.
  • Scheduled scan for CNAME, A and NS targets that no longer resolve to resources you own.
  • CAA on every zone listing only the CAs in use, with iodef and, where supported, accounturi.
  • SPF within 10 lookups, ending in -all or ~all; unused includes and DKIM selectors removed.
  • Verification tokens at underscore names, each with an owner and removed when no longer needed.
  • Null MX, v=spf1 -all, DMARC reject and issue ";" on parked domains.
  • Registrar lock, MFA and named administrators; zone transfers restricted to named secondaries.
  • DNSSEC signing automated, with alerting on signature expiry and DS consistency.
  • Certificate Transparency monitoring for all your names.

Standards and references

Related NHI Mgmt Group resources: DNS Security Guide · Subdomain Takeover and Dangling DNS Guide · DNSSEC Deployment Guide · DMARC, SPF and DKIM Guide · DNS Security Checklist

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.