Reflected XSS in <any>.myshopify.com through theme preview
A storefront template failed to escape the theme_handle parameter, so a crafted preview URL injected script into the page. An unauthenticated attacker could run script in the storefront origin, which is shared with the store admin area, and read cookies.
Originally disclosed on HackerOne
- Triaged in 2 hours
- Fixed in 24 days
- Paid in 24 days
- Disclosed after 24 days
Summary by the program
This is a reflected XSS that could be triggered on the storefront of any Shopify store. Our template was missing proper escaping for the theme_handle parameter. This issue is severe because it could be exploited by unauthenticated users to attack the admin area of a store, given that the storefront is hosted on the same origin as the admin area of a store.
The report
Hi,
I have found a reflected cross site scripting vulnerability in <any>.myshopify.com through theme_hanlde parameter due to not single quotes.
#Steps to reproduce:
- Navigate to
<account>.myshopify.com - view the source of the page and copy the value of
Shopify.themeId. - Navigate to
https://echo.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=<theme_ID>
replace
<theme_ID>with the ID you just copied.
- XSS will trigger in all of the online shop pages unless you click
Cancel theme preview.
PoC:
https://test.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=3572

Thanks!
Context
Shopify stores are served from <store>.myshopify.com, and the storefront and the store's admin area share that origin. A reflected cross-site scripting bug on the storefront is therefore not confined to the shop front: script running there runs on the same origin as the admin area.
The feature involved is theme preview. A merchant can preview a theme before publishing it, and the preview is selected with a preview_theme_id parameter on the storefront URL. The storefront template renders the theme_handle parameter into the page, and according to the program's summary that template was missing proper escaping for it. The researcher's own summary describes the same gap as a failure to escape single quotes.
Setup
No special tooling is described. The preconditions are:
- A Shopify store reachable at
<account>.myshopify.com. - The theme ID of a theme on that store, which is read from the page source.
- Nothing else: the payload is delivered in a URL, so the attacker does not need an account on the target store.
Finding it
The researcher reports a reflected cross-site scripting vulnerability in <any>.myshopify.com through the theme_hanlde parameter (spelled that way in the report; the working parameter in the proof of concept is theme_handle), attributed to the value not being escaped for single quotes. Because the parameter is reflected into the storefront page, a value that breaks out of a single-quoted context can introduce script.
Exploitation
Step 1: open the store
Navigate to <account>.myshopify.com.
Step 2: read the theme ID
View the source of the page and copy the value of Shopify.theme Id. This is the identifier the preview mechanism expects.
Step 3: build the preview URL with the payload
Navigate to:
https://echo.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=<theme_ID>
Replace <theme_ID> with the ID copied in step 2. The important parts:
theme_handle=xx%27-alert(document.cookie)-%27:%27is a single quote. The value contains single quotes around analert(document.cookie)call; the report attributes the bug to single quotes not being escaped.style_id=1andstyle_handle=1: additional parameters present in the URL; the report does not explain their role.preview_theme_id=<theme_ID>: the theme ID copied in step 2; the report does not explain its role.
Step 4: observe the result
The proof of concept given is:
https://test.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=3572
The report gives this URL as the proof of concept and notes the XSS triggers on all online shop pages until the preview is cancelled. The researcher notes that the XSS triggers on all of the online shop pages unless the merchant clicks Cancel theme preview, so the preview state persists across the storefront for as long as the preview is active.

The report includes a screenshot alongside the proof of concept.
Root cause
The storefront template reflects the theme_handle request parameter into the HTML without escaping it for the quoting context it is placed in. The program's summary states the template was missing proper escaping for theme_handle; the researcher describes the specific failure as not escaping single quotes. The researcher describes the failure as single quotes not being escaped.
The design factor that raises the severity is the shared origin: the storefront and the admin area are served from the same <store>.myshopify.com origin, so script executing on a storefront page is same-origin with the admin area.
Impact
The program's summary states the issue is severe because it could be exploited by unauthenticated users to attack the admin area of a store, given that the storefront is hosted on the same origin as the admin area. In other words, the program says unauthenticated users could exploit it to attack the admin area of a store because both share the origin.
Fix
The program states that the template was missing proper escaping for the theme_handle parameter, which identifies the fix: escape the parameter correctly for the context in which it is rendered, including single quotes, so that a value such as xx'-alert(document.cookie)-' is rendered as text rather than markup.
Variants to test
- Other preview and theme parameters: try the same quote-breakout on parameters that select or describe a theme, such as handles, IDs and style selectors, and look for the injected script executing in the response.
- Different quoting contexts: if single quotes are handled, try double quotes and unquoted attribute contexts, and check whether the value lands in a script block rather than an attribute.
- Persistence of preview state: confirm whether a crafted preview URL keeps the injected rendering active across other storefront pages until the preview is cancelled, as described here.
- Same-origin reach: on any platform where storefront and admin share a hostname, treat storefront reflection as an admin-origin issue and check what the admin area exposes to same-origin script.
Hunting notes
This bug sits in a preview feature that reflects request parameters into the storefront template. During recon, the signals are storefront URLs that accept preview, theme and style parameters, and page source that contains the theme identifier (here Shopify.theme) that the preview mechanism consumes. The path to impact was straightforward for the program because the storefront shares an origin with the admin area, so a reflected script on any shop page is a script on the admin origin; the report makes that argument explicitly rather than demonstrating an admin action. The payload needed no authentication, only a theme ID for the targeted store, copied from the page source.
What happened, in plain words
Shopify is a platform that lets anyone run an online shop. Every shop gets a web address of the form <store>.myshopify.com, and the same address serves two things: the shop front that customers see, and the admin area where the shop owner manages products, orders and settings. Because both live under the same hostname, the browser treats them as the same place, or the same "origin".
A security researcher found that one of the shop front pages would take a value from the web address (the part after the ?) and paste it into the page without cleaning it up first. If that value contains a single quote character, it can break out of the spot where it was meant to sit and turn into a small program that the browser runs. This kind of flaw is called reflected cross-site scripting, or XSS: "reflected" because the bad value bounces straight back from the request into the page, and "scripting" because the browser ends up executing it.
The dangerous part is the shared origin. A script running on the shop front is running on the same origin as the admin area, so it can do things in the admin area as if it were the logged-in shop owner. The payload calls alert(document.cookie), which would show the visitor's cookies in a dialog box.
The feature involved: theme preview
A theme is the design of a shop: its layout, colours and page templates. Shopify lets a merchant try a theme before making it live, using a preview. The preview is chosen by putting a preview_theme_id parameter in the shop front address, where the value is the theme's identifier. When the shop front is rendered in preview mode, its template also prints out another parameter called theme_handle into the page. According to the program's summary, that template was missing proper escaping for theme_handle. The researcher describes the same gap as a failure to escape single quotes.
Escaping means converting characters that have a special meaning in HTML into harmless equivalents, so that a value is shown as text rather than interpreted as markup. If a template puts a value inside single quotes and does not escape single quotes in the value, then a single quote typed by the visitor can end the quoted section early and let the rest of the value be treated as page code.
Setting up
No special tools are needed. The preconditions are:
- A Shopify store reachable at
<account>.myshopify.com. - The theme ID of a theme on that store, which can be read from the page source.
- Nothing else. The payload travels in a URL, so the attacker does not need an account on the target store.
Finding it
The researcher reports a reflected cross-site scripting vulnerability in <any>.myshopify.com through the theme_hanlde parameter (spelled that way in the report; the parameter that works in the proof of concept is theme_handle), attributed to the value not being escaped for single quotes. Because the parameter is reflected into the shop front page, a value that breaks out of a single-quoted context can introduce script.
Exploitation
Step 1: open the store
Navigate to <account>.myshopify.com.
Why: you need to see a real shop front to find the theme identifier that the preview mechanism expects.
Step 2: read the theme ID
View the source of the page and copy the value of Shopify.theme Id.
Viewing the source means asking the browser to show the raw HTML that makes up the page, rather than the rendered result. Shopify.theme is a JavaScript object that the page includes, and its Id field holds the identifier of the theme in use. Copying that number gives you a valid value for the preview parameter.
Step 3: build the preview URL with the payload
Navigate to:
https://echo.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=<theme_ID>
Replace <theme_ID> with the ID copied in step 2. Line by line:
https://echo.myshopify.com/is the shop front address.echohere stands in for the store name.?starts the query string, the part of a URL that carries parameters.theme_handle=xx%27-alert(document.cookie)-%27sets thetheme_handleparameter.%27is the URL encoding of a single quote. The value contains single quotes around analert(document.cookie)call; the report attributes the bug to single quotes not being escaped.alert(...)is a browser function that shows a dialog box, anddocument.cookiereads the cookies the browser holds for the current page.&separates one parameter from the next.style_id=1andstyle_handle=1are additional parameters present in the URL; the report does not explain their role.preview_theme_id=<theme_ID>carries the theme ID copied in step 2; the report does not explain its role.
Step 4: observe the result
The proof of concept given is:
https://test.myshopify.com/?theme_handle=xx%27-alert(document.cookie)-%27&style_id=1&style_handle=1&preview_theme_id=3572
Line by line:
https://test.myshopify.com/is the shop front of the store used for the demonstration.theme_handle=xx%27-alert(document.cookie)-%27is the same payload as before: a single quote, the alert call, and a closing single quote.style_id=1andstyle_handle=1are carried along unchanged.preview_theme_id=3572is the theme ID used in the proof of concept.
The report gives this URL as the proof of concept and notes the XSS triggers on all online shop pages until the preview is cancelled. The researcher notes that the XSS triggers on all of the online shop pages unless the merchant clicks Cancel theme preview, so the preview state persists across the shop front for as long as the preview is active.

The report includes a screenshot alongside the proof of concept.
Root cause
The shop front template reflects the theme_handle request parameter into the HTML without escaping it for the quoting context it is placed in. The program's summary states the template was missing proper escaping for theme_handle; the researcher describes the specific failure as not escaping single quotes. The researcher describes the failure as single quotes not being escaped.
The design factor that raises the severity is the shared origin: the shop front and the admin area are served from the same <store>.myshopify.com origin, so script executing on a shop front page is same-origin with the admin area.
Impact
The program's summary states the issue is severe because it could be exploited by unauthenticated users to attack the admin area of a store, given that the shop front is hosted on the same origin as the admin area. In other words, the program says unauthenticated users could exploit it to attack the admin area of a store because both share the origin.
Fix
The program states that the template was missing proper escaping for the theme_handle parameter, which identifies the fix: escape the parameter correctly for the context in which it is rendered, including single quotes, so that a value such as xx'-alert(document.cookie)-' is rendered as text rather than markup.
Variants to test
- Other preview and theme parameters: try the same quote-breakout on parameters that select or describe a theme, such as handles, IDs and style selectors, and look for the injected script executing in the response.
- Different quoting contexts: if single quotes are handled, try double quotes and unquoted attribute contexts, and check whether the value lands in a script block rather than an attribute.
- Persistence of preview state: confirm whether a crafted preview URL keeps the injected rendering active across other shop front pages until the preview is cancelled, as described here.
- Same-origin reach: on any platform where shop front and admin share a hostname, treat shop front reflection as an admin-origin issue and check what the admin area exposes to same-origin script.
Hunting notes
This bug sits in a preview feature that reflects request parameters into the shop front template. During recon, the signals are shop front URLs that accept preview, theme and style parameters, and page source that contains the theme identifier (here Shopify.theme) that the preview mechanism consumes. The path to impact was straightforward for the program because the shop front shares an origin with the admin area, so a reflected script on any shop page is a script on the admin origin; the report makes that argument explicitly rather than demonstrating an admin action. The payload needed no authentication, only a theme ID for the targeted store, copied from the page source.
Glossary
- Admin area: the part of a shop website where the owner manages products, orders and settings, normally behind a login.
- Alert: a browser function that displays a small dialog box with a message.
- Content security policy: a set of rules a website can send to the browser saying which scripts are allowed to run.
- Cookie: a small piece of data a website asks the browser to store and send back on later requests, often used to remember a logged-in session.
- Cross-site scripting (XSS): a flaw where a website lets an attacker's input end up as code that the browser executes.
- Escaping: converting characters with special meaning in HTML into harmless equivalents so they are shown as text.
- HTML: the markup language that describes the structure of a web page.
- Origin: the combination of scheme, hostname and port that the browser uses to decide whether two pages are the same place; pages from the same origin can read each other's data.
- Parameter: a named value in a URL's query string, written as
name=value. - Payload: the crafted input an attacker sends to trigger a vulnerability.
- Proof of concept (PoC): a concrete example, such as a URL, that demonstrates the vulnerability.
- Query string: the part of a URL after the
?that carries parameters. - Reflected XSS: XSS where the malicious value is sent in a request and immediately echoed back into the response page.
- Same-origin: belonging to the same scheme, hostname and port, and therefore trusted by the browser to access each other's data.
- Session: the state of being logged in, usually carried by a cookie or token.
- Storefront: the public shop pages that customers see.
- Template: the file that describes how a page is built, into which values are inserted.
- Theme: the design of a shop, including its layout, colours and page templates.
- Theme handle: a short name used to refer to a theme.
- Theme ID: the numeric identifier of a theme.
- Token: a value used to prove identity or authorise an action, often stored in a cookie.
- Unauthenticated: not logged in, with no account or session on the target.
- URL encoding: writing special characters in a URL as a percent sign followed by a code, such as
%27for a single quote.