Find and Remove Dangling CNAME Records on Your Domain
Audit your cPanel DNS zone line by line, delete dead CNAME records in the safe order, keep your GitHub Pages verification record, and stop takeovers.
The short answer
A dangling CNAME points at a service you shut down, and someone else may be able to claim that name. Copy your zone in cPanel Zone Editor, check every CNAME target in the provider dashboard, and mark each record keep, delete or ask first. Delete the DNS record first, wait for its TTL to expire, and only then delete the old service. Keep verification records such as the GitHub Pages challenge TXT record.
Reading options
On this page
- What a dangling DNS record actually is
- Before you start
- Audit your zone in cPanel Zone Editor
- Delete in the safe order
- GitHub Pages and cloud verification records
- Check records from your own computer
- How to check it worked
- Troubleshooting
- Pro tips and security notes
- Your decommissioning checklist
- The one message worth forwarding
- Reader questions
- Sources & further reading
A dangling CNAME is a DNS record that still points at a service you switched off. You find it by reading every record in your zone and asking one question: does the thing it points at still exist, inside an account you control? You remove it by deleting the DNS record first and the old service second, never the other way round.
Here is the part that catches people out. Microsoft's security guidance says that someone who takes over one of your subdomains can get a valid SSL certificate for it, so the padlock in the browser looks perfectly normal.
By the end of this guide you will have audited your zone in cPanel line by line, deleted dead records in a safe order, protected any GitHub Pages domain, and written a short checklist so the problem does not come back.
What a dangling DNS record actually is
Your DNS zone is the list of records that tells the internet where each name on your domain lives. A CNAME record (canonical name) is one kind of record that says "this name is an alias for that other name". If DNS is new to you, our guide on connecting a domain to hosting is a gentle place to start.
Think of a signpost on your street that says "Our Bakery, Unit 4, this way". One day you move out of Unit 4, but you forget to take the sign down. Whoever rents Unit 4 next gets every customer who follows your sign, and the customers have no reason to doubt it.
That is a dangling record. Microsoft describes it as a DNS record that points to a resource that was deprovisioned (shut down and deleted), and it says CNAME records are especially vulnerable. A subdomain takeover is what happens when a stranger claims the name the sign points at.
Why this matters: Microsoft lists what an attacker can do from your subdomain. They can serve their own content under your name, harvest cookies that your main site shares with subdomains, run phishing pages, and use MX records (the records that route email) to receive mail sent to that subdomain. The same page says a takeover can lead on to attacks like XSS, CSRF and CORS bypass.
Made-up example: imagine a small bakery that used a free hosted page builder for a holiday promo at promo.example.com. In January they cancel the page builder account. The CNAME for promo still points at the builder. If the builder lets anyone register that page name again, the next sign-up controls what customers see at the bakery's own address, padlock included.
Before you start
This job is low risk if you go slowly and keep notes. Gather these things first.
- Access to cPanel for the domain, with the Zone Editor feature visible. Your host can switch Zone Editor on or off in WHM's Feature Manager, so if you cannot see it, ask them.
- A list of every outside service you have connected to the domain: page builders, help desks, email providers, cloud apps, GitHub Pages. Old invoices and old welcome emails help here.
- Logins for those services, because the provider dashboard is the only place that proves a target is still yours.
- A copy of the zone. You will make it in Step 1, and you should not skip it.
- About 30 to 60 minutes for a small zone of a few dozen records.
- A rough sense of risk. Records for your main website and your email are high risk to touch. A forgotten
promoorold-shopalias is low risk to delete once you have checked it.
Heads up: if the domain uses outside nameservers instead of your cPanel host, the records you edit in cPanel may not be the live ones. Check where your nameservers point before you start, and do the audit wherever the live zone is.
Audit your zone in cPanel Zone Editor
These steps follow cPanel's own Zone Editor documentation, which at the time of writing (2 December 2026) covers cPanel version 136 and later. Older versions may look a little different.
Step 1: Make a copy of every record before you touch anything
Open cPanel > Domains > Zone Editor, find your domain in the list, and click Manage. You will see the Manage Zone table with five columns: Name, TTL, Type, Record and Actions.
TTL means time to live: how many seconds other computers may keep a cached copy of the record before asking again. You will need that number later, so copy it along with everything else.
cPanel's documentation does not describe a zone export button on this screen. So copy the table into a plain text file, one record per line, and save it with the date in the file name. A copy might start like this.
example.com-zone-2026-12-02.txt
Name TTL Type Record
example.com. 14400 A 192.0.2.10
example.com. 14400 AAAA 2001:db8::10
www.example.com. 14400 CNAME example.com.
promo.example.com. 14400 CNAME example-bakery.pagebuilder.example.com.
docs.example.com. 3600 CNAME example-user.github.io.
example.com. 14400 MX 0 mail.example.com.You should end up with a file you could rebuild the zone from by hand. A full account backup from your host is a good extra.
Quick tip: do not use Reset DNS Zone as a shortcut for cleaning up. cPanel's documentation says it erases your zone changes and advises recording anything you want to keep first.
Step 2: Filter the table down to CNAME records
In the Manage Zone screen, use the record type filter to show only CNAME records. The cPanel documentation says you can filter by typing a name in the text box or by picking a record type.
Count the aliases and note the number, so you know when you have checked every one.
Step 3: Fill in an audit line for each record
For each CNAME, write one line with what it is, where it points, who owns the target, and your decision. Use the template below and copy it once per record.
Name: promo.example.com
Target: example-bakery.pagebuilder.example.com
Service: page builder used for the 2025 holiday promo
Owner: marketing, account closed January 2026
In use?: no
Decision: delete DNS record, then confirm account is closedFill in the Owner line from facts. A target that "looks like ours" is not proof.
Step 4: Prove each target in the provider dashboard
Log in to each provider and look for the site, app or custom domain that matches the target. If you can see it in your own account and it is in use, mark the record as keep.
If the account is closed, the site is deleted, or the plan was downgraded and the feature is gone, mark it as delete. If nobody can say, mark it as ask first, and chase the person or the provider's support before you touch it.
Heads up: do not rely on "the name still resolves" as proof. AWS points out that a check which only asks DNS whether the target resolves will still pass after an attacker has claimed the name. Resolving tells you something answers. It does not tell you who.
Step 5: Look past the CNAMEs
Clear the type filter and scan the rest of the zone. These records need a second look too.
- MX records for a mail service you stopped using. Microsoft names MX records as a phishing route after a takeover, so treat a forgotten mail provider like a forgotten website.
- TXT verification records. These are small proof-of-ownership notes that services ask you to add. Some of them protect you, so read the GitHub section below before deleting any.
Heads up: watch for wildcard records such as *.example.com. A wildcard answers for every name you did not list, which makes it easy to forget what it covers, and GitHub's documentation strongly recommends against them for Pages.
Afterwards you should have a short list of records marked delete, each with a reason.
Delete in the safe order
Order matters more than speed here. AWS puts the rule plainly: "Always delete DNS first". Then you wait for the TTL to expire, and only then do you delete the resource.
Why this matters: if you delete the service first, there is a window where your DNS still sends visitors to a name that anyone can claim. AWS gives examples of names that can be claimed again by other accounts once you let go of them, such as global Amazon S3 bucket names and Elastic Beanstalk environment names. Deleting DNS first closes that window before it opens.
Step 6: Remove the DNS record in cPanel
Go back to cPanel > Domains > Zone Editor, click Manage next to the domain, find the record, and click Delete. A confirmation dialog appears, and you click Continue.
Delete one record at a time. After each one, the record should disappear from the Manage Zone table. Write the date and time in your audit line.
If you would rather move the name to something you control than delete it, click Edit next to the record, change the record value to a resource you control, and click Save Record. Only do this when the name should keep working.
Step 7: Wait out the TTL, then delete the old service
Look at the TTL you copied in Step 1. If it was 14400, that is four hours. Other computers may still hold the old answer until then.
Once that time has passed, delete or release the old site, app or bucket at the provider. Nothing points at it now, so it no longer matters who claims the name next.
Quick tip: if you plan a shutdown in advance, you can lower the TTL on the record a day or so before, so the wait after deletion is short.
Step 8: Clean up references in your own code
Microsoft's remediation steps include reviewing your application code for references to the old subdomain. Search your website templates, scripts, email signatures and API settings for the old name, for example promo.example.com, and remove or replace each one.
GitHub Pages and cloud verification records
Hosted platforms add a twist. They often ask you to publish a verification record, and that record can be the thing that stops a takeover.
Keep the GitHub Pages verification TXT record
GitHub lets you verify a custom domain for Pages. It does this with a TXT record whose name follows this pattern, where USERNAME is your GitHub user name or organisation name.
_github-pages-challenge-USERNAME.example.com. 3600 IN TXT "value-shown-in-github-settings"GitHub's documentation says verification stops other GitHub users from taking over your custom domain, and that you must keep the TXT record in your DNS to stay verified. So when you audit, mark _github-pages-challenge-USERNAME as keep, even if it looks like clutter.
GitHub also warns that takeovers can happen when you delete the repository, when your billing plan is downgraded, or after any change that unlinks the custom domain or disables Pages. That warning covers a domain that is still set up for Pages but not verified.
Remove a GitHub Pages site the safe way
For a subdomain, GitHub says the CNAME should point to USERNAME.github.io or ORGANIZATION.github.io, without the repository name. So a Pages record in your zone usually looks like this.
docs.example.com. 3600 IN CNAME example-user.github.io.When you retire the site, follow the same safe order. First delete that CNAME in cPanel. Then, after the TTL, open the repository and go to Settings > Pages, and under "Custom domain" click Remove. Only then delete or archive the repository.
Why this matters: GitHub says that a disabled Pages site with a custom domain still set up is at risk of takeover, and that if the domain is not verified you should update or remove the DNS records right away.
Cloud verification records, using Azure as one example
Other platforms use similar records, with their own names. As one example, Microsoft describes an asuid TXT record for Azure App Service, named like asuid.shop.example.com, which holds a domain verification ID. Microsoft says that while it exists, no other Azure subscription can validate that custom domain or take it over.
Treat that as one example, not a rule. Read your own provider's documentation before deleting a verification record you do not recognise.
Check records from your own computer
cPanel shows what is in your zone. A lookup tool shows what the internet is being told.
Linux and macOS: dig
dig is a DNS lookup tool from BIND 9. The BIND 9 manual gives the typical form as dig @server name type, and says that if you leave out the type, dig looks up an A record.
This command asks for the CNAME of a subdomain and prints only the short answer.
dig promo.example.com CNAME +shortBefore deletion you should see the target, something like example-bakery.pagebuilder.example.com. with a trailing dot.
To see only the answer section without the extra headers, use +noall +answer like this.
dig promo.example.com CNAME +noall +answerYou should see one line with the name, the TTL, IN, CNAME and the target.
To check the GitHub verification record, this is the command GitHub's own documentation uses, with your values in place of the placeholders.
dig _github-pages-challenge-USERNAME.example.com +nostats +nocomments +nocmd TXTYou should see your TXT value in the answer. If you see nothing, the record is missing or not yet visible.
Windows: nslookup
Windows has nslookup built in. Microsoft's command reference says the -type= option picks the record type, and that a second name on the line is the DNS server to ask.
This command asks a specific DNS server for the CNAME record.
nslookup -type=CNAME promo.example.com ns1.example.comSwap ns1.example.com for one of your real nameservers, or leave it off to use your default resolver. Before deletion, the answer should show the alias and its target name.
How to check it worked
Run these checks for every record you deleted.
- Reload the Manage Zone table in cPanel and filter by the name. The record should not be listed.
- Ask your authoritative nameserver directly, so you skip any cache. Replace
ns1.example.comwith one of your real nameservers. - Wait one full TTL, then check through a normal resolver.
- Compare a fresh copy of the zone with your Step 1 file. The only differences should be the records you meant to remove.
This command asks your own nameserver for the deleted CNAME.
dig @ns1.example.com promo.example.com CNAME +shortYou should get no output at all. An empty answer with +short means the server has no CNAME for that name.
This command shows the full reply, so you can read the status in the header.
dig @ns1.example.com promo.example.comLook for status: NXDOMAIN, which means the name does not exist, or NOERROR with no answer section if other records still live under that name. Both are fine. What you do not want is a CNAME line pointing at the old provider.
Heads up: do not judge by dig's exit code alone. The BIND 9 manual says a return code of 0 means a DNS response was received, and that includes NXDOMAIN.
On Windows, run the same query against your nameserver.
nslookup -type=CNAME promo.example.com ns1.example.comYou should no longer see the old target name in the answer.
Troubleshooting
The record is gone in cPanel but dig still shows it
Symptom: cPanel no longer lists the record, but dig through your normal resolver still returns the old target. Likely cause: caching for the length of the old TTL. Fix: query your nameserver directly with @ns1.example.com. If that is clean, wait one full TTL and test again.
GitHub Pages says the domain is not verified
Symptom: the domain shows as unverified in your Pages settings after a cleanup. Likely cause: the _github-pages-challenge-USERNAME TXT record was deleted or mistyped. Fix: restore it from your Step 1 copy, wait for DNS to update, check it with the dig command above, then return to the Pages settings and run verification again. GitHub says the DNS change can take up to 24 hours.
Mail stopped arriving after the cleanup
Symptom: messages to the domain bounce or vanish. Likely cause: an MX record, or a mail-related TXT or CNAME record, was removed by mistake. Fix: restore the exact record from your Step 1 file, then confirm with your email provider which records it needs before touching mail records again.
The subdomain shows content you never published
Symptom: a page, login form or redirect you do not recognise. Likely cause: the name may already have been claimed. Fix: delete the DNS record right away, then follow Microsoft's order: review your code for links to that name, investigate whether anything was exposed, and only then work out why the record was left behind.
Pro tips and security notes
Keep a small inventory: every subdomain, the service behind it, and the person who owns it. Microsoft recommends this kind of catalogue, along with regular reviews that confirm each target still exists and is yours.
Cookies deserve a word with your developer. Microsoft notes that web apps often share session cookies with all subdomains, so if your main site does that, any dangling subdomain is a bigger risk.
If you want a broader walk-through of the same problem, including tools beyond cPanel, our earlier guide on finding and deleting dangling DNS records covers it from another angle. New to how hosting fits together? Start with what web hosting is.
When to ask your host or a security professional
Ask your host if the zone is large, if you cannot tell where the live nameservers are, or if Zone Editor is missing. Hand them your Step 1 file and audit lines.
Bring in a security professional if you see content you did not publish, if logins or tokens may have reached the old subdomain, or if the domain handles payments. That is incident work, not tidying.
Your decommissioning checklist
Microsoft suggests adding "Remove DNS entry" to the required checks when you shut down a service. Here is a fuller version you can paste into your notes or ticket template.
- Name the service, the subdomain and the owner.
- Copy the current zone records, with the date in the file name.
- Optional: lower the TTL on the record a day ahead.
- Delete the DNS record in cPanel > Domains > Zone Editor.
- Check with
dig @ns1.example.comthat the record is gone. - Wait at least one full TTL.
- Remove the custom domain in the provider dashboard, for example Settings > Pages > Remove on GitHub.
- Delete or release the service itself.
- Search code and templates for the old name and remove it.
- Keep verification TXT records the provider tells you to keep, such as
_github-pages-challenge-USERNAME. - Update your inventory and note the date.
The one message worth forwarding
Copy this to your developer, agency or host.
"Hi, I am auditing the DNS zone for example.com for dangling records. I have copied every record and listed each CNAME with its target and owner. Before we shut down any service from now on, can we delete its DNS record first, wait for the TTL to expire, and only then delete the service? Could you also confirm which of the targets on my list still exist in accounts we control, and please do not remove the _github-pages-challenge TXT record. Thanks."
Every record in your zone is a sign pointing somewhere, so take the sign down before you hand back the keys.
Reader questions
How often should I audit my DNS zone for dangling records?
Microsoft recommends reviewing DNS records regularly to confirm each target still exists and belongs to you. A practical habit is a check every time you shut down a service, plus a scheduled review a few times a year.
Can I point a dangling CNAME somewhere else instead of deleting it?
Yes, if the name should keep working. Edit the record so it points at a resource you control. Delete it if nothing should live at that name any more.
Does verifying my domain on GitHub also protect its subdomains?
GitHub says that when you verify a domain, any immediate subdomains are also included in the verification. GitHub also warns that wildcard DNS records carry a takeover risk even if you verify the domain, so it strongly recommends against them.
Will Reset DNS Zone in cPanel clean up dangling records for me?
No. cPanel's documentation says Reset DNS Zone erases your zone changes, so it can remove records you still need. Delete the dead records one at a time instead.
If dig exits with code 0, does that mean the name exists?
No. The BIND 9 manual says a return code of 0 means a DNS response was received, and that includes an NXDOMAIN response. Read the status line in the output instead.
Are CloudFront CNAMEs at risk in the same way as S3 bucket names?
AWS says attackers cannot choose a CloudFront distribution name because AWS assigns it. A dangling CNAME could still resolve to another customer's content if that name is reassigned, so remove it all the same.
Why can't I see Zone Editor in my cPanel account?
Your host can turn the Zone Editor feature on or off in WHM's Feature Manager. Ask them to enable it or to make the DNS change for you.
Was this guide helpful?
Help us make the next update better.
Sources & further reading
- Microsoft Learn: Prevent dangling DNS entries and avoid subdomain takeover
- AWS Security Blog: Threat tactic spotlight, subdomain takeover
- GitHub Docs: Verifying your custom domain for GitHub Pages
- GitHub Docs: Managing a custom domain for your GitHub Pages site
- cPanel Docs: Zone Editor
- BIND 9 manual pages: dig
- Microsoft Learn: nslookup command reference
Originally published . About our editorial updates.



