Forgotten subdomains: how strangers can take over pages on your domain
Updated · by the Bologu team
Building with AI, you try lots of places: a deploy on Vercel, another on Netlify, a promo page on GitHub Pages hooked to promo.example.com. When you stop using one, you delete the project but forget the DNS record that points to it. That gap is called a subdomain takeover: anyone who creates a project with the same name on that service instantly gets a page served under your domain.
How it happens
Records like these keep pointing at a name on an outside service even after the project behind it was deleted:
blog.example.com CNAME my-old-blog.github.io ← repo already deleted
promo.example.com CNAME promo-2025.herokuapp.com ← app already deleted
files.example.com CNAME my-bucket.s3.amazonaws.com ← bucket already deletedMany services let anyone claim a free name, for example GitHub Pages, Heroku, Amazon S3, Azure, Vercel, Netlify, Surge, Ghost, Zendesk, Shopify. If the name is free, someone else can claim it and show their own content on your subdomain. Some services require proof that you own the domain first, which makes a takeover harder, but a dangling record should never stay anyway.
What a takeover can cost you
- Phishing on your real domain: customers see the correct domain and a valid HTTPS padlock, so they trust it and type passwords or card details.
- Stolen cookies from your main site: if your login cookie is set for
.example.com, a page on a taken-over subdomain can read or overwrite it. - Bypassing anything that trusts all subdomains: a CSP allowing
*.example.com, CORS that accepts any subdomain, or OAuth redirects allowed for any subdomain. - Your domain’s reputation: if someone hosts malware or a scam there, the whole domain can get blocked by Google Safe Browsing or social networks.
The worst case is an NS record pointing at a DNS server nobody manages anymore: whoever claims it controls every name under that subdomain.
Check it yourself in 10 minutes
- Open your DNS records: go to the DNS page of your domain provider (Cloudflare, Namecheap, GoDaddy, etc.) and look at every CNAME, A, AAAA and NS record.
- Find subdomains you forgot: search your domain on crt.sh to see every name that ever got an HTTPS certificate, including ones you no longer remember.
- Open each name: messages like
There isn't a GitHub Pages site here,No such app,NoSuchBucketorDEPLOYMENT_NOT_FOUNDmean the record is dangling. - Ask about each record: is it still used, and who looks after it? If you can’t answer, treat it as unused.
Fix it in the right order
- Delete the DNS record first, then the project, bucket or app at the service. Done the other way round, there is a window where the record points at a free name.
- If you want to keep the subdomain: point it at a project you own and still use, never at something that no longer exists.
- Drop wildcards you don’t need: in CSP, CORS and OAuth redirect lists, name the subdomains you actually use instead of
*.example.com. - Scope cookies narrowly: leave out
Domain=.example.comunless you need it, and use the__Host-prefix for login cookies. - Make it a habit: whenever you delete a project on any service, delete its DNS records the same day.
A prompt to have your AI go through your DNS
Export your DNS records (Cloudflare has an Export button) and send them with this prompt:
Here is the DNS zone export for my domain (pasted below).
For every CNAME, A and AAAA record:
1. Say which service it points to (Vercel, Netlify, GitHub Pages, Heroku, S3, Azure ...).
2. Ask me whether I still use that project. Do not guess.
3. For the ones I no longer use, give me the exact records to delete, in the order:
delete the DNS record first, then the project/bucket at the service.
Do not suggest creating anything at any service.Let Bologu check it
The deep scan (you verify you own the domain first) collects your subdomains from HTTPS certificate logs, checks the DNS of each one, and tells you which point at a service whose project was deleted, plus internal pages left open to outsiders by mistake. Bologu never claims or creates anything at those services; it only tells you which records to delete. The website scan (free) checks for weak CSP and cookie security settings.
Sources
Read next
- npm malware wave of 2026: why AI-built sites are at risk, and how to protect yours
- Next.js ships security patches almost monthly: which version you need now (Nov 2026)
- Lessons from Moltbook: a fully AI-built site that let anyone read and edit its database
- Security checklist before launching an AI-built website
- What is Supabase RLS, and how to check your customers' data isn't exposed
- API key leaked in your website: how to check, and what to do right away
- Secure your Claude Code, Codex and Cursor settings: stop clicking "allow all"
