Skip to content
Subdomain takeover Write-up Intermediate

Subdomain takeover Starbucks

A Starbucks subdomain was involved in a subdomain takeover case, though the source text does not detail the service or attacker content.

Patrik Hudak Follow

Published on 0xpatrik.com

Bounty$2,000 View original

This post is the write-up about bug bounty report that I reported back in March 2018 to Starbucks. The report is now disclosed, and I was awarded $2,000 bounty.

Patrik Hudak, on 0xpatrik.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. 3 min read.

Context

This is a write-up of a bug bounty report I submitted to Starbucks in March 2018. The report is now disclosed and I was awarded a $2,000 bounty. I have written about subdomain takeover in multiple posts before, but this case was somehow different.

HackerOne Report
HackerOne Report From the original on 0xpatrik.com

The domain in question was svcgatewayus.starbucks.com. It pointed to a non-existing resource in Microsoft Azure. I realised I had never talked about Microsoft Azure as a potential vector for subdomain takeover.

Setup

Azure provides multiple services. I look for two primary services:

  • Azure Websites: .azurewebsites.net
  • Cloud Apps: .cloudapp.net

The most significant difference compared to CloudFront and other similar services is that Azure provides a dedicated IP address to both of these services. The provided subdomain points to it using an A record. In other words, Azure does not utilise a virtual hosts setup (as I described previously). This means that for a potential subdomain takeover, you only need to look for the DNS status being NXDOMAIN.

There are lots of misconceptions about when subdomain takeover for Azure is possible. I recommend running a simple dig command:

dig -t A DOMAIN_TO_CHECK

Is the response status NXDOMAIN? If yes, great, the takeover might be possible. Note that receiving a 404 HTTP error does not mean the subdomain takeover is possible at all. As I said before, the services have dedicated VPS. For successful subdomain takeover, the DNS request should always return NXDOMAIN.

Finding it

The subdomain in the report pointed to 1fd05821-7501-40de-9e44-17235e7ab48b.cloudapp.net. I needed to create a PoC, which was a little bit tricky.

Exploitation

The rough guideline of how I did it follows.

Step 1: Create a new Cloud Service

I created a new Cloud Service in the portal. It asks for a custom domain name. Remember: this domain name needs to match since you are not dealing with virtual host anymore. You can confirm this theory by noticing that Cloud Service never asks for a domain name which you will use for CNAME.

Step 2: Create a Storage Account

I created a Storage Account for the Cloud Service in the Azure portal.

Step 3: Deploy the application

Azure requires a specific format for deployment of Cloud Services which is generated by Visual Studio. I created a simple ASP.NET web application and uploaded it to this Cloud Service using this tutorial.

Step 4: Verify the takeover

Because of DNS, the A record for svcgatewayus.starbucks.com is pointing to Azure, and so the HTTP request returns the content from the ASP.NET application I just deployed.

For Azure Websites, the process is much more straightforward and looks closer to traditional PaaS. To create a PoC for Azure Websites, I recommend this tutorial. I tested that, and it works correctly.

I have to say that I find the Azure portal very messy. In my humble opinion it is a lot more complex than AWS with no significant benefits.

Azure offers several other services with a different structure, subdomains, and PoC process that I will cover in one of the future posts.

Patrik

Buy Me A Coffee
Buy Me A Coffee From the original on 0xpatrik.com

Root cause

The root cause is that the DNS A record for svcgatewayus.starbucks.com pointed to an Azure Cloud Service (1fd05821-7501-40de-9e44-17235e7ab48b.cloudapp.net) that no longer existed. Because Azure assigns a dedicated IP address to each Cloud Service and does not use virtual hosts, the only condition for takeover is that the DNS lookup returns NXDOMAIN. An attacker can then create a new Cloud Service whose custom domain name matches the abandoned one. A 404 HTTP error does not mean the takeover is possible; the DNS lookup must return NXDOMAIN.

Impact

The takeover is possible only if the DNS record points to a non-existing Azure resource and returns NXDOMAIN.

Fix

The report does not state what fix was applied. In general, the fix is to remove or update the stale DNS record so that it no longer points to a non-existing Azure resource.

Variants to test

  • Check other subdomains that point to Azure services (.azurewebsites.net, .cloudapp.net) for NXDOMAIN status. A positive result is a NXDOMAIN response from dig -t A.
  • For Azure Websites, the process is much more straightforward and closer to traditional PaaS.

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

What happened, in plain words

This is the story of a bug bounty report I sent to Starbucks in March 2018. A bug bounty is a programme where a company pays people outside the company for finding and reporting security problems. The report is now public, and I was paid a $2,000 bounty, which is the reward for the finding. I had written about subdomain takeover in several earlier posts, but this case was somehow different.

HackerOne Report
HackerOne Report From the original on 0xpatrik.com

To follow the story you need one idea: what a subdomain is. A domain name is the address people type to reach a website, like starbucks.com. A subdomain is a name placed in front of it, like shop.starbucks.com or svcgatewayus.starbucks.com. Companies use subdomains to give different services their own names while keeping the main brand in the address. Because the subdomain still belongs to the company, visitors trust it.

A subdomain takeover happens when a company points a subdomain at some outside service, then stops using that service but forgets to remove the pointer. If someone else can claim the abandoned service under the same name, that person now controls what visitors see at the company's subdomain. It is like a shop that moves out but leaves its sign and address on the door: anyone who rents the empty unit inherits the customers who walk in.

The domain in question was svcgatewayus.starbucks.com. It pointed to a resource in Microsoft Azure that no longer existed. Azure is Microsoft's cloud platform: a service where you rent computers and other resources over the internet instead of owning them. I realised I had never talked about Microsoft Azure as a possible route to subdomain takeover.

Setup

Azure offers many different services. I look for two main ones:

  • Azure Websites, whose addresses end in .azurewebsites.net
  • Cloud Apps, whose addresses end in .cloudapp.net

These endings are the shared address space Azure gives to customers. When a company uses one of these services, its own subdomain is pointed at the Azure address.

The most important difference from CloudFront and similar services is that Azure gives each of these services a dedicated IP address. An IP address is the numeric address of a machine on the internet, the way a street number identifies a building. The company's subdomain points to that number using an A record. A DNS record is an entry in the internet's address book, and an A record is the entry that maps a name to an IP address. DNS, the Domain Name System, is that address book: it turns names people can read into numbers computers use.

In other words, Azure does not use a virtual hosts setup. Virtual hosting is when one machine at one IP address serves many different websites and decides which one to show based on the name the visitor asked for, like a receptionist in a shared office building directing visitors by company name. Azure instead gives each service its own address, so there is no receptionist to ask. This means that for a possible subdomain takeover, you only need to look for the DNS status being NXDOMAIN. NXDOMAIN means "no such domain": the address book has no entry for that name at all.

There are lots of misconceptions about when subdomain takeover for Azure is possible. I recommend running a simple dig command:

dig -t A DOMAIN_TO_CHECK

dig is a small command-line tool that asks DNS servers questions and prints the answers. Here is what each part does:

  • dig is the name of the tool being run.
  • -t A says the question is about an A record, the name-to-IP-address entry.
  • DOMAIN_TO_CHECK is a placeholder for the name you want to look up; you replace it with the real subdomain.

Is the response status NXDOMAIN? If yes, great, the takeover might be possible. Note that receiving a 404 HTTP error does not mean the subdomain takeover is possible at all. A 404 is the web server's way of saying "I am here, but I have nothing at this page". That is a different situation: the machine answered. As I said before, the services have dedicated IPs. For a successful subdomain takeover, the DNS request should always return NXDOMAIN, meaning nothing answers for that name at all.

Finding it

The subdomain in the report pointed to 1fd05821-7501-40de-9e44-17235e7ab48b.cloudapp.net. That long string is the name Azure gave to a particular Cloud Service. I needed to create a PoC, which was a little bit tricky. A PoC, or proof of concept, is a small demonstration that shows a problem is real rather than theoretical: here, actually taking control of the name and serving my own page from it.

Exploitation

The rough guideline of how I did it follows.

Step 1: Create a new Cloud Service

I created a new Cloud Service in the portal. A portal here is the Azure website where customers manage their resources. It asks for a custom domain name. Remember: this domain name needs to match, since you are not dealing with virtual hosts anymore. You can confirm this theory by noticing that Cloud Service never asks for a domain name which you will use for a CNAME. A CNAME is another kind of DNS record that points one name at another name instead of at an IP address. If Azure were using virtual hosting, it would need to know which name visitors would type so it could route them; because it hands out a dedicated address instead, the name it asks for is the one that must match the abandoned service.

Step 2: Create a Storage Account

I created a Storage Account for the Cloud Service in the Azure portal. A Storage Account is Azure's space for holding files and data for a service.

Step 3: Deploy the application

Azure requires a specific format for deployment of Cloud Services, which is generated by Visual Studio. Visual Studio is Microsoft's program for writing software. I created a simple ASP.NET web application and uploaded it to this Cloud Service using this tutorial. ASP.NET is a framework for building websites on Microsoft's platform, and deploying means putting the finished application onto the service so it can be served to visitors.

Step 4: Verify the takeover

Because of DNS, the A record for svcgatewayus.starbucks.com is pointing to Azure, and so the HTTP request returns the content from the ASP.NET application I just deployed. In plain terms: the address book still sends anyone who types the Starbucks subdomain to that Azure address, and now that address is mine, so visitors see my page.

For Azure Websites, the process is much more straightforward and looks closer to traditional PaaS. PaaS, platform as a service, is a cloud offering where the provider manages the underlying machines and you just upload your application. To create a PoC for Azure Websites, I recommend this tutorial. I tested that, and it works correctly.

I have to say that I find the Azure portal very messy. In my humble opinion it is a lot more complex than AWS with no significant benefits. AWS is Amazon's cloud platform, a competitor to Azure.

Azure offers several other services with a different structure, subdomains, and PoC process that I will cover in one of my future posts.

Patrik

Buy Me A Coffee
Buy Me A Coffee From the original on 0xpatrik.com

Root cause

The root cause is that the DNS A record for svcgatewayus.starbucks.com pointed to an Azure Cloud Service (1fd05821-7501-40de-9e44-17235e7ab48b.cloudapp.net) that no longer existed. Because Azure assigns a dedicated IP address to each Cloud Service and does not use virtual hosts, the only condition for takeover is that the DNS lookup returns NXDOMAIN. An attacker can then create a new Cloud Service whose custom domain name matches the abandoned one. A 404 HTTP error does not mean the takeover is possible; the DNS lookup must return NXDOMAIN. A stale record is one left behind after the thing it pointed to was removed, like a forwarding address for someone who has moved away.

Impact

Phishing is tricking people into handing over information by showing them a page that looks genuine, and it works far better when the address bar shows a name the victim trusts. The takeover is possible only if the DNS record points to a non-existing Azure resource and returns NXDOMAIN.

Fix

The report does not state what fix was applied. In general, the fix is to remove or update the stale DNS record so that it no longer points to a non-existing Azure resource.

Variants to test

  • Check other subdomains that point to Azure services (.azurewebsites.net, .cloudapp.net) for NXDOMAIN status. A positive result is a NXDOMAIN response from dig -t A.
  • For Azure Websites, the process is much more straightforward and closer to traditional PaaS.

Glossary

  • Bug bounty: a programme that pays people outside a company for reporting security problems.
  • Bounty: the reward paid for a valid report.
  • Subdomain: a name placed in front of a main domain, such as svcgatewayus.starbucks.com under starbucks.com.
  • Subdomain takeover: gaining control of a subdomain because it points at an outside service that was abandoned and can be claimed by someone else.
  • Azure: Microsoft's cloud platform for renting computing resources over the internet.
  • Cloud service: a resource rented from a cloud provider rather than run on your own machines.
  • IP address: the numeric address of a machine on the internet.
  • A record: a DNS entry that maps a name to an IP address.
  • DNS: the Domain Name System, the internet's address book that turns names into addresses.
  • DNS record: a single entry in that address book.
  • Virtual hosts: one machine at one address serving many websites and choosing which to show based on the requested name.
  • NXDOMAIN: a DNS answer meaning no such domain exists.
  • dig: a command-line tool for asking DNS servers questions.
  • HTTP 404: a web server's answer meaning the page was not found, though the server itself is reachable.
  • PoC (proof of concept): a small demonstration that a problem is real.
  • Portal: a website where cloud resources are managed.
  • CNAME: a DNS record that points one name at another name instead of at an IP address.
  • Storage Account: Azure's space for holding files and data for a service.
  • Visual Studio: Microsoft's program for writing software.
  • ASP.NET: a framework for building websites on Microsoft's platform.
  • Deployment: putting a finished application onto a service so it can be served.
  • PaaS (platform as a service): a cloud offering where the provider manages the machines and you upload your application.
  • AWS: Amazon's cloud platform.
  • Stale record: a DNS entry left behind after the resource it pointed to was removed.
  • Phishing: tricking people into giving up information by showing them a page that looks genuine.
  • Malware: harmful software.

More by Patrik Hudak

View all

2 more disclosed reports, best first.

More from Starbucks

View all

The newest disclosed reports for this program.

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.