Subdomain Takeover Via Insecure CloudFront Distribution cdn.grab.com
A subdomain of the target was pointed via a CNAME to an unclaimed CloudFront distribution, allowing the reporter to register that distribution and serve content on the subdomain. An attacker could host phishing pages or steal cookies scoped to the parent domain.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 27 hours
- Paid in 27 hours
- Disclosed after 2.8 years
Good day, I truly hope it treats you awesomely on your side of the screen :)
I have found that your website cdn.grab.com is pointed via a cname to a cloudfront instance
cdn.grab.com => *.cloudfront.net
This was not registered on Amazon Aws Cloudfront.
I was able to take over the domain:
See my POC (Pug of Concept) http://cdn.grab.com/index.html
Options How to fix:
-
Remove the Cname record on cdn.grab.com to not point to cloudfront.net
-
Ask me to remove my registered cdn.grab.com on cloudfront, and you can re register yours :)
May you be well on your side of the screen :)
-Eric
Impact
Impact:
Cyber attackers can launch a phishing campaign leveraging your established (soon to be impacted) brand reputation.
The victim has no way of telling, whether the content is served by the domain owner or the cyber attacker.
Attackers can also chain higher severity attacks to this. Many applications expose session cookies to a wildcard domain (*.example.com), so any subdomain can access them. An attacker can take a forgotten subdomain, trick the user to visit it, and extract cookies (even those with secure flag). This can be seen as an advanced version of XSS.
Context
Grab runs services under *.grab.com, and one of its subdomains, cdn.grab.com, was intended to serve content from a CDN. The report concerns a dangling DNS record: the subdomain was configured as a CNAME pointing at a CloudFront distribution, but the corresponding distribution was not registered on Amazon CloudFront. When a CNAME points at a CloudFront hostname that nobody has claimed, anyone with an AWS account can create a distribution that answers for that hostname, and the DNS record will then resolve to the attacker's distribution.
Setup
No credentials, roles or special tooling are described in the report. The precondition is the dangling CNAME itself: a subdomain whose CNAME target is a CloudFront hostname that is not currently claimed by any distribution.
Finding it
The researcher noticed that cdn.grab.com was pointed via a CNAME to a CloudFront instance:
cdn.grab.com => *.cloudfront.net
The target hostname was not registered on Amazon AWS CloudFront. A CNAME to a CloudFront hostname only works while a distribution claims that hostname; if no distribution does, the name is free for anyone to register. That mismatch between the DNS record and the absence of a backing distribution is what made the subdomain look wrong.
Exploitation
Step 1: Confirm the dangling CNAME
The researcher observed the CNAME from cdn.grab.com to a *.cloudfront.net hostname and confirmed that no CloudFront distribution was registered for it. This is the condition that makes takeover possible: the DNS record still points at CloudFront, but nothing on CloudFront answers for that hostname.
Step 2: Register the hostname on CloudFront
The researcher registered cdn.grab.com on CloudFront, so that their distribution would answer for the CNAME target. The report does not describe the distribution settings used.
Step 3: Serve content from the subdomain
With the distribution in place, requests to cdn.grab.com resolved to the researcher's CloudFront distribution, and the researcher was able to take over the domain. The proof of concept is a page served from the subdomain:
http://cdn.grab.com/index.html
The researcher offered that URL as the proof of concept.
Root cause
The mistake is a dangling DNS record: cdn.grab.com was a CNAME to a CloudFront hostname that no distribution had registered. CloudFront hostnames are only bound to a distribution while one claims them, so an unclaimed name can be registered by anyone.
Impact
The researcher describes the following impact. Cyber attackers can launch a phishing campaign leveraging the established brand reputation of the domain. The victim has no way of telling whether the content is served by the domain owner or by the attacker.
Attackers can also chain higher severity attacks to this. Many applications expose session cookies to a wildcard domain (*.example.com), so any subdomain can access them. An attacker can take a forgotten subdomain, trick the user into visiting it, and extract cookies, even those with the secure flag. The researcher frames this as an advanced version of XSS.
Fix
The researcher proposed two options:
- Remove the CNAME record on
cdn.grab.comso that it no longer points tocloudfront.net. - Ask the researcher to remove the registered
cdn.grab.comon CloudFront, after which the owner can re-register their own distribution.
The report does not state which option was applied.
Variants to test
- Look for subdomains whose CNAME points at a CloudFront hostname with no active distribution. A positive result is that you can register the hostname on CloudFront and serve content from the subdomain.
- Apply the same pattern to other cloud providers that bind hostnames to customer resources (for example, other CDN or hosting services). A positive result is that the provider lets you claim the hostname and the target's DNS record resolves to your resource.
- Check forgotten subdomains that are still referenced by applications. A positive result is that the subdomain resolves to attacker-controlled content while remaining within the wildcard cookie scope.
Hunting notes
This kind of bug hides in DNS records that point at a cloud hostname nobody has claimed. During recon, a CNAME to a cloud provider hostname is the signal to check whether the target hostname is still claimed; if it is not, the record is dangling. The researcher pointed to a proof-of-concept URL on cdn.grab.com and explained the cookie-exposure chain through the wildcard domain.
What happened, in plain words
Grab is a company that runs many websites and services under its own domain name, grab.com. One of those names, cdn.grab.com, pointed at a content delivery network, or CDN. A CDN is a service that stores copies of your files on servers all over the world so that visitors get them quickly from somewhere nearby. Amazon CloudFront is one such CDN.
To make cdn.grab.com point at CloudFront, Grab used a DNS record called a CNAME. DNS is the internet's address book: it translates a name a human can read, like cdn.grab.com, into the address of a machine that can answer. A CNAME is a special entry that says "this name is really just another name, go look that one up instead". Grab's CNAME said, in effect, "cdn.grab.com is really a CloudFront hostname, ask CloudFront".
The problem: on CloudFront's side, nobody had actually claimed that hostname. CloudFront hostnames only work while a customer's distribution (CloudFront's word for a configured CDN setup) is attached to them. If no distribution claims the name, the name is free, and anyone with an Amazon Web Services (AWS) account can create a distribution that answers for it. The researcher did exactly that and was able to take over the domain.
This class of bug is called a subdomain takeover. The everyday comparison: imagine a shop that puts a sign on its door saying "we have moved to unit 12 in the mall". If unit 12 is empty and anyone can rent it, a stranger can move in and customers who follow the sign will think they are still dealing with the shop. The sign (the DNS record) is genuine; the destination is not.
Context
Grab runs services under *.grab.com. The * is a wildcard: it stands for "any subdomain", so cdn.grab.com, mail.grab.com and so on all fall under it. One of those subdomains, cdn.grab.com, was meant to serve content from a CDN.
The report is about a dangling DNS record. "Dangling" means the record still exists and still points somewhere, but the thing it points at is no longer owned by the organisation. Here the subdomain was configured as a CNAME pointing at a CloudFront distribution, but the corresponding distribution was not registered on Amazon CloudFront. When a CNAME points at a CloudFront hostname that nobody has claimed, anyone with an AWS account can create a distribution that answers for that hostname, and the DNS record will then resolve to the attacker's distribution.
Setup
The researcher needed nothing beyond an AWS account able to create a CloudFront distribution, and the ability to observe DNS resolution for cdn.grab.com. Observing DNS resolution means simply looking up what a name points to, which any browser or command-line tool can do. No credentials, roles or special tooling are described in the report. The precondition is the dangling CNAME itself: a subdomain whose CNAME target is a CloudFront hostname that is not currently claimed by any distribution.
Finding it
The researcher noticed that cdn.grab.com was pointed via a CNAME to a CloudFront instance:
cdn.grab.com => *.cloudfront.net
Line by line: the left side, cdn.grab.com, is the name Grab owns. The arrow means "is an alias for". The right side, *.cloudfront.net, is the kind of hostname CloudFront hands out to its customers; the * here stands for the unique part CloudFront assigns to each distribution. So the record says: to reach cdn.grab.com, go and ask CloudFront.
The target hostname was not registered on Amazon AWS CloudFront. A CNAME to a CloudFront hostname only works while a distribution claims that hostname; if no distribution does, the name is free for anyone to register. That mismatch between the DNS record and the absence of a backing distribution is what made the subdomain look wrong.
Exploitation
Step 1: Confirm the dangling CNAME
The researcher observed the CNAME from cdn.grab.com to a *.cloudfront.net hostname and confirmed that no CloudFront distribution was registered for it. This is the condition that makes takeover possible: the DNS record still points at CloudFront, but nothing on CloudFront answers for that hostname. This step matters because a CNAME on its own is normal and harmless; the bug only exists if the destination is unclaimed.
Step 2: Register the hostname on CloudFront
The researcher registered cdn.grab.com on CloudFront, so that their distribution would answer for the CNAME target. In other words, they rented the empty unit that the sign pointed to. The report does not describe the distribution settings used.
Step 3: Serve content from the subdomain
With the distribution in place, requests to cdn.grab.com resolved to the researcher's CloudFront distribution, and the researcher was able to take over the domain. The proof of concept is a page served from the subdomain:
http://cdn.grab.com/index.html
Line by line: http:// is the ordinary, unencrypted web protocol. cdn.grab.com is Grab's own subdomain, so a visitor sees Grab's name in the address bar. /index.html is the conventional filename for a website's front page. The researcher offered that URL as the proof of concept. The researcher called this a "POC", short for proof of concept: a small demonstration that proves the problem is real rather than theoretical.
Root cause
The mistake is a dangling DNS record: cdn.grab.com was a CNAME to a CloudFront hostname that no distribution had registered. CloudFront hostnames are only bound to a distribution while one claims them, so an unclaimed name can be registered by anyone. In plain terms: the address book entry was never cleaned up when the service behind it went away.
Impact
The researcher describes the following impact. Cyber attackers can launch a phishing campaign leveraging the established brand reputation of the domain. Phishing is a scam where an attacker pretends to be someone trustworthy to get a victim to hand over information or install something. The victim has no way to tell whether the content is served by the domain owner or by the attacker, because the address bar shows the real, trusted domain.
Attackers can also chain higher severity attacks to this. Many applications expose session cookies to a wildcard domain (*.example.com), so any subdomain can access them. A cookie is a small piece of data a website stores in your browser so it can recognise you on the next request; a session cookie is the one that proves you are logged in, and stealing it usually means the thief can act as you without knowing your password. The "secure flag" is a setting that tells the browser to send a cookie only over encrypted connections; it protects the cookie in transit but does not stop a page on a sibling subdomain from reading it. An attacker can take a forgotten subdomain, trick the user into visiting it, and extract cookies, even those with the secure flag. The researcher frames this as an advanced version of XSS. XSS, cross-site scripting, is normally about injecting code into someone else's page; here the attacker does not need to inject anything, because they own a whole subdomain that the browser already trusts.
Fix
The researcher proposed two options:
- Remove the CNAME record on
cdn.grab.comso that it no longer points tocloudfront.net. - Ask the researcher to remove the registered
cdn.grab.comon CloudFront, after which the owner can re-register their own distribution.
The report does not state which option was applied.
Variants to test
- Look for subdomains whose CNAME points at a CloudFront hostname with no active distribution. A positive result is that you can register the hostname on CloudFront and serve content from the subdomain.
- Apply the same pattern to other cloud providers that bind hostnames to customer resources (for example, other CDN or hosting services). A positive result is that the provider lets you claim the hostname and the target's DNS record resolves to your resource.
- Check forgotten subdomains that are still referenced by applications. A positive result is that the subdomain resolves to attacker-controlled content while remaining within the wildcard cookie scope.
Hunting notes
This kind of bug hides in DNS records that point at a cloud hostname nobody has claimed. During recon (the information-gathering phase before attacking anything), a CNAME to a cloud provider hostname is the signal to check whether the target hostname is still claimed; if it is not, the record is dangling. The researcher pointed to a proof-of-concept URL on cdn.grab.com and explained the cookie-exposure chain through the wildcard domain.
Glossary
- AWS (Amazon Web Services): Amazon's cloud platform, where customers rent servers and services, including CloudFront.
- CDN (content delivery network): a service that keeps copies of files on servers worldwide so visitors download them quickly from a nearby location.
- CloudFront: Amazon's CDN product; customers create distributions and attach hostnames to them.
- CNAME: a DNS record that says one name is an alias for another name, so the lookup continues at the second name.
- Cookie: a small piece of data a site stores in your browser and receives back on later requests, often used to remember who you are.
- Dangling DNS record: a DNS entry that still points at a service or hostname that the organisation no longer owns or controls.
- Distribution (CloudFront): a configured CDN setup in CloudFront, which claims the hostnames it will answer for.
- DNS (Domain Name System): the internet's address book, translating readable names into the addresses of machines that answer.
- Hostname: a single name within a domain, such as
cdn.grab.comwithingrab.com. - Phishing: a scam that impersonates a trusted party to trick someone into giving up information or running something harmful.
- POC (proof of concept): a small demonstration showing that a suspected problem can actually be exploited.
- Recon: the information-gathering stage of security testing, before any exploitation.
- Secure flag: a cookie setting that makes the browser send the cookie only over encrypted connections.
- Session cookie: the cookie that proves you are logged in; stealing it usually lets an attacker act as you.
- Subdomain: a name that sits under a larger domain, like
cdnundergrab.com. - Subdomain takeover: registering an unclaimed cloud resource so that an organisation's existing subdomain starts serving the attacker's content.
- Wildcard domain: a domain pattern such as
*.example.comthat covers every subdomain at once. - XSS (cross-site scripting): a class of attack where an attacker gets their code to run inside a trusted page; here the researcher calls the takeover an advanced version of it.