How i hijacked 12 Subdomains in one Program
Several subdomains of the target had dangling DNS records pointing at AWS Elastic Beanstalk environments that no longer existed, so anyone could create a new environment with the same name and claim them. The author claimed 12 subdomains in total and served their own proof-of-concept page from them.
Published on nvk0x.medium.com
There was a Facebook notification “8 new certificates for redacted.com or its subdomain were issued by ##########”
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.
Context
This is a subdomain takeover write-up against a private bug bounty program, referred to throughout as redacted.com. The asset class is DNS records that point at cloud services the owner no longer controls. In this case the dangling records pointed at AWS Elastic Beanstalk environments in the us-east-1 region. When a DNS record still points at a cloud resource that has been released, anyone who can create a resource with the same name in the same region can claim it and serve content under the victim's subdomain.
The researcher, Naveen Kumawat (@nvk0x), had reported a couple of bugs to the same program three months earlier, so the domain was already familiar ground.
Setup
The work was done from a VPS. The tooling was a custom recon script that:
- enumerates subdomains;
- resolves all of them with
massdns; - checks for
NXDOMAINstatus on dangling DNS records of subdomains pointing to Azure and Elastic Beanstalk services.
Anything that survives the automated pass is then checked by hand, because the script only flags candidates: the researcher still has to confirm that the Azure or Elastic Beanstalk instance behind the record is actually available to claim.
On the cloud side, an AWS account with access to the us-east-1 region is needed to attempt the claim. No specific tool versions are given in the report.
Finding it
On the morning of 4 March the researcher woke up to a Facebook notification:
8 new certificates for redacted.com or its subdomain were issued by ##########

The notification said that new certificates had been issued for the domain or its subdomains. That was the trigger to start reconnaissance on the program again, and the recon script was fired at redacted.com from the VPS.

After five to six hours a notification arrived saying Recon completed for redacted.com. Going through vulnerable.txt, there were 14 subdomains that could be vulnerable. All of their dangling DNS records pointed to AWS Elastic Beanstalk instances in the us-east region.
Exploitation
Step 1: Create an Elastic Beanstalk environment in the matching region
The researcher opened the AWS Console in us-east-1 and started the environment creation process. Elastic Beanstalk offers two types of environment, and the web server environment is the one to select.

Step 2: Try to use the dangling domain for the environment
The final check for whether a subdomain is actually vulnerable is whether the dangling DNS domain can be used for the new environment. If the name is still free, the environment creation accepts it.

Step 3: Claim every instance that is available
Checking the 14 instances one by one, 11 of them were available to claim. All 11 were claimed and a proof of concept page was uploaded.

As an alternative way to generate the PoC, the report notes that CodePipeline can be connected to the Elastic Beanstalk instance.
All the claimed subdomains then served the researcher's PoC page.

Step 4: Repeat after the next certificate alert
Two days later another notification arrived: 3 new certificates for redacted.com or its subdomain were issued by ##########. The same quick recon script was run again: enumerate subdomains, resolve with massdns, check for subdomain takeovers, and write the vulnerable subdomains to vulnerable.txt.
This time one further subdomain, also pointing to AWS Elastic Beanstalk in us-east-1, could be taken over. That was one further subdomain taken over, after the 11 from the first pass.
Root cause
The DNS records for the subdomains still pointed at Elastic Beanstalk environments that no longer existed, so the names were free for anyone to register in the same region. The report does not describe how the environments came to be deleted or why the DNS records were left behind. The automated check only looks for NXDOMAIN on records pointing at Azure and Elastic Beanstalk, and the manual step confirms the instance can be claimed; nothing on the victim side prevented a third party from creating an environment with the dangling name.
Impact
An attacker who claims these names controls the content served on the victim's subdomains. In this case 11 of 14 candidates were claimable in the first pass and one more in the second, and the researcher demonstrated control by serving a PoC page on each. The report does not go into what else could be done from a claimed subdomain, such as cookie scoping or phishing, and does not state a severity or bounty amount; it only shows $$$$.
Fix
The report does not say what the program changed. The general fix for this class is to remove or update DNS records as soon as the cloud resource behind them is deleted, and to keep an inventory that ties each record to a live resource.
Variants to test
- Run the same
NXDOMAINcheck against records pointing at other cloud providers, not just Azure and Elastic Beanstalk. A positive result is a subdomain whose DNS record resolves to a provider endpoint that no longer exists. - Attempt to create the resource with the dangling name in the same region as the original. A positive result is the provider accepting the name and the subdomain then serving your content.
- Watch certificate transparency notifications for the target and re-run recon after each batch of new certificates. A positive result is new subdomains appearing in
vulnerable.txtthat were not there before. - Use CodePipeline connected to the Elastic Beanstalk instance as an alternative PoC path. A positive result is the pipeline deploying content that appears on the claimed subdomain.
What happened, in plain words
A company owns a website, redacted.com, and many smaller addresses under it, called subdomains, such as shop.redacted.com or login.redacted.com. Some of those subdomains were set up to point at a service run by Amazon, specifically a product called Elastic Beanstalk. Later the company stopped using those Amazon environments, but the pointers (DNS records) that told the internet where to find them were never cleaned up. Those leftover pointers are called dangling DNS records.
Because the Amazon environment behind a pointer no longer existed, the name was free. Anyone with an Amazon account could create a new environment with that same name in the same region, and then the company's subdomain would start showing whatever that person put there. This is called a subdomain takeover. The researcher, Naveen Kumawat (@nvk0x), found 14 subdomains that looked like candidates, managed to claim 11 of them in one go, and then claimed one more two days later.
To follow the story you only need a few ideas:
- A subdomain is a name that sits in front of the main domain, like a room number in front of a building address.
redacted.comis the building,blog.redacted.comis a room in it. - DNS is the internet's address book. When you type a name into your browser, DNS tells the browser which server to talk to. A DNS record is one line in that address book.
- A dangling DNS record is an address book line that points at a place that no longer exists. It is like a forwarding address for a shop that has closed: mail sent there goes nowhere, and anyone who opens a new shop at that address receives it.
- AWS (Amazon Web Services) is Amazon's cloud platform, a set of rented computers and services. Elastic Beanstalk is one of those services: it lets you run a web application without managing the servers yourself. A region is the physical location of the data centre, for example
us-east-1. - Certificate transparency is a public log of every security certificate issued for websites. Certificates are what make the padlock appear in your browser. Services watch this log and alert you when new certificates appear for your domain, which is a useful early warning that someone is poking around.
- A VPS (virtual private server) is a rented computer in a data centre that you control remotely, often used to run tools that take a long time.
- Reconnaissance (recon) means gathering information about a target before attacking it: which subdomains exist, which services they use, and so on.
Context
This is a subdomain takeover write-up against a private bug bounty program. A bug bounty program is a scheme where a company invites independent researchers to look for security problems and pays them for reporting them responsibly. The company's real name is hidden here and replaced with redacted.com.
The asset class in question is DNS records that point at cloud services the owner no longer controls. In this case the dangling records pointed at AWS Elastic Beanstalk environments in the us-east-1 region. When a DNS record still points at a cloud resource that has been released, anyone who can create a resource with the same name in the same region can claim it and serve content under the victim's subdomain.
The researcher had reported a couple of bugs to the same program three months earlier, so the domain was already familiar ground. That matters because knowing a target saves time: you already know which tools work and roughly what the company runs.
Setup
The work was done from a VPS. The tooling was a custom recon script that:
- enumerates subdomains;
- resolves all of them with
massdns; - checks for
NXDOMAINstatus on dangling DNS records of subdomains pointing to Azure and Elastic Beanstalk services.
Each step in plain words:
- Enumerating subdomains means producing a list of every name that might exist under the domain, for example by trying common words (
mail,dev,test) or by reading public sources. You cannot check a subdomain you do not know about. - Resolving means asking DNS what address a name points to.
massdnsis a tool built to do this for very large lists of names very quickly, because doing it one at a time in a browser would take forever. NXDOMAINis the answer DNS gives when a name does not exist at all. In this context the script is looking for a specific pattern: a subdomain whose record points at a cloud provider (Azure or Elastic Beanstalk) but where the target behind it no longer exists. That combination is the signature of a possible takeover.
Anything that survives the automated pass is then checked by hand, because the script only flags candidates: the researcher still has to confirm that the Azure or Elastic Beanstalk instance behind the record is actually available to claim. Think of the script as a metal detector on a beach: it beeps, but you still have to dig to see whether there is anything there.
On the cloud side, an AWS account with access to the us-east-1 region is needed to attempt the claim. No specific tool versions are given in the report.
Finding it
On the morning of 4 March the researcher woke up to a Facebook notification:
8 new certificates for redacted.com or its subdomain were issued by ##########

The image shows the Facebook notification about the new certificates.
The notification said that new certificates had been issued for the domain or its subdomains. That was the trigger to start reconnaissance on the program again, and the recon script was fired at redacted.com from the VPS. The reasoning is simple: if new certificates are being issued, someone (possibly the company, possibly an attacker) is setting up new names, and new names are exactly where fresh mistakes appear.

The image shows a dangling DNS record for one of the subdomains, the kind of result the script produces.
After five to six hours a notification arrived saying Recon completed for redacted.com. Going through vulnerable.txt, there were 14 subdomains that could be vulnerable. vulnerable.txt is simply a text file where the script writes the names it suspects. All of their dangling DNS records pointed to AWS Elastic Beanstalk instances in the us-east region.
Exploitation
Step 1: Create an Elastic Beanstalk environment in the matching region
The researcher opened the AWS Console in us-east-1 and started the environment creation process. The AWS Console is the web interface where you click around to manage Amazon services, so no programming is needed for this part. The region has to match, because cloud names are only unique within a region: a name free in us-east-1 may be taken in another region, and the DNS record points at one specific region.
Elastic Beanstalk offers two types of environment, and the web server environment is the one to select. A web server environment is the kind that runs a website and answers browser requests, which is what you need if you want to prove you can serve a page on the subdomain.

The image shows the screen where the environment type is selected.
Step 2: Try to use the dangling domain for the environment
The final check for whether a subdomain is actually vulnerable is whether the dangling DNS domain can be used for the new environment. If the name is still free, the environment creation accepts it. This is the moment of truth: the cloud provider itself tells you whether the old environment is really gone.

The image shows the dangling DNS domain being entered for the new environment.
Step 3: Claim every instance that is available
Checking the 14 instances one by one, 11 of them were available to claim. All 11 were claimed and a proof of concept page was uploaded. A proof of concept (PoC) page is a harmless page you put up to demonstrate that you control the content, without doing anything damaging.

The image shows the proof of concept page being uploaded.
As an alternative way to generate the PoC, the report notes that CodePipeline can be connected to the Elastic Beanstalk instance. CodePipeline is another Amazon service that automates deploying code; connecting it to the environment is simply a different route to getting your page published.
All the claimed subdomains then served the researcher's PoC page.

The image shows a claimed subdomain displaying the proof of concept page.
Step 4: Repeat after the next certificate alert
Two days later another notification arrived: 3 new certificates for redacted.com or its subdomain were issued by ##########. The same quick recon script was run again: enumerate subdomains, resolve with massdns, check for subdomain takeovers, and write the vulnerable subdomains to vulnerable.txt. The lesson is that this is not a one-off job: every time new names appear, the check has to run again.
This time one further subdomain, also pointing to AWS Elastic Beanstalk in us-east-1, could be taken over. That was one further subdomain taken over, after the 11 from the first pass.
Root cause
The DNS records for the subdomains still pointed at Elastic Beanstalk environments that no longer existed, so the names were free for anyone to register in the same region. The report does not describe how the environments came to be deleted or why the DNS records were left behind. The automated check only looks for NXDOMAIN on records pointing at Azure and Elastic Beanstalk, and the manual step confirms the instance can be claimed; nothing on the victim side prevented a third party from creating an environment with the dangling name.
A useful comparison: it is like cancelling a phone contract but leaving the number printed on your business cards. Anyone who gets that number next will receive calls meant for you.
Impact
An attacker who claims these names controls the content served on the victim's subdomains. In this case 11 of 14 candidates were claimable in the first pass and one more in the second, and the researcher demonstrated control by serving a PoC page on each. The report does not go into what else could be done from a claimed subdomain, such as cookie scoping or phishing, and does not state a severity or bounty amount; it only shows $$$$.
Fix
The report does not say what the program changed. The general fix for this class is to remove or update DNS records as soon as the cloud resource behind them is deleted, and to keep an inventory that ties each record to a live resource. In everyday terms: when you close a shop, cancel the forwarding address on the same day, and keep a list that says which address belongs to which shop.
Variants to test
- Run the same
NXDOMAINcheck against records pointing at other cloud providers, not just Azure and Elastic Beanstalk. A positive result is a subdomain whose DNS record resolves to a provider endpoint that no longer exists. - Attempt to create the resource with the dangling name in the same region as the original. A positive result is the provider accepting the name and the subdomain then serving your content.
- Watch certificate transparency notifications for the target and re-run recon after each batch of new certificates. A positive result is new subdomains appearing in
vulnerable.txtthat were not there before. - Use CodePipeline connected to the Elastic Beanstalk instance as an alternative PoC path. A positive result is the pipeline deploying content that appears on the claimed subdomain.
Glossary
- Subdomain: a name placed in front of a main domain, such as
blog.redacted.com, used to separate parts of a website. - DNS: the internet's address book, which translates names into the addresses of servers.
- DNS record: one entry in that address book, saying where a name should point.
- Dangling DNS record: a record that points at a cloud resource which no longer exists, leaving the name free to be claimed.
- Subdomain takeover: claiming a subdomain by registering the abandoned cloud resource its DNS record still points at, then serving your own content there.
- AWS: Amazon Web Services, Amazon's cloud platform of rented computing services.
- Elastic Beanstalk: an AWS service for running web applications without managing servers directly.
- Region: a physical data centre location for cloud services, for example
us-east-1. - Azure: Microsoft's cloud platform, mentioned as another provider whose records the script checked.
- Certificate: a digital document that proves a website's identity and enables the padlock in the browser.
- Certificate transparency: a public log of issued certificates, used to spot new certificates for a domain.
- VPS: virtual private server, a rented computer in a data centre controlled remotely.
- Reconnaissance (recon): gathering information about a target before testing it.
- Enumeration: producing a list of items, here the subdomains that exist under a domain.
- Resolving: asking DNS which address a name points to.
massdns: a tool for resolving very large lists of names quickly.NXDOMAIN: the DNS answer meaning the requested name does not exist.vulnerable.txt: the text file where the recon script writes suspected subdomains.- AWS Console: the web interface for managing Amazon cloud services.
- Web server environment: an Elastic Beanstalk environment type that runs a website and answers browser requests.
- Proof of concept (PoC) page: a harmless page uploaded to demonstrate control of a subdomain.
- CodePipeline: an AWS service that automates deploying code, usable as an alternative way to publish a PoC.
- Bug bounty program: a scheme where a company pays researchers for responsibly reporting security problems.
- Private bug bounty program: a program open only to invited researchers, with the company's identity often hidden.
- Severity: a rating of how serious a vulnerability is.
- Bounty: the money paid for a valid report.