Skip to content
Subdomain takeover Write-up Intermediate

How I hacked thousand of subdomains

A subdomain pointed to a Freshdesk service, and the signup process lacked server-side validation, allowing an attacker to claim the subdomain. The attacker could then take over the subdomain and potentially serve malicious content.

MoSec Follow

Published on medium.com

Bounty$5,000 View original

in march 0f 2021, I continued my hunting and I invested my time in subdomain finding and subdomain takeover,

MoSec, on 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. 6 min read.

Context

In March 2021 the author spent their hunting time on subdomain discovery and subdomain takeover (STO). Subdomain takeover is described here as a low hanging fruit, but finding the vulnerable subdomain is the hard part. The write-up is about a takeover on a Freshdesk-backed subdomain, and the researcher later used the same technique to find the issue on thousands of subdomains across bug bounty scopes and the top one million Alexa sites.

The target in the narrative is a subdomain found during recon on one of the author's targets. The DNS record pointed at Freshdesk, a SaaS helpdesk product. The feature involved is the Freshdesk signup flow, which required verification before the domain could be used. After signing up, the author saw that verification is required, which blocked the obvious takeover.

Setup

The author's workflow relied on a few tools and resources:

  1. Aquatone for recon, producing screenshots of every discovered subdomain.
  2. The can-i-take-over-xyz repository, used to check quickly whether a given engine is known to be vulnerable to STO. The author says they looked at it every time they found a different subdomain engine.
  3. The blog at https://0xpatrik.com/ as a learning resource on subdomain takeover.
  4. Google Apps Toolbox (https://toolbox.googleapps.com/) to look up the CNAME of a suspicious subdomain.
  5. Burp as the intercepting proxy for inspecting and manipulating requests.
  6. Subjack, used after the finding to scan for vulnerable subdomains at scale.
the repo that helps you in STO From the original on medium.com

The screenshot shows the takeover reference repository the author used to check engines.

No account details, versions or specific target names beyond the disclosed Zomato report are given.

Finding it

After Aquatone finished on one of the targets, the author reviewed every subdomain screenshot, as they did every day. One subdomain returned a weird response. They looked it up in Google Apps Toolbox to see its CNAME, and it was:

Text
TARGET: spfmx.domainkey.freshdesk.com.
a subdomain with a weird response From the original on medium.com

The screenshot shows the subdomain with the odd response that prompted the CNAME lookup.

A CNAME pointing at a Freshdesk host is the shape of a potential takeover, which is why the author investigated it.

The author notes that this time they did not go to the can-i-take-over-xyz repo to check whether Freshdesk was listed as vulnerable. They say that if they had, they would have stopped where others stopped, because the repo would have told them it was not vulnerable.

Exploitation

Step 1: Follow the signup flow

The author clicked the signup link on the Freshdesk page served through the subdomain.

signup From the original on medium.com

The screenshot shows the signup page reached from the subdomain.

After signing up, it was clear that a straightforward takeover was not possible, because verification is required.

not possible to takeover it From the original on medium.com

The screenshot shows the verification requirement that blocks the obvious takeover.

At this point the author decided to look at how the requests flowed through Burp. The stated principle is that you have to be curious, guess everything, play with the input and read the documentation until you understand how it works; if you can understand it, you can hack it better. The described curiosity loop, applied to a single request, is:

  1. How does the front end handle this request? Answer it practically, for example with response manipulation.
  2. How will the backend process a different request?
  3. What happens when the HTTP method changes, for example PUT to DELETE?
  4. What happens when headers change?
  5. What happens when the body type is converted?
  6. Observe each response until the behaviour is clear, then make it do something it was not designed for.

Step 2: Manipulate the request

After playing with the flow for a few minutes, the author succeeded.

I did it From the original on medium.com

The screenshots show the successful takeover.

The author describes the cause as a missing server-side validation: anyone with a Burp proxy could capture and manipulate the request and perform the takeover. The exact request, the parameter that was changed and the response are not reproduced in the write-up; the video proof of concept is linked at https://youtu.be/9CISKSddHl4.

Or watch on YouTube
From the original on medium.com

Step 3: Confirm the disclosed precedent

The author points to a disclosed HackerOne report as the same class of issue:

Zomato disclosed on HackerOne: subdomain takeover on fddkim.zomato.com

Our subdomain fddkim.zomato.com was vulnerable to a 0-day subdomain takeover vulnerability on Freshdesk. The DNS entry…

Step 4: Scale the finding

The next day the author made a fingerprint and started using Subjack to find vulnerable subdomains. They scanned the whole bug bounty scope and also scanned the top one million Alexa websites. Thousands of subdomains were vulnerable to this zero-day, including:

  • dhl.com
  • stackoverflow.com
  • raspberrypi.org
  • avast.com
  • imperva.com
  • joebiden.com

and many more well-known websites. The author submitted more than 10 reports and earned 5k in total reward.

Root cause

The author attributes the issue to a missing server-side validation. The signup flow required verification, which stopped the obvious takeover, but the author found a missing server-side validation that allowed the takeover. In other words, the check that should have been enforced on the server could be avoided by editing the request in transit.

Why the existing defences did not stop it: the public knowledge base said Freshdesk was not vulnerable, so hunters who checked can-i-take-over-xyz first would not have tested further. The author's own comment is that if they had visited the repo and read the threads on Freshdesk, they would not have found this zero-day. A triager's response, quoted in the write-up, was:

congratulations on finding a bypass on what many people thought was not possible

From the original on medium.com

Impact

Anyone with a Burp proxy could capture and manipulate the request and perform the takeover. The author found thousands of subdomains vulnerable to this zero-day, including the well-known domains listed above, and was paid 5k in total across more than 10 reports. The write-up does not state which specific hosts were taken over, nor the per-report amounts.

Fix

The write-up does not describe a fix applied by Freshdesk. Based on the described cause, the fix should be to enforce the domain verification on the server side for every request in the signup and domain-mapping flow, so that manipulating the request cannot skip it. The author's broader advice is to dig deeper than others rather than stopping at the public vulnerability lists.

Variants to test

  1. SaaS domain mappings with a verification step: sign up, capture the verification request in Burp, and try removing or altering the verification parameter, changing the HTTP method, or converting the body type. A positive result is the SaaS side accepting the domain mapping and serving your content on the victim's hostname.
  2. CNAMEs to helpdesk and support platforms: enumerate CNAMEs with a DNS lookup tool, then check whether the platform allows claiming the hostname without proof of ownership. A positive result is a page you control resolving at the victim's subdomain.
  3. Engines marked as not vulnerable in public takeover lists: test them anyway, since the lists reflect what has been reported, not what is possible. A positive result is a takeover that the list says should not work.
  4. Bulk scanning: build a fingerprint for the engine and run Subjack across the scope and large domain lists. A positive result is a list of subdomains whose CNAME points at the engine and which are unclaimed.
  5. Request tampering on any signup or onboarding flow: replay the request with modified parameters, headers and methods and compare responses. A positive result is a state change the UI said was not possible.

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. 11 min read.

What happened, in plain words

In March 2021, a security researcher spent their hunting time looking for two related things: subdomains and subdomain takeovers. A subdomain is a smaller name that sits under a main domain. If example.com is the main site, then shop.example.com or help.example.com are subdomains. Companies often point these subdomains at outside services instead of running everything themselves.

A subdomain takeover happens when a company points a subdomain at an outside service and someone else can claim that name on the service. If the outside service lets anyone claim the name, an attacker can register it and start serving their own pages on the company's subdomain. The researcher calls this a low hanging fruit, meaning it is a known and relatively simple class of bug. The hard part, they say, is finding the subdomain that is actually vulnerable.

The story is about a takeover on a subdomain that pointed at Freshdesk. Freshdesk is a helpdesk product sold as a service: a company signs up, and Freshdesk gives it a support portal. After signing up, the researcher saw that verification is required, which blocked the obvious takeover.

The researcher found one subdomain that behaved oddly, checked where it pointed, and saw Freshdesk. The obvious takeover attempt was blocked by a verification step. Instead of stopping there, they watched the signup requests in a proxy tool and found a missing server-side validation. They then made a fingerprint and scanned the whole bug bounty scope and the top one million Alexa websites. Thousands of subdomains were affected, including several well-known companies, and the researcher submitted more than 10 reports and earned 5k in total.

The toolkit and why each piece was used

The workflow relied on a handful of tools and resources:

  1. Aquatone, for reconnaissance. Reconnaissance (recon) means gathering information about a target before attacking it. Aquatone takes screenshots of every subdomain it finds, so you can look at many sites quickly instead of visiting each one.
  2. The can-i-take-over-xyz repository, a public list that records which online services are known to be vulnerable to subdomain takeover. The researcher checked it every time they came across a different service behind a subdomain.
  3. The blog at https://0xpatrik.com/, used as a learning resource about subdomain takeover.
  4. Google Apps Toolbox at https://toolbox.googleapps.com/, a set of lookup tools. Here it was used to see the CNAME of a suspicious subdomain. A CNAME is a DNS record that says "this name is an alias for that other name". DNS is the system that turns names like example.com into the addresses computers use to find each other. So a CNAME tells you which outside service a subdomain is really pointing at.
  5. Burp, short for Burp Suite, an intercepting proxy. A proxy sits between your browser and the website and lets you pause, read and edit the requests and responses. It is the main tool for this kind of testing.
  6. Subjack, a scanner that looks for subdomains pointing at services that can be taken over. It was used after the initial finding, to search at scale.
the repo that helps you in STO From the original on medium.com

The screenshot shows the takeover reference repository the researcher used to check which services are known to be vulnerable.

The write-up does not give account details, software versions or the name of the original target beyond the Zomato report it links to later.

Finding the suspicious subdomain

After Aquatone finished on one of the targets, the researcher went through every subdomain screenshot, as they did every day. One subdomain returned a strange response. They looked it up in Google Apps Toolbox to see its CNAME, and it was:

Text
TARGET: spfmx.domainkey.freshdesk.com.

This line is the result of the CNAME lookup. TARGET is the label the lookup tool uses for the destination, and spfmx.domainkey.freshdesk.com. is the hostname the subdomain points at. The trailing dot is normal in DNS and simply marks the end of the full name. In plain words: the subdomain was an alias for a Freshdesk host.

a subdomain with a weird response From the original on medium.com

The screenshot shows the subdomain with the odd response that prompted the CNAME lookup.

A CNAME pointing at Freshdesk is the shape of a possible takeover, which is why the researcher investigated it. Think of it like a shop that moved out but left its sign above the door: if the landlord hands the keys to anyone who asks, a stranger can put their own goods in the window under the old name.

The researcher notes that this time they did not check the can-i-take-over-xyz repository to see whether Freshdesk was listed as vulnerable. They say that if they had, they would have stopped where others stopped, because the list would have told them it was not vulnerable.

Trying the obvious route first

Step 1: Follow the signup flow

The researcher clicked the signup link on the Freshdesk page served through the subdomain.

signup From the original on medium.com

The screenshot shows the signup page reached from the subdomain.

After signing up, it was clear that a simple takeover was not possible, because verification is required.

not possible to takeover it From the original on medium.com

The screenshot shows the verification requirement that blocks the obvious takeover.

At this point the researcher decided to look at how the requests travelled through Burp. The principle they state is that you have to be curious, guess everything, play with the input and read the documentation until you understand how it works. If you can understand it, you can hack it better. The curiosity loop they describe, applied to a single request, is:

  1. How does the front end handle this request? Answer it practically, for example by manipulating the response. The front end is the part that runs in your browser; the response is what the server sends back.
  2. How will the backend process a different request? The backend is the server-side software that does the real work.
  3. What happens when the HTTP method changes, for example PUT to DELETE? The HTTP method is the verb at the start of a request that says what you want to do: GET to fetch something, POST to send data, PUT to replace something, DELETE to remove it.
  4. What happens when headers change? Headers are the extra lines of information attached to a request or response, such as what kind of data is being sent.
  5. What happens when the body type is converted? The body is the part of the request that carries the actual data, and it can be formatted in different ways, for example as a form or as JSON.
  6. Observe each response until the behaviour is clear, then make it do something it was not designed for.

Step 2: Manipulate the request

After playing with the flow for a few minutes, the researcher succeeded.

I did it From the original on medium.com

The screenshots show the successful takeover.

The researcher describes the cause as a missing server-side validation. Validation means checking that input is acceptable. Server-side means the check is done on the server, where the user cannot reach it. The researcher describes the cause as a missing server-side validation, so anyone with a Burp proxy could capture and manipulate the request and do the takeover. The exact request, the parameter that was changed and the response are not reproduced in the write-up. The video proof of concept is linked at https://youtu.be/9CISKSddHl4.

Or watch on YouTube
From the original on medium.com

Step 3: Confirm the disclosed precedent

The researcher points to a disclosed HackerOne report describing the same class of issue:

Zomato disclosed on HackerOne: subdomain takeover on fddkim.zomato.com

Our subdomain fddkim.zomato.com was vulnerable to a 0-day subdomain takeover vulnerability on Freshdesk. The DNS entry…

HackerOne is a platform where researchers report bugs to companies. A disclosed report is one the company has agreed to make public. A 0-day (zero-day) is a flaw that was not publicly known before, so no fix or warning existed for it.

Step 4: Scale the finding

The next day the researcher made a fingerprint and started using Subjack to find vulnerable subdomains. A fingerprint is a pattern that identifies a particular service, for example a distinctive page or response that tells you "this is Freshdesk". They scanned the whole bug bounty scope and also scanned the top one million Alexa websites. The scope is the set of targets a bug bounty programme allows you to test. Alexa was a public ranking of popular websites. Thousands of subdomains were vulnerable to this zero-day, including:

  • dhl.com
  • stackoverflow.com
  • raspberrypi.org
  • avast.com
  • imperva.com
  • joebiden.com

and many more well-known websites. The researcher submitted more than 10 reports and earned 5k in total reward.

Why it worked

The researcher attributes the issue to a missing server-side validation. The signup flow required verification, which stopped the obvious takeover, but the request could be captured and manipulated because a server-side validation was missing. In other words, the check that should have been enforced on the server could be avoided by editing the request on its way there.

Why the existing defences did not stop it: the public knowledge base said Freshdesk was not vulnerable, so hunters who checked can-i-take-over-xyz first would not have tested further. The researcher's own comment is that if they had visited the repository and read the threads on Freshdesk, they would not have found this zero-day. A triager's response, quoted in the write-up, was:

congratulations on finding a bypass on what many people thought was not possible

A triager is the person at the bug bounty programme who reviews incoming reports and decides whether they are valid.

From the original on medium.com

What an attacker could do with it

Anyone with a Burp proxy could capture and manipulate the request and perform the takeover. Phishing means building a fake page that looks trustworthy so people hand over passwords or payment details. Cookies are small pieces of data a site stores in your browser, often to keep you logged in; if a cookie is valid across the whole parent domain, a page on a taken-over subdomain may be able to read or use it. Reputational damage means harm to the company's name and trust.

The researcher found thousands of subdomains vulnerable to this zero-day, including the well-known domains listed above, and was paid 5k in total across more than 10 reports. The write-up does not state which specific hosts were taken over, nor the amount paid for each report.

How to fix it

Based on the described cause, the fix should be to enforce the domain verification on the server side for every request in the signup and domain-mapping flow, so that manipulating the request cannot skip it. The researcher's broader advice is to dig deeper than others rather than stopping at the public vulnerability lists.

Things to try yourself

  1. Services that map your own domain with a verification step: sign up, capture the verification request in Burp, and try removing or altering the verification parameter, changing the HTTP method, or converting the body type. A positive result is the service accepting the domain mapping and serving your content on the victim's hostname.
  2. CNAMEs to helpdesk and support platforms: list CNAMEs with a DNS lookup tool, then check whether the platform lets someone claim the hostname without proof of ownership. A positive result is a page you control appearing at the victim's subdomain.
  3. Services marked as not vulnerable in public takeover lists: test them anyway, since the lists reflect what has been reported, not what is possible. A positive result is a takeover the list says should not work.
  4. Bulk scanning: build a fingerprint for the service and run Subjack across the scope and large domain lists. A positive result is a list of subdomains whose CNAME points at the service and which nobody has claimed.
  5. Request tampering on any signup or onboarding flow: replay the request with modified parameters, headers and methods and compare the responses. A positive result is a change in state that the interface said was not possible.

Glossary

  • Subdomain: a smaller name under a main domain, such as help.example.com under example.com.
  • Subdomain takeover (STO): claiming a subdomain that points at an outside service the owner no longer uses, so you can serve your own content on it.
  • Reconnaissance (recon): gathering information about a target before testing it.
  • DNS: the system that translates names like example.com into the addresses computers use.
  • CNAME: a DNS record that says one name is an alias for another name.
  • Freshdesk: a helpdesk product sold as a service, where customers can connect their own domain to a support portal.
  • SaaS: software sold as a service and used over the internet, rather than installed on your own machines.
  • Aquatone: a reconnaissance tool that takes screenshots of discovered subdomains.
  • can-i-take-over-xyz: a public repository listing which services are known to be vulnerable to subdomain takeover.
  • Google Apps Toolbox: a set of online lookup tools, used here to check a subdomain's CNAME.
  • Burp (Burp Suite): an intercepting proxy that lets you pause, read and edit requests and responses between browser and server.
  • Proxy: software that sits between two parties and passes traffic through, optionally letting you inspect or change it.
  • HTTP method: the verb at the start of a request, such as GET, POST, PUT or DELETE, saying what you want to do.
  • Header: an extra line of information attached to a request or response, such as the data type being sent.
  • Body: the part of a request that carries the actual data.
  • JSON: a common text format for structured data.
  • Front end: the part of a site that runs in your browser.
  • Backend: the server-side software that does the real work.
  • Response: what the server sends back after a request.
  • Server-side validation: a check performed on the server, where the user cannot edit it.
  • Verification: proving that you own or control something, such as a domain, before a service acts on it.
  • Fingerprint: a pattern that identifies a particular service from its responses.
  • Scope: the set of targets a bug bounty programme allows you to test.
  • Bug bounty programme: a scheme where companies pay researchers for reporting security bugs.
  • HackerOne: a platform where researchers report bugs to companies.
  • Disclosed report: a bug report the company has agreed to make public.
  • 0-day (zero-day): a flaw that was not publicly known before it was found, so no fix or warning existed.
  • Triager: the person at a bug bounty programme who reviews reports and decides whether they are valid.
  • Phishing: building a fake page that looks trustworthy so people hand over passwords or payment details.
  • Cookie: a small piece of data a site stores in your browser, often to keep you logged in.
  • Alexa: a public ranking of popular websites, used here as a large list of domains to scan.

More by MoSec

View all

1 more disclosed report, 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.