Subdomain takeover on s3.shopify.com
The subdomain s3.shopify.com was pointed via CNAME to an unregistered Amazon S3 bucket, allowing anyone to claim it and serve content on that domain. An attacker could host malicious HTML for stored XSS, create convincing phishing pages, or control data fetched from the subdomain.
Originally disclosed on HackerOne
- Fixed in 39 hours
- Paid in 8 days
- Disclosed after 8 days
Preword I know that this is not explicitly in scope, but I still felt it was serious enough to justify a report and let you decide the potential impact.
Description The subdomain s3.shopify.com was pointed using CNAME to Amazon S3, but no bucket with that name was registered. This meant that anyone could sign up for Amazon S3, claim the bucket as their own and then serve content on s3.shopify.com.
DNS record:
s3.shopify.com. 3599 IN CNAME shopify-assets.s3.amazonaws.com.
shopify-assets.s3.amazonaws.com. 7518 IN CNAME s3-directional-w.amazonaws.com.
s3-directional-w.amazonaws.com. 7218 IN CNAME s3-1-w.amazonaws.com.
s3-1-w.amazonaws.com. 4 IN A 52.216.80.56
Impact This could be used as stored XSS by uploading a HTML page.
Given that the attacker could control all the content (even at /), it could also make for a pretty convincing phishing page.
Last, if any of your application relies on s3.shopify.com any of the data sent/fetched there could be controlled by an attacker.
Mitigation/PoC I have claimed the bucket on my account and disabled use except for the following URL: http://s3.shopify.com/xss_unguessable3211231232.html
This means that nobody else can claim the bucket and add content.
Fix Remove the s3.shopify.com DNS entry. Alternatively, if you wish to use s3.shopify.com with S3, tell me in a comment and I will remove the bucket from my Amazon account.
Context
The hostname s3.shopify.com was a Shopify subdomain whose DNS record delegated it, via CNAME, to an S3 bucket address. The intended behaviour is straightforward. A request to s3.shopify.com resolves through the S3 CNAME chain to an S3 endpoint, and S3 serves whatever object lives in the bucket that the hostname points at. Because the hostname sits under shopify.com, anything served from it is treated by browsers as first-party Shopify content.
The researcher opens by noting that the subdomain was not explicitly in scope, but considered the issue serious enough to report so that the program could decide on the potential impact.
Setup
No special tooling or privileged access was needed. The preconditions were:
- The ability to query public DNS for
s3.shopify.com. - An Amazon S3 account, which anyone can create.
- The absence of a registered bucket matching the name used in the CNAME target.
Finding it
The researcher resolved s3.shopify.com and looked at the full CNAME chain. The record returned was:
s3.shopify.com. 3599 IN CNAME shopify-assets.s3.amazonaws.com.
shopify-assets.s3.amazonaws.com. 7518 IN CNAME s3-directional-w.amazonaws.com.
s3-directional-w.amazonaws.com. 7218 IN CNAME s3-1-w.amazonaws.com.
s3-1-w.amazonaws.com. 4 IN A [redacted]
The first line is the important one: s3.shopify.com is a CNAME to shopify-assets.s3.amazonaws.com, which is the S3 virtual-hosted style address for a bucket named shopify-assets.
What made this wrong is that no bucket with the name shopify-assets was registered. S3 bucket names are global and first-come, first-served. A dangling CNAME that points at an unclaimed bucket name therefore hands control of the hostname to whoever registers that bucket first. The DNS record still existed, but the resource it delegated to did not belong to Shopify any more.
Exploitation
Step 1: Confirm the dangling CNAME
Resolving the hostname showed the CNAME chain above, ending at an S3 address. No bucket matching the CNAME target was registered, so the delegation pointed at nothing that Shopify controlled.
Step 2: Claim the bucket
The researcher signed up for Amazon S3 and claimed the unregistered bucket. Because the name was free, the registration succeeded, and from that point the bucket behind s3.shopify.com was under the researcher's control. Any content placed in that bucket would be served on the Shopify subdomain.
Step 3: Prove control without exposing others to the content
Rather than leaving arbitrary content publicly served, the researcher restricted access to the bucket so that only one specific object could be fetched:
http://s3.shopify.com/xss_unguessable3211231232.html
This served two purposes. It demonstrated that content uploaded by the researcher was reachable through the Shopify hostname, and it prevented anyone else from claiming the bucket in the meantime and adding content of their own.
Root cause
The mistake is a DNS record that outlived the resource it pointed at. s3.shopify.com was configured as a CNAME to the S3 bucket address shopify-assets.s3.amazonaws.com, but no bucket with that name was registered while the DNS entry remained. S3 does not reserve bucket names for parties that have not claimed them, so the name was available to anyone.
Nothing in the DNS configuration prevented this. A CNAME is a blind delegation: it does not verify that the target still belongs to the organisation, and it does not fail closed when the target is unclaimed. The only defence against this class of issue is lifecycle management of DNS records, removing or repointing them when the backing resource goes away. The report does not describe any monitoring or inventory process that would have caught the dangling record.
Impact
The researcher describes three consequences, all conditional on an attacker claiming the bucket:
- Stored XSS. By uploading an HTML page to the bucket, an attacker could serve it from
s3.shopify.com. Because the content is on ashopify.comsubdomain, it runs in the Shopify origin from the browser's point of view. - Phishing. Since the attacker controls all content served from the hostname, including the root path
/, the subdomain could host a convincing phishing page under a genuine Shopify domain. - Data exposure for dependent applications. If any Shopify application relies on
s3.shopify.com, any data it sends to or fetches from that hostname could be controlled by an attacker.
The researcher frames these as potential impacts and leaves the final judgement to the program, noting that the subdomain was not explicitly in scope.
Fix
The researcher proposed two options:
- Remove the
s3.shopify.comDNS entry. This eliminates the delegation entirely and is the straightforward remediation. - If Shopify wanted to keep using
s3.shopify.comwith S3, the researcher offered to release the bucket from their Amazon account after being told in a comment, so that Shopify could register it.
In the meantime, the researcher had already claimed the bucket and disabled its use except for the single proof-of-concept URL, which prevented a third party from taking the bucket and serving content on the subdomain.
Variants to test
The same pattern applies wherever an organisation delegates a hostname to a cloud storage or hosting provider by name rather than by a resource it still owns. Concrete things to try:
- Enumerate CNAMEs to cloud storage. Collect subdomains and resolve them, looking for CNAME targets of the form
<bucket>.s3.amazonaws.com,<bucket>.s3-<region>.amazonaws.com, or equivalent addresses for other providers. A positive result is a CNAME whose target bucket name is unregistered, which you can confirm by attempting to register it. - Check for deleted resources behind live records. A CNAME that resolves through the provider's infrastructure but returns a provider error page (rather than the organisation's content) is a strong signal that the backing resource is gone. If the name is free, claiming it completes the takeover.
- Look beyond the obvious hostname. Static asset hosts, CDN origins, documentation subdomains and marketing microsites are common places for this. A positive result is any hostname under the target's domain that serves content you uploaded.
- Test the root path. If you can serve at
/, the impact is stronger than a single obscure object, because the hostname can host a full page. Confirm that a request to the bare hostname returns your content. - Check for application dependencies. If other parts of the target load scripts, styles or data from the affected hostname, note it: the report lists this as an impact, and demonstrating it strengthens the case.
Hunting notes
This bug class hides in DNS hygiene gaps. The signals during recon are:
- CNAME records pointing at third-party storage or hosting providers, especially where the target name looks like a bucket or project name rather than a provider-managed endpoint.
- Provider error responses on a hostname that otherwise belongs to the target, which suggest the backing resource no longer exists.
- Subdomains that are not linked from the main site but still resolve, often left over from old campaigns or migrations.
The researcher claimed the bucket and restricted it to a single object at one URL. That combination proves control without leaving a live attack surface for others, and it gives the program a clear, safe reproduction path. The report also explicitly acknowledged the scope question and offered to release the bucket, which keeps the disclosure cooperative.
What happened, in plain words
Amazon S3 is a service for storing files on the internet. To make those files appear under its own domain name, Shopify used a DNS record that pointed one of its subdomains, s3.shopify.com, at a storage location on Amazon.
The problem was that no bucket with the name the record pointed at had been registered. Amazon lets anyone create a storage location with any free name, so a security researcher was able to register that exact name himself. From that moment, anything he put in his storage location was served by Amazon at s3.shopify.com, a genuine Shopify address.
This kind of mistake is called a subdomain takeover. The domain name still belongs to the company, but the thing it points at belongs to someone else, so that someone else can put their own content on the company's address.
The researcher reported it, kept the storage location locked down so nobody else could abuse it, and offered to hand it back.
The pieces you need to know
Before walking through the report, here are the basic ideas it relies on. None of them require any special software: a browser and a little patience are enough.
DNS and CNAME records
Every time you type an address such as shopify.com into your browser, your computer asks a directory service called DNS (Domain Name System) which machine on the internet it should talk to. DNS is like a phone book: you look up a name and get a number back.
A CNAME record (short for Canonical Name) is a special kind of phone book entry that says "this name is really just another name, go look that one up instead". It is like a mail forwarding note: post sent to your old address gets redirected to your new one. A CNAME can point to another CNAME, which points to another, and so on, until something finally gives a real address. That chain is called the CNAME chain.
Amazon S3 and buckets
Amazon S3 (Simple Storage Service) is Amazon's service for storing files. Files are kept in containers called buckets. Each bucket has a name, and bucket names are global: only one person in the whole world can hold a given name at a time, first come, first served. If a name is free, anyone with an Amazon account can take it.
When a bucket is used for a website, Amazon gives it an address of the form <bucket-name>.s3.amazonaws.com. If a company's DNS record points at such an address, the company's own domain name ends up serving whatever is inside that bucket.
Subdomains and the browser's trust
A subdomain is a name that sits under a main domain: s3.shopify.com is a subdomain of shopify.com. Browsers treat everything under the same main domain as belonging to the same owner. That is why this matters so much: content served from s3.shopify.com is treated by the browser as Shopify's own content, with all the trust that implies.
Stored XSS
XSS stands for Cross-Site Scripting. It means getting a website to deliver code (usually JavaScript, the language browsers run) that the site's owners did not intend. Stored XSS means the malicious content is saved somewhere, such as a file on a server, and then served to visitors later. If an attacker can upload an HTML page to a hostname the browser trusts, that page can run code in the context of the trusted site.
Phishing
Phishing is tricking someone into believing a fake page is genuine, usually to steal a password or payment details. A fake login page on s3.shopify.com looks far more convincing than one on a random address, because the domain in the address bar really is Shopify's.
The researcher's opening note
The report begins with a short preword. The researcher says the subdomain was not explicitly listed as in scope (in scope means the rules of the bug bounty programme say which systems you are allowed to test), but he considered the issue serious enough to report anyway and let the programme decide the potential impact. This is a courteous way of saying: I found something outside the official testing area, here it is, you judge it.
Setting up
The technical write-up lists what was needed to find and demonstrate the problem. There was no special tooling and no privileged access:
- The ability to look up public DNS records for
s3.shopify.com. Anyone can do this; there are free websites and built-in commands for it. - An Amazon S3 account, which anyone can create.
- The absence of a registered bucket matching the name used in the CNAME target. In other words, the name had to be free.
No Shopify account, no application access and no login of any kind were required. That is part of what makes this class of bug notable: the barrier to entry is essentially zero.
Finding it
The researcher looked up s3.shopify.com in DNS and followed the whole chain of redirects. The record he got back was:
s3.shopify.com. 3599 IN CNAME shopify-assets.s3.amazonaws.com.
shopify-assets.s3.amazonaws.com. 7518 IN CNAME s3-directional-w.amazonaws.com.
s3-directional-w.amazonaws.com. 7218 IN CNAME s3-1-w.amazonaws.com.
s3-1-w.amazonaws.com. 4 IN A [redacted]
Line by line, in plain words:
- First line:
s3.shopify.comis a CNAME pointing atshopify-assets.s3.amazonaws.com. This is the line that matters. The target is an Amazon S3 bucket address. The number3599is how long, in seconds, the answer may be cached (remembered) before it has to be looked up again. - Second line:
shopify-assets.s3.amazonaws.comis itself a CNAME pointing ats3-directional-w.amazonaws.com. This is Amazon's own internal plumbing, redirecting the bucket address to one of its regional front ends. - Third line:
s3-directional-w.amazonaws.comis a CNAME pointing ats3-1-w.amazonaws.com, another step in Amazon's internal chain. - Fourth line:
s3-1-w.amazonaws.comfinally has an A record, which is the entry that gives a real numeric address (an IP address) of a machine:[redacted]. This is the Amazon server that would actually answer requests.
So the first line is the important one: Shopify's subdomain was delegated to a bucket called shopify-assets. The rest is just Amazon's normal routing from a bucket name to a real server.
What made this a bug is that no bucket matching the CNAME target was registered. The DNS record still existed, but the thing it pointed at was free for anyone to take. The technical write-up calls this a dangling CNAME: a forwarding note that points at an address nobody owns any more.
Exploitation
The technical write-up breaks the demonstration into three steps.
Step 1: Confirm the dangling CNAME
Looking up the hostname produced the chain shown above, ending at an Amazon S3 address. The bucket name in the target, shopify-assets, was not registered, so the delegation pointed at nothing Shopify controlled. This step is about confirming the suspicion: the record exists, but the destination is unclaimed.
Step 2: Claim the bucket
The researcher signed up for Amazon S3 and claimed the unregistered bucket. Because the name was free, the registration succeeded. From that moment, the bucket behind s3.shopify.com was under his control, and anything he placed in it would be served on the Shopify subdomain. This is the actual takeover: no hacking of Shopify systems, just registering a name that was left lying around.
Step 3: Prove control without exposing others to the content
Rather than leaving arbitrary content publicly served, the researcher restricted access to the bucket so that only one specific file could be fetched:
http://s3.shopify.com/xss_unguessable3211231232.html
This single line is a web address. http:// is the protocol, s3.shopify.com is the Shopify subdomain, and xss_unguessable3211231232.html is the name of the file in the bucket.
Restricting the bucket to that one file served two purposes:
- It demonstrated that content uploaded by the researcher was reachable through the Shopify hostname. That is the proof the programme needs.
- It prevented anyone else from claiming the bucket in the meantime and adding content of their own. Since the bucket was now taken, no other person could register it, and since only one unguessable file was served, the live risk was minimal.
This is a careful way to demonstrate a takeover: show that you control the content, but do not leave a working attack page on a real company's domain for the whole internet to find.
Root cause
The mistake is a DNS record that outlived the resource it pointed at. s3.shopify.com was configured as a CNAME to the S3 bucket address shopify-assets.s3.amazonaws.com, but no bucket with that name was registered while the DNS entry remained. Amazon does not reserve bucket names for parties that have not claimed them, so the name was available to anyone.
Nothing in the DNS configuration prevented this. A CNAME is a blind delegation: it does not check that the target still belongs to the organisation, and it does not fail safely when the target is unclaimed. The only defence against this class of issue is keeping track of DNS records and removing or repointing them when the backing resource goes away. The report does not describe any monitoring or inventory process that would have caught the dangling record.
Impact
The researcher describes three consequences, all conditional on an attacker claiming the bucket:
- Stored XSS. By uploading an HTML page to the bucket, an attacker could serve it from
s3.shopify.com. Because the content is on ashopify.comsubdomain, it runs in the Shopify origin from the browser's point of view. In plain terms: the browser believes the page is Shopify's own, so any code on it is trusted as Shopify code. - Phishing. Since the attacker controls all content served from the hostname, including the root path
/(the bare address with nothing after it), the subdomain could host a convincing fake page under a genuine Shopify domain. A visitor checking the address bar would see Shopify's name. - Data exposure for dependent applications. If any Shopify application relies on
s3.shopify.com, any data it sends to or fetches from that hostname could be controlled by an attacker. In other words, if some part of Shopify's own software trusts that address, it would be trusting the attacker.
The researcher frames these as potential impacts and leaves the final judgement to the programme, noting again that the subdomain was not explicitly in scope.
Fix
The researcher proposed two options:
- Remove the
s3.shopify.comDNS entry. This eliminates the delegation entirely and is the straightforward remediation. No record, no takeover. - If Shopify wanted to keep using
s3.shopify.comwith S3, the researcher offered to release the bucket from his Amazon account after being told in a comment, so that Shopify could register it. This keeps the useful setup while putting the name back in the right hands.
In the meantime, the researcher had already claimed the bucket and disabled its use except for the single proof-of-concept URL, which prevented a third party from taking the bucket and serving content on the subdomain.
Variants to test
The same pattern applies wherever an organisation delegates a hostname to a cloud storage or hosting provider by name rather than by a resource it still owns. The technical write-up lists concrete things to try:
- Enumerate CNAMEs to cloud storage. Collect subdomains and resolve them, looking for CNAME targets of the form
<bucket>.s3.amazonaws.com,<bucket>.s3-<region>.amazonaws.com, or equivalent addresses for other providers. A positive result is a CNAME whose target bucket name is unregistered, which you can confirm by attempting to register it. In plain words: make a list of the company's subdomains, look up where each one points, and see whether any point at a storage name that is still free. - Check for deleted resources behind live records. A CNAME that resolves through the provider's infrastructure but returns a provider error page (rather than the organisation's content) is a strong signal that the backing resource is gone. If the name is free, claiming it completes the takeover. In plain words: if the address answers with an error from Amazon rather than with the company's files, the storage behind it is probably missing.
- Look beyond the obvious hostname. Static asset hosts, CDN origins, documentation subdomains and marketing microsites are common places for this. A positive result is any hostname under the target's domain that serves content you uploaded. In plain words: do not only check the main site; check the side addresses used for images, docs and campaigns.
- Test the root path. If you can serve at
/, the impact is stronger than a single obscure object, because the hostname can host a full page. Confirm that a request to the bare hostname returns your content. - Check for application dependencies. If other parts of the target load scripts, styles or data from the affected hostname, note it: the report lists this as an impact, and demonstrating it strengthens the case.
Hunting notes
This bug class hides in gaps in DNS housekeeping. The signals to watch for while exploring are:
- CNAME records pointing at third-party storage or hosting providers, especially where the target name looks like a bucket or project name rather than a provider-managed endpoint.
- Provider error responses on a hostname that otherwise belongs to the target, which suggest the backing resource no longer exists.
- Subdomains that are not linked from the main site but still resolve, often left over from old campaigns or migrations.
The researcher claimed the bucket and restricted it to a single object at one URL. That combination proves control without leaving a live attack surface for others, and it gives the programme a clear, safe reproduction path. The report also explicitly acknowledged the scope question and offered to release the bucket, which keeps the disclosure cooperative.
Glossary
- A record: a DNS entry that gives the numeric IP address of a machine.
- Amazon S3: Amazon's service for storing files on the internet.
- Bucket: a named container for files inside Amazon S3. Names are global and first come, first served.
- Bug bounty programme: a scheme where a company pays researchers for reporting security problems in its systems.
- CNAME record: a DNS entry that says one name is really another name, so the lookup should continue at the target.
- CNAME chain: the sequence of CNAME records followed one after another until a real address is found.
- Dangling CNAME: a CNAME record that points at a resource which no longer exists or is no longer owned by the organisation.
- DNS: the internet's name directory, translating names such as
shopify.cominto machine addresses. - Domain: the main name of a website, such as
shopify.com. - HTML: the language used to describe the content of web pages.
- IP address: the numeric address of a machine on the internet, such as the one at the end of the DNS chain in this report.
- JavaScript: the programming language that browsers run to make web pages interactive.
- Origin: the combination of scheme, domain and port that a browser uses to decide which site content belongs to and trusts.
- Phishing: a fake page or message designed to trick someone into believing it is genuine, usually to steal credentials or payment details.
- Root path: the bare address of a site with nothing after the domain, written as
/. - Scope: the list of systems a bug bounty programme allows researchers to test.
- Stored XSS: Cross-Site Scripting where the malicious content is saved on a server and served to visitors later.
- Subdomain: a name under a main domain, such as
s3.shopify.comundershopify.com. - Subdomain takeover: registering a resource that a company's subdomain still points at, so that you control content served on the company's address.
- XSS: Cross-Site Scripting, getting a website to deliver code its owners did not intend, which then runs in a visitor's browser.