DNS Records, Certificates, and Forgotten Subdomains
Port scans get the attention, but a large share of an organization's attack surface never touches a port. It lives in public records: the DNS zone that maps your names to addresses and the certificates that vouch for those names. It also lives in the mail records that say who may send as your domain. All of it is published on purpose, all of it is readable by anyone, and all of it accumulates. Names get added for campaigns and projects and vendors, and almost nobody goes back to delete them when the thing they pointed at goes away.
The result is a zone full of promises the organization no longer keeps. There is a subdomain pointing at a hosting account that was cancelled. There is a name resolving to a cloud address you released. There is a certificate for a service nobody remembers. Each stale entry is a small liability, and together they are a map of your history that an outsider can read for free.
This guide covers the records side of your own attack surface. You will learn to treat every public record as a commitment and recognize the stale and dangling ones. You will learn to build a complete subdomain inventory from your zone files and from the public certificate logs. You will also learn to review certificates and mail records as exposure. And you will learn to run a cleanup that removes, redirects, renews, or documents each finding. Everything here concerns domains your organization registered and names it controls. The public logs you will search are searched for your names, and no one else's.
In this guide
- Every public record is a promise
- Stale and dangling records: a hygiene problem
- Building the subdomain inventory
- Certificates as exposure
- Mail records as attack-surface items
- The records-review checklist
- What you will find: a findings table
- The cleanup process: remove, redirect, renew, document
- Where to go next
Every public record is a promise
DNS, the Domain Name System, is the internet's public phone book. When you publish a record like events.example.com A 203.0.113.40, you are making a statement to the entire world. You are saying: "this name belongs to us, and the thing at this address speaks for us." Browsers believe it. Mail servers believe it. Certificate authorities, when deciding whether to issue you a certificate, believe it. Your own staff, clicking a link in an old document, believe it.
That makes each record a promise, and a promise is only as good as your control over the thing it points at. As long as 203.0.113.40 is your server, the promise holds. The day you retire that server and hand the address back to your provider, the promise is still published but no longer kept. The record has not changed; the world behind it has. That is the core idea of this guide: DNS drift is rarely about records changing. It is usually about records staying the same while what they point at changes underneath.
The main record types you will meet, with the promise each one makes:
| Record type | What it says | The promise it makes |
|---|---|---|
| A / AAAA | This name has this IP address | We control the host at this address |
| CNAME | This name is an alias for that other name | We control (or trust) whoever controls the target name |
| MX | Mail for this domain goes to these servers | Those servers are ours or act for us |
| TXT (SPF, DMARC, verification) | Policy text: who may send mail as us, how to treat failures, proof of ownership for a service | The named senders and services are authorized by us |
| NS | This zone (or subzone) is served by these name servers | Whoever runs those servers controls every name beneath |
Stale and dangling records: a hygiene problem
A stale record is one whose purpose has ended: the campaign finished, the vendor was replaced, the test server was decommissioned. Stale records are clutter. They confuse the next administrator and inflate the inventory. They occasionally point at something embarrassing, like a "coming soon" page from a product that shipped years ago.
A dangling record is the more serious case: a record pointing at a resource you no longer control. The common shapes include an A record for a cloud address you released. Another is a CNAME pointing at a hosting platform's hostname after the account was closed. And another is an NS delegation to name servers you no longer run. The problem is simple to state. Providers reuse addresses and hostnames. If your name still points at one, then whoever is assigned that resource next is, from the world's point of view, speaking for your organization. Browsers show your name in the address bar. Certificate authorities may issue a certificate for your name to whoever controls the target. Staff following an old bookmark land on content you did not put there.
This guide treats dangling records as what they are for the defender: a hygiene problem with a clear fix. Find the records that point outside your control, and either bring the target back under your control or delete the record. The goal is simply a zone that never contains a promise you cannot keep.
You can spot candidates from the zone itself. Any A record whose address is not in your current public ranges deserves a question. Any CNAME whose target is under a provider's domain deserves a check that the account behind it is still active and yours. Any NS delegation deserves confirmation that you still run the servers. The subdomain inventory below makes that review complete rather than a spot check.
Building the subdomain inventory
A subdomain inventory is the list of every name that exists under domains you own, with the target and the purpose of each. It is built from two sources, in order.
Source 1: your own zone files
Start where the truth is: the authoritative zone. Every DNS host, whether a registrar's panel, a cloud DNS service, or a name server you run, can export the full zone. Export every zone for every domain you own, including defensive and legacy domains. The export is your primary inventory, complete by definition, because a name that is not in the zone does not resolve. An excerpt, with the kind of annotation to add as you review:
; example.com zone export (excerpt), reviewed by: (name) on: (date) www A 203.0.113.2 ; website, webteam - OK mail A 203.0.113.3 ; mail gateway, mailadmin - OK vpn A 203.0.113.1 ; firewall VPN portal, netadmin - OK events A 203.0.113.40 ; NOT in our ranges - address released? CHECK shop CNAME shop-4471.hostingplatform.example. ; account still active? CHECK survey CNAME forms.surveyvendor.example. ; marketing tool, owner? CHECK dev NS ns1.oldcontractor.example. ; delegated to a contractor - CHECK @ MX 10 mail.example.com. ; OK @ TXT "v=spf1 ip4:203.0.113.3 include:marketingplatform.example -all" _dmarc TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"
Four lines earned a CHECK. The events address is outside the current ranges, so it is either an address you released or a provider you forgot. The shop and survey aliases point at third-party platforms, which is fine only if the accounts behind them are still active and yours. The dev delegation hands an entire subzone to name servers a contractor ran. So every name under dev.example.com is controlled by whoever runs those servers today.
Source 2: certificate transparency logs
The zone export is complete for names that exist now. It says nothing about names that existed and were deleted. It also says nothing about certificates that were issued for your names by people you did not know about. For that, use certificate transparency. Public certificate authorities record every certificate they issue in append-only public logs, so that anyone can see which certificates exist for which names. Search interfaces over those logs let you enter a domain you own. You get back every logged certificate for that domain and its subdomains, including the name on each, the issuer, and the validity dates.
Searching the logs for your own domain is a read of public data, needs no authorization beyond owning the domain, and touches no one's servers. It returns an independent, historical inventory of your names. Compare it against the zone export and look at three groups. The first is names in the logs that are no longer in the zone (retired subdomains, a sanity check on your cleanup). The second is names in the zone under an owner you have not identified. The third is names nobody in your organization recognizes at all. The last group is the important one. A certificate for a name you never created means one of two things. Someone set up a service without telling IT. Or a dangling record let an outsider prove "control" of one of your names. Either way you want to know today.
Tip: Save each log search as a dated file and diff it against the previous one at the cadence in the program guide. New certificates for your domain that you did not request are one of the few attack-surface signals that arrive before anything is reachable at all.
Certificates as exposure
A certificate is the identity document an encrypted service presents to prove it is the name you asked for. From the attack-surface point of view, three questions matter for every certificate on a public service you own.
Is it about to expire? An expired certificate turns a working service into a browser warning, and for mail and API clients it often turns into a silent failure. Expiry tracking is its own discipline, covered in the certificate inventory guide. The attack-surface review simply confirms that every certificate found on the perimeter is present in that inventory. That is how forgotten services get their renewals scheduled.
Is it weak or self-signed on a public service? A self-signed certificate is one the device or server issued to itself, with no authority vouching for it. Internally that is often fine. On a public address it is a signal, because maintained public services get proper certificates and equipment does not. In the scanning guide, the vendor's appliance gave itself away exactly this way. A certificate on a public service may be self-signed, use an outdated signature method, or name something other than the service. Any such certificate is a finding to trace to its owner.
Is it for a name you do not recognize? This is the transparency-log question from the previous section, and it belongs on the certificate review as well. Certificates are issued to names; a certificate for a name you did not know you had is a name you did not know you had.
You can read a public service's certificate yourself with the standard encryption toolkit present on most systems. For a web service you own:
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates subject=CN = www.example.com issuer=C = XX, O = Public Certificate Authority, CN = Public CA Intermediate notBefore=(date) notAfter=(date)
Record subject, issuer, and the expiry date for each service, and compare them with the inventory. An issuer that reads as the device's own name, or a subject that does not match the service, goes straight onto the findings list.
Mail records as attack-surface items
Mail is where DNS hygiene has the most direct consequences. Other organizations use the records that control who may send as your domain to decide whether mail claiming to be from you is genuine. Three records do this work.
- SPF (Sender Policy Framework) is a TXT record listing the servers and services allowed to send mail for your domain. Every entry is a sender you are vouching for. A stale entry, such as an
includefor a marketing platform you stopped using, means you are still vouching for whoever controls that platform's sending infrastructure. - DKIM (DomainKeys Identified Mail) publishes, under a subdomain, the public keys that verify signatures on your outbound mail. Each key belongs to a sending system. A key record for a system you no longer run is a promise you cannot keep.
- DMARC (Domain-based Message Authentication, Reporting and Conformance) is a TXT record at
_dmarc. It tells receivers what to do with mail that fails SPF and DKIM checks, and where to send reports. A missing or "monitor only" policy means anyone can send mail as your domain and receivers have been told not to mind.
Look these up with the DNS utility on any system, dig TXT example.com and dig TXT _dmarc.example.com. Read them as an inventory: every sender in SPF, every DKIM selector, and the DMARC policy are attack-surface items with owners. The MX records deserve the same treatment. Each one is a server that accepts mail for you, and each should be either yours or a provider you currently pay.
The records-review checklist
Run this sequence on each domain you own, at the cadence the program guide sets. The first pass is slow. Later passes are mostly diffs.
- 1. Export every zone for every domain in the registrar accounts, including defensive and inherited domains. Date the export.
- 2. Flag every A and AAAA record whose address is outside your current public ranges and cloud allocations. Each is either a provider you forgot or an address you released.
- 3. Flag every CNAME whose target is under a third-party domain. Confirm the account behind it is active and yours.
- 4. Flag every NS delegation. Confirm you run, or currently contract, the servers it names.
- 5. Search certificate transparency for each domain. Diff against the zone and against last time. List every name nobody recognizes.
- 6. Inspect every certificate on public services in the baseline: subject, issuer, expiry, self-signed. Confirm each is in the certificate inventory.
- 7. Read the mail records: every SPF sender, every DKIM selector, the DMARC policy, every MX. Confirm each has a current owner.
- 8. Assign an owner to every flagged item, and open a finding for each.
- 9. Record the review: date, reviewer, exports and searches saved, findings list.
What you will find: a findings table
The first review of a zone that has never been reviewed produces the same kinds of findings almost everywhere. Knowing them in advance makes the review faster and the conversation with owners easier.
| Finding | How it shows up | Risk in plain words | Fix |
|---|---|---|---|
| A record to a released address | Address outside your ranges; often no response, or a stranger's content | Whoever gets the address next speaks for your name | Remove, or repoint to something you control |
| CNAME to a closed hosting account | Target under a platform domain; the platform shows "not found" or a claim page | Anyone who opens an account there could claim your name | Remove, or reactivate the account under your control |
| NS delegation to servers you no longer run | Delegation to a contractor or old provider | Whoever runs those servers controls the whole subzone | Remove the delegation, or bring the servers in-house |
| Subdomain nobody owns | Resolves, serves something, no owner found | Unmaintained service on your name | Find the owner or retire it; redirect if users depend on it |
| Certificate for an unknown name | Appears in transparency logs; not in zone or inventory | A service or a takeover you did not know about | Investigate immediately; revoke if not yours |
| Self-signed certificate on a public service | Issuer equals subject or a device name | Usually equipment reachable from outside | Restrict the service; issue a proper certificate if it must stay |
| Certificate near expiry, not in inventory | Found on the perimeter, absent from the renewal list | Outage on a forgotten service | Add to inventory; renew |
| Stale SPF include or DKIM selector | Names a platform or system you no longer use | You vouch for mail you do not send | Remove the entry; re-verify mail still passes |
| Weak or missing DMARC policy | No _dmarc record, or policy set to none | Your domain is easy to impersonate | Publish a policy; tighten it as reports allow |
The cleanup process: remove, redirect, renew, document
Every finding ends in one of four actions. Deciding which one is the owner's job; making sure a decision is made is yours.
Remove. The default for anything whose purpose has ended. Delete the record, revoke the certificate if one was issued for the name and is still valid, and drop the SPF or DKIM entry. Before deleting a record with a long history, check web server logs or the service's own analytics for recent traffic. A name that still gets visitors deserves a redirect rather than a silent disappearance.
Redirect. For a retired name that people still use, point it at something you control that sends them to the right place. That could be a small redirect service, or the main site. This keeps the promise honest ("this name is ours and here is where it leads") without keeping the old service alive. A redirect target must itself be in your ranges and in the baseline, or you have just created a new dangling record.
Renew. This is for findings that are legitimate but neglected. Examples are the forgotten service whose certificate is about to expire and the hosting account that lapsed but is still needed. Another is the contractor delegation that should become an in-house zone. Renewal means bringing the item back under active ownership and into the inventories, not merely paying an invoice.
Document. For everything that stays, including the things that were fine all along. Add the owner and purpose as a comment in the zone or a row in the inventory. That way, the next reviewer is not repeating this investigation from scratch. A zone where every record carries an owner and a reason is the goal; each review should move you closer to it.
Whatever the action, close the loop by re-running the relevant lookup afterward. Confirm the record is gone, the redirect works, the new certificate is presented, and the SPF still passes. Then save the dated export and log search so the next review is a diff against a known-good state rather than another archaeology project.
Where to go next
You now have the records half of the attack-surface picture. Every DNS record is a promise about something you control. Stale and dangling records are promises you no longer keep, and the fix is hygiene, not heroics. The zone export is the primary inventory. The public certificate logs are the independent cross-check, and the mail records are a list of senders you vouch for. A short checklist turns it into a repeatable review, and four actions close every finding.
The port and service side of the surface is covered in the exposure scanning guide and the open-port drift guide. The same baseline-and-diff habit applies to zones and log searches. The program guide sets the review cadence and shows how to track findings to closure. For the foundations, start with Seeing Your Network the Way Attackers Do. All of it lives under External Attack Surface Monitoring.
Put this into practice with SysPeep Monitor
A DNS record that points at a server you decommissioned is only obvious if you know the server is gone. SysPeep Monitor keeps that inside picture current. It discovers the devices and interfaces on your network. It tracks their health over SNMP, WMI, and SSH, and shows what is actually up on live dashboards. So when a zone review asks whether the host behind a record still exists, the answer is one glance away. The free trial installs on a Windows machine in minutes.
Download Free TrialLearn About SysPeep