Subdomain Takeover in AWS: making a PoC
Dangling DNS records pointed at Elastic Beanstalk environments that no longer existed, so anyone could register an environment with the same name in the same region and serve content on the company's subdomain. The author built a proof of concept that only responds on a secret path, and extended it to HTTPS by adding a listener and self-signed certificate.
Diego Bernal Adelantado Follow
Published on godiego.co
This post focuses on AWS subdomain takeovers and is the second part of my first post, https://godiego.tech/posts/STO-Azure/. While doing continuous recon I’ve come across some interesting domains that were vulnerable which have forced me to learn quite a bit about AWS and their different services.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the DNS record was left pointing at an Elastic Beanstalk environment that had been deleted, and the service allowed anyone to register an environment with the same name in the same region.
Impact
An attacker could serve their own content on the company's subdomain, which could be used to phish users or damage trust; the author notes the simple PoC only worked over HTTP until an HTTPS listener was added.
What the attacker needed
Dangling DNS record to the service; AWS account in the same region; ability to claim the same name
The fix
The dangling DNS records should be removed or repointed so they no longer reference deleted cloud resources.
How it was found
- Check that the subdomain returns NXDOMAIN and follows the Elastic Beanstalk naming pattern.
- In the AWS console for the matching region, start creating a web server environment.
- Try to use the dangling domain as the environment name; success means it is vulnerable.
- Choose a platform stack and upload a source code zip.
- Confirm the environment health is Ok and that DNS now resolves to an EC2 instance.
- Add a listener on port 443 with a self-signed certificate and a matching process so the PoC also works over HTTPS.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When a company points a subdomain at a cloud service and later deletes that service, the DNS record can be left behind pointing at nothing. If the cloud provider lets anyone claim that same name again, an attacker can take over the subdomain and serve their own page on it. This is called a subdomain takeover.
What is Subdomain takeover?
A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.