Lab note · DNS
Dangling DNS: finding and fixing a takeover risk on my own domain
I had a spare domain sitting in a registrar account. Months ago it pointed at a hosted website builder. I stopped using that service and removed the site, but I never went back to the DNS. When I finally looked, the domain still had A records pointing at the old provider's edge network, and visiting it showed a Cloudflare "Error 1001: DNS resolution error" page. Nothing was broken in a way anyone would notice. That is exactly why it was a problem.
Why a record like that is dangerous
A DNS record that points at a service you no longer control is called a dangling record. The provider's servers are still there and still answer for lots of customers. If someone else signs up and claims your hostname on that platform, the provider may happily start serving their content on your domain. That is a subdomain or domain takeover.
Once someone controls what your name serves, they can host a convincing phishing page, collect cookies scoped to your domain, or get a valid TLS certificate for it, because the certificate authority checks control of the name, not who you are. A domain that "does nothing" still carries your reputation.
The 1001 page is a useful clue. It usually means the name is routed to that edge network but no active account owns it there. In other words: the door is open and nobody is standing in it.
How I found everything that pointed at it
I did not trust the registrar's web panel alone. I listed what the world actually sees, from more than one resolver, because caches and stale records can hide things:
dig +short example.org A @1.1.1.1
dig +short example.org A @8.8.8.8
dig +short www.example.org @1.1.1.1
dig +short example.org MX TXT CAA @1.1.1.1
Then I checked every name I had ever used under the domain, not just the apex and www: old test names, a forgotten shop name, anything in my notes or old certificate logs. Public certificate transparency logs are a good memory aid here, because every certificate ever issued for your names is listed there.
The fix
- Delete the old records. Every A, AAAA and CNAME that pointed at the removed service went. If a name has no purpose, it should not resolve.
- Re-point what I wanted to keep at a server I control, and only that server.
- Check again from every resolver after the change, and keep checking until they agree.
That last step caught a second mistake. After I added the new A record, one name still returned two addresses: my new server and one of the old provider's. A leftover second A record means some visitors land on the old host, and so can a certificate authority doing its HTTP check. Certificate requests can fail at random, or worse, succeed against the wrong machine. I removed the stray record and waited until both resolvers returned only the one address before asking for any certificate.
Locking down a domain that sends no mail
This domain will never send or receive email, so I said so in DNS. A domain with no mail records is easy to spoof in a phishing email, because receivers have nothing to check against. Three records fix that:
example.org. MX 0 .
example.org. TXT "v=spf1 -all"
_dmarc.example.org. TXT "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s"
- The null MX (priority 0, target ".") tells other servers this domain accepts no mail.
- SPF -all says no server at all is allowed to send as this domain.
- DMARC p=reject with strict alignment tells receivers to refuse anything that claims to come from it, including subdomains.
I also added a CAA record naming the one certificate authority I use, so another authority should refuse to issue for the domain.
What I changed in my routine
- When I remove a service, I remove its DNS records in the same sitting. The DNS change is part of the shutdown, not a later tidy-up.
- Every domain I own goes on a simple list with what each name points at and why.
- Spare domains get the no-mail records on day one, even if they are just parked.
- Before requesting a certificate, I confirm every resolver returns only the address I expect.
None of this needed special tools. It needed me to look at a domain I had forgotten about, with the same suspicion I would give someone else's.