Skip to content
Subdomain takeover Write-up Intermediate

Subdomain Takeover in Azure Trafficmanager for Fun & Profit

Three subdomains pointed via CNAME to unregistered Azure Traffic Manager profiles, allowing an attacker to register those profiles and serve content under the company's domain. The author successfully took over the subdomains and hosted a proof-of-concept page.

Padsala Tushal Follow

Published on padsalatushal.medium.com

In the dynamic world of cybersecurity, where vulnerabilities lurk in unexpected corners, the concept of subdomain takeovers has become a compelling arena for exploration. This article delves into a real-world scenario involving the Company’s infrastructure, unraveling the intricacies of subdomain takeovers within…

Padsala Tushal, on padsalatushal.medium.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Subdomain takeover happens when a DNS record, usually a CNAME, points at a service endpoint that nobody has claimed. If an attacker can register that endpoint under the same name, the attacker's content is served from the victim's subdomain. This write-up covers a real engagement against a private Bugcrowd program with a large scope, where three subdomains were found pointing at unregistered Azure Traffic Manager profiles.

The service involved is Azure Traffic Manager, Microsoft's DNS-based traffic routing service. A Traffic Manager profile gets a DNS name of the form <profile>.trafficmanager.net, and a customer's own subdomain is pointed at it with a CNAME. If the profile is deleted or never created while the CNAME remains, the name is free for anyone with an Azure account to register.

The author notes that the fundamentals seemed clear: identify a dangling domain, claim it, and show a proof of concept. In practice the execution was more intricate, and documentation on taking over Azure Traffic Manager specifically was scarce, which is the reason for publishing the process.

Setup

The work was done against a private target on Bugcrowd with a huge scope and many assets. The researcher used a VPS, both to run recon and later to host the proof of concept. The tools used were:

  • subfinder and assetfinder for subdomain enumeration
  • httpx for HTTP probing
  • dig for checking DNS records
  • the Azure portal, to register Traffic Manager profiles
  • an HTTP server on the VPS serving the PoC code

Preconditions for the takeover are an Azure account able to create a Traffic Manager profile with the exact name referenced by the dangling CNAME, and a host to point the profile's endpoint at.

Finding it

The domains in scope were collected into a file and enumeration was started with subfinder and assetfinder:

Bash
subfinder -dL domains.txt -all -recursive -o subs.txtcat domains.txt | assetfinder --subs-only | tee -a subs2.txt

subfinder reads the domain list from domains.txt with -dL, uses all sources with -all, recurses with -recursive, and writes to subs.txt. assetfinder is fed the same domain list and its subdomain-only output is appended to subs2.txt.

The two result files were then combined, deduplicated and probed over HTTP with httpx:

Bash
cat subs.txt subs2.txt | sort -u | tee -a all-subs.txtcat all-subs.txt | httpx | tee -a live-subs.txt

sort -u removes duplicates into all-subs.txt, and httpx filters the list down to hosts that answer over HTTP, saved in live-subs.txt.

While checking the live subdomains manually, the researcher found three that returned 404. A 404 from a host that is still resolving is a classic sign of a dangling service, so dig was run on them. The three records were:

  • securemftpptemp.target.com -> azsu-tm-core-ngfw-emftpreprod-002.trafficmanager.net
  • securemfttemp.target.com -> azsu-tm-core-ngfw-emft-002.trafficmanager.net
  • ukras1.target.com -> azsu-tm-c-eucprod-infra-pulse-test.trafficmanager.net

Each victim subdomain was a CNAME to a trafficmanager.net name. The researcher checked the can-i-take-over-xyz list to see whether these were known to be vulnerable, but that project has no documentation on taking over the trafficmanager.net service. A quick Google search turned up an article on taking over Azure services, which described the approach used here.

The conclusion was that the domain points to a Traffic Manager CNAME that does not seem to be registered. To confirm, the researcher went to the Azure portal and tried to register it.

From the original on padsalatushal.medium.com

The screenshot accompanies the step where the researcher went to the Azure portal and tried registering the profile.

Exploitation

Step 1: Register the Traffic Manager profile

In the Azure portal, a Traffic Manager profile was created with the same name as the one in the dangling CNAME, for example azsu-tm-core-ngfw-emftpreprod-002. The researcher registered the profile in the Azure portal, which the report treats as the confirmation step.

Step 2: Point the profile at attacker-controlled content

After the profile was registered, its outgoing endpoint was set to the VPS IP address, where an HTTP server was running with the PoC code. The profile's outgoing endpoint was set to the VPS IP, where an HTTP server served the PoC code.

Step 3: Verify DNS

After a few minutes, dig was run again to check that the record now resolved through the newly registered profile.

From the original on padsalatushal.medium.com

The screenshot accompanies the second dig run, made a few minutes after the endpoint was set.

Step 4: Verify the subdomain

The subdomain was then checked and it worked.

From the original on padsalatushal.medium.com

The screenshot accompanies the check of the subdomain.

Step 5: Repeat and report

The same process was repeated for the other two subdomains, and the findings were reported to the private Bugcrowd program.

Root cause

The victim's DNS zone kept a CNAME pointing at a Traffic Manager profile name that was not registered, The victim's DNS zone kept a CNAME pointing at a Traffic Manager profile name that was not registered.. The researcher was able to register the unclaimed profile name in the Azure portal. The dangling CNAME remained in the victim's DNS zone, and claiming the profile let the researcher serve content on the subdomain.

Impact

An attacker who claims the profile controls the content served on the victim's subdomain. In this engagement the PoC was a simple page on the researcher's VPS, and the report does not describe any further use of the takeover. The practical consequences depend on where the subdomain is used: any cookie scoped to the parent domain, links or emails that reference the subdomain, and any trust users place in the domain would be exposed to the attacker's content. The report does not state which of these applied to the three subdomains.

Fix

After the report, the program changed the state to Triaged and then Resolved. The general fix for this class of issue is to remove or repoint DNS records whose Traffic Manager profile no longer exists, and to delete DNS records as part of decommissioning the corresponding Azure resource.

Variants to test

  • Enumerate subdomains with subfinder and assetfinder, probe with httpx, and look for hosts returning 404 or other error pages while still resolving. A positive result is a host that returns an error page while still resolving.
  • Run dig on each suspicious host and look for CNAME records to *.trafficmanager.net. A positive result is a CNAME to a trafficmanager.net name.
  • Try registering the exact profile name in the Azure portal. A positive result is the Azure portal allowing the profile to be registered.
  • After registering, set the endpoint to a controlled host and re-run dig and a browser request to the victim subdomain. A positive result is the victim subdomain serving the controlled content.

Timeline

Date Event
01/12/2023 Discovered and took over the subdomains
02/12/2023 Reported to Bugcrowd
05/12/2023 State changed to Triaged
08/12/2023 State changed to Resolved

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

Imagine you rent a flat and, when you move out, you leave a sign on the front door that says "post goes to 12 Other Street". If nobody ever rents 12 Other Street, anyone can move in there and start receiving your post, and the postman will still deliver it to the address on your door. That is roughly what a subdomain takeover is, and this article is about finding three of them.

A company owns a domain, for example target.com, and gives parts of it out as subdomains, such as securemfttemp.target.com. Each subdomain is a name that has to point somewhere. Often it points at a service run by someone else, such as a cloud provider. The pointer is called a CNAME record, and it lives in the company's DNS zone, which is the list that says which name goes where.

If the company stops using the cloud service but forgets to remove the pointer, the pointer is left dangling. Anyone who can claim the same name at the cloud provider can then put their own content behind the company's subdomain. Visitors see the company's address, but the page comes from the attacker.

In this case the cloud service was Azure Traffic Manager, a Microsoft service that routes traffic by DNS. A Traffic Manager profile gets a name like <profile>.trafficmanager.net, and a customer points their own subdomain at it with a CNAME. If the profile is deleted or never created while the CNAME stays, the name is free for anyone with an Azure account to register.

The author says the idea seemed simple: find a dangling domain, claim it, show a proof of concept. In practice it was more intricate, and there was little documentation on taking over Azure Traffic Manager specifically, which is why the process was written up.

Setting up

The work was done against a private target on Bugcrowd, a platform where companies invite researchers to test their systems. The scope was large, with many assets. The researcher used a VPS, which is a rented computer on the internet that you control, both to run the reconnaissance and later to host the proof of concept.

The tools used were:

  • subfinder and assetfinder, to find subdomains
  • httpx, to check which of them answer over HTTP
  • dig, to look up DNS records
  • the Azure portal, the website where you manage Azure services, to register Traffic Manager profiles
  • an HTTP server on the VPS serving the PoC code

Two things are needed before a takeover like this is possible: an Azure account that can create a Traffic Manager profile with the exact name the dangling CNAME points at, and a host to point the profile's endpoint at.

Finding it

The domains in scope were collected into a file and enumeration was started with subfinder and assetfinder:

Bash
subfinder -dL domains.txt -all -recursive -o subs.txtcat domains.txt | assetfinder --subs-only | tee -a subs2.txt

Line by line:

  • subfinder -dL domains.txt runs subfinder, a tool that searches public sources for subdomains. -dL tells it to read the list of domains from the file domains.txt.
  • -all uses every source it has, and -recursive makes it look for subdomains of subdomains too.
  • -o subs.txt writes the results to subs.txt.
  • cat domains.txt prints the domain list, and the | sends that output into the next command.
  • assetfinder --subs-only is a second subdomain finder, told to output only subdomains.
  • tee -a subs2.txt shows the output on screen and also appends it to subs2.txt.

The two result files were then combined, deduplicated and probed over HTTP with httpx:

Bash
cat subs.txt subs2.txt | sort -u | tee -a all-subs.txtcat all-subs.txt | httpx | tee -a live-subs.txt

Line by line:

  • cat subs.txt subs2.txt prints both result files one after the other.
  • sort -u sorts the lines and removes duplicates, so each name appears once.
  • tee -a all-subs.txt shows the combined list and appends it to all-subs.txt.
  • cat all-subs.txt | httpx feeds the combined list to httpx, a tool that tries to connect to each host over HTTP and reports which ones answer.
  • tee -a live-subs.txt saves those live hosts to live-subs.txt.

While checking the live subdomains by hand, the researcher found three that returned 404. A 404 is the "page not found" answer a web server gives. Getting a 404 from a host that still resolves in DNS is a classic sign of a dangling service: the name exists, but nothing real is behind it. So dig was run on them. dig is a command that asks DNS what a name points to. The three records were:

  • securemftpptemp.target.com -> azsu-tm-core-ngfw-emftpreprod-002.trafficmanager.net
  • securemfttemp.target.com -> azsu-tm-core-ngfw-emft-002.trafficmanager.net
  • ukras1.target.com -> azsu-tm-c-eucprod-infra-pulse-test.trafficmanager.net

Each victim subdomain was a CNAME to a trafficmanager.net name. The researcher checked the can-i-take-over-xyz list, a public list of services known to be takeable over, to see whether these were known to be vulnerable. That project has no documentation on taking over the trafficmanager.net service. A quick Google search turned up an article on taking over Azure services, which described the approach used here.

The conclusion was that the domain points to a Traffic Manager CNAME that does not seem to be registered. To confirm, the researcher went to the Azure portal and tried to register it.

From the original on padsalatushal.medium.com

The screenshot accompanies the step where the researcher went to the Azure portal and tried registering the profile.

Exploitation

Step 1: Register the Traffic Manager profile

In the Azure portal, a Traffic Manager profile was created with the same name as the one in the dangling CNAME, for example azsu-tm-core-ngfw-emftpreprod-002. The researcher registered the profile in the Azure portal, which the report treats as the confirmation step. Think of it like trying to open an account under a username: if the name is taken, the system says no, and if it goes through, the name was free.

Step 2: Point the profile at attacker-controlled content

After the profile was registered, its outgoing endpoint was set to the VPS IP address, where an HTTP server was running with the PoC code. An endpoint here is simply the destination the profile sends traffic to. The profile's outgoing endpoint was set to the VPS IP, where an HTTP server served the PoC code.

Step 3: Verify DNS

After a few minutes, dig was run again to check that the record now resolved through the newly registered profile.

From the original on padsalatushal.medium.com

The screenshot accompanies the second dig run, made a few minutes after the endpoint was set.

Step 4: Verify the subdomain

The subdomain was then checked and it worked.

From the original on padsalatushal.medium.com

The screenshot accompanies the check of the subdomain.

Step 5: Repeat and report

The same process was repeated for the other two subdomains, and the findings were reported to the private Bugcrowd program.

Why it worked

The victim's DNS zone kept a CNAME pointing at a Traffic Manager profile name that was not registered, The victim's DNS zone kept a CNAME pointing at a Traffic Manager profile name that was not registered.. The researcher was able to register the unclaimed profile name in the Azure portal. The dangling CNAME remained in the victim's DNS zone, and claiming the profile let the researcher serve content on the subdomain.

What it means

An attacker who claims the profile controls the content served on the victim's subdomain. In this engagement the PoC was a simple page on the researcher's VPS, and the report does not describe any further use of the takeover. The practical consequences depend on where the subdomain is used: any cookie scoped to the parent domain, links or emails that reference the subdomain, and any trust users place in the domain would be exposed to the attacker's content. A cookie is a small piece of data a website stores in your browser, and if it is scoped to the parent domain it can be sent to the subdomain too. The report does not state which of these applied to the three subdomains.

The fix

After the report, the program changed the state to Triaged and then Resolved. Triaged means the report was accepted as valid and passed on for fixing. The general fix for this class of issue is to remove or repoint DNS records whose Traffic Manager profile no longer exists, and to delete DNS records as part of decommissioning the corresponding Azure resource. In the flat analogy, take the sign off the door when you move out.

Other places to look

  • Enumerate subdomains with subfinder and assetfinder, probe with httpx, and look for hosts returning 404 or other error pages while still resolving. A positive result is a host that returns an error page while still resolving.
  • Run dig on each suspicious host and look for CNAME records to *.trafficmanager.net. A positive result is a CNAME to a trafficmanager.net name.
  • Try registering the exact profile name in the Azure portal. A positive result is the Azure portal allowing the profile to be registered.
  • After registering, set the endpoint to a controlled host and re-run dig and a browser request to the victim subdomain. A positive result is the victim subdomain serving the controlled content.

Timeline

Date Event
01/12/2023 Discovered and took over the subdomains
02/12/2023 Reported to Bugcrowd
05/12/2023 State changed to Triaged
08/12/2023 State changed to Resolved

Glossary

  • Subdomain: a name that sits under a main domain, such as securemfttemp.target.com under target.com.
  • DNS: the internet's address book, which turns names into the addresses of the servers behind them.
  • DNS zone: the collection of records that say which names in a domain point where.
  • CNAME record: a DNS record that says "this name is another name for that name", pointing one name at another.
  • Dangling record: a DNS record that still points at a service that no longer exists or is no longer owned.
  • Subdomain takeover: claiming a service name that a victim's DNS record still points at, so your content is served under the victim's subdomain.
  • Azure: Microsoft's cloud platform.
  • Azure Traffic Manager: a Microsoft service that routes traffic by DNS, giving each profile a name like <profile>.trafficmanager.net.
  • Profile: a named Traffic Manager configuration that owns one of those trafficmanager.net names.
  • Endpoint: the destination a Traffic Manager profile sends traffic to.
  • VPS: a rented computer on the internet that you control.
  • HTTP server: software that answers web requests, serving pages to browsers.
  • PoC: proof of concept, a small demonstration that a vulnerability is real.
  • 404: the "page not found" answer a web server gives.
  • dig: a command that asks DNS what a name points to.
  • subfinder: a tool that finds subdomains from public sources.
  • assetfinder: a tool that finds subdomains and related assets.
  • httpx: a tool that checks which hosts answer over HTTP.
  • Bugcrowd: a platform where companies invite researchers to test their systems.
  • Triaged: a report state meaning the report was accepted as valid and passed on for fixing.
  • Resolved: a report state meaning the issue was fixed.
  • Cookie: a small piece of data a website stores in your browser and sends back on later requests.
  • can-i-take-over-xyz: a public list of services known to be takeable over.

More by Padsala Tushal

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Subdomain takeover

The lesson behind this report.

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.