blog

Shut down an old cloud server? Check its DNS record went with it

If you've ever shut down a cloud server but left its DNS record in place, someone else may be able to pick up that address and use it as your subdomain. Research published yesterday shows how cheap it is to do.

The fix is boring and quick: go through your DNS records and delete anything that points at a server you no longer have.

What happened

On 24 November the security firm Intruder published research on dangling DNS records. The setup is one most of us will recognise. You give a subdomain such as portal.yourbusiness.co.uk an A record pointing at an AWS Elastic IP (a fixed public address you rent from Amazon). Years later the server goes, the Elastic IP is released back to AWS, and the DNS record stays where it was.

AWS hands released addresses out again. So Intruder rented addresses in bulk, kept any that matched a live DNS record on its list, and released the rest. It says it got through 450,000 addresses in 48 hours before AWS blocked the account, at about "$3 per valid takeover".

It found 28 live takeovers on domains covered by bug bounty programmes, and reported them through those programmes.

Intruder says AWS sees this as a matter of "customer-side DNS records" and doesn't plan to change anything. That seems fair to me. AWS can't know which of your records are stale. Only you can.

Why it matters

Whoever holds the address controls what your subdomain shows. Intruder points out that they can "get a trusted TLS certificate for the domain", so visitors see the padlock and your real domain name. That's a very convincing phishing page.

There are two quieter risks too. Old scripts or integrations that still send data to that subdomain will now send it to a stranger. And if your main site sets cookies for the whole domain, the browser will send them to every subdomain, including the one you've lost.

The research is about AWS, but the habit behind it isn't tied to one provider. MDN's page on subdomain takeovers covers the other common version: a CNAME pointing at a hosted service you've since cancelled.

Does it affect you?

You're the audience for this if any of these sound familiar:

  • You've moved your website or app to a new host and the old one was in the cloud.
  • Someone once set up a staging site, a test portal or a "beta" subdomain, and it's long gone.
  • A previous developer or agency set up servers you've never really seen.
  • You pointed a subdomain at a third-party tool (a help desk, a shop, a landing page builder) and later stopped paying for it.

If your DNS has three records and you know exactly what each one does, you're probably fine. The longer a domain has been around, and the more people have worked on it, the more likely there's something left behind.

What to do this week

1. Get a list of every DNS record. Log in wherever your DNS is hosted (often your domain registrar or Cloudflare) and export the zone, or just copy the list. If you're not sure who controls your DNS, start with who owns your domain name.

2. Find the subdomains you've forgotten. Search for your domain on crt.sh. It lists the certificates issued for your domain, which is a handy record of names that have existed over the years.

3. Check each A record against what you actually own. For anything pointing at AWS, list the Elastic IPs you still hold in each region you use:

aws ec2 describe-addresses --region eu-west-2 --query 'Addresses[].PublicIp'

Then check what each subdomain resolves to with dig +short portal.yourbusiness.co.uk. If a record points at an address that isn't in your account, it's dangling. Delete it.

4. Check your CNAMEs as well. For each one, ask whether you still pay for the service it points at. If not, delete it.

5. Change the order you shut things down in. MDN's advice is to start "by removing DNS records first", then turn off the server. Put that on whatever checklist you use for moving hosts. If you used the one in my post on moving a website without breaking email, add it as the last step.

The bigger point

Nothing here needs special tools. It's housekeeping: knowing what you have and tidying up after yourself. The trouble is that DNS gets touched once every few years, by whoever was around at the time, and nobody owns the list.

The fiddly cases are old integrations. If a bespoke system still sends orders or files to a subdomain nobody remembers setting up, the team at Dev Partners look after existing software and can trace where it's sending things and update it. Their post on keeping, fixing or replacing legacy software is worth a read if that system has more loose ends than this one.

And if you'd like someone to look your server over properly and tell you what needs fixing first, that's what my health check is for.