Skip to content
Race condition Disclosed report Intermediate

Ability to publish a paid theme without purchasing it.

A paid theme could be published without purchase by sending a legacy publish request during the theme installation window. An attacker could then edit and download the theme files, causing content theft and lost profit.

saltymermaid Follow

Originally disclosed on HackerOne

Bounty$2,000 Low View original
  • Triaged in 4 days
  • Fixed in 20 days
  • Paid in 5 days
  • Disclosed after 21 days

Hi,

##Description I kept looking for alternatives to my report #927567 and I found another way to publish a paid theme without having to purchase it. This time the trick is to send "ThemePublishLegacy" XHR request while the theme is being installed.

##Requirements

  1. Google Chrome suggested because that's what I use to describe my steps

##Steps to reproduce

  1. Make sure you have the default theme installed and that it is published

  2. Install any free theme

  3. Publish the free theme you just installed

  4. From your developper tool, copy the ThemePublishLegacy XHR request as fetch and paste it in your developper tool console and keep it for later.

    fetch("https://yourshop.myshopify.com/admin/online-store/admin/api/unversioned/graphql", {
      "headers": {
        "accept": "application/json",
        "accept-language": "fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7",
        "cache-control": "no-cache",
        "content-type": "application/json",
        "pragma": "no-cache",
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        "x-online-store-web": "1"
      },
      "referrerPolicy": "no-referrer",
      "body": "{\"operationName\":\"ThemePublishLegacy\",\"variables\":{\"id\":\"gid://shopify/OnlineStoreTheme/[THEME_ID]\"},\"query\":\"mutation     ThemePublishLegacy($id: ID!) {\\n  onlineStoreThemePublish(id: $id) {\\n    theme {\\n      id\\n      __typename\\n    }\\n    userErrors {\\n      field\\n          message\\n      __typename\\n    }\\n    __typename\\n  }\\n}\\n\"}",
      "method": "POST",
      "mode": "cors",
      "credentials": "include"
    });
    
  5. Now, in a new tab, visit https://themes.shopify.com/ and leave the admin/themes tab open

  6. Choose any paid theme, which should bring you to the selected theme page (e.g. https://themes.shopify.com/themes/mr-parker)

  7. Click the "Try theme" button to launch the installation 7.1 From here, the next steps have to be done as fast as you can, before the theme gets fully installed

  8. Quickly go back to the admin/themes tab you left open at step #5 and refresh the page (your developper tool should still be active for that tab). 8.1 Once the page is reloaded, you should see in the "Theme library" section that the theme is being installed (a spinner animation is shown)

  9. Now in your developper tool, open the XHR tab and select the first graphql request that is made to ThemesProcessingLegacy

  10. Once its selected, open the response preview tab and l look for data > onlineStore > themes > edges > [0] > node > id 11.1 The ID of the theme being installed is the one at the first index

  11. Copy the theme ID gid://shopify/OnlineStoreTheme/[THEME_ID]

  12. Go back to your developper tool console and in the request you saved at step #4, replace the theme ID with the one you just copied at step #11 and send the request (before the theme installation is complete!)

  13. Once the theme installation is complete, refresh the page and you will see that the paid theme is now publish.

I will be attaching a POC video with this report. You will see in the video that the first time I sent the request, it did not work because of an error (Role can't be set to main: missing required file layout/theme.liquid). I believe this attack has to be timed at the right moment for it to work all the time. It seems like for this to work properly, the ThemePublishLegacy request should be sent right before the installation is complete, just before the last ThemesProcessingLegacy request is made. This could probably be improved and automated with a script.

Also, again, after the theme is published, it seems like we own it. So, at this point, if you publish another theme (the free one), you should see that the the yellow "Theme trial" badge is missing and that you can rename, edit and download the theme files.

Impact

Ability to install paid theme without purchasing it could lead to content stealing and lost of profit. There is also some unwanted information disclosure since we can edit the theme code and download the files after its published.

If you need extra details, please let me know!

Thank you!

The original report as published on HackerOne, by saltymermaid. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a race condition: the publish endpoint does not check that the theme was purchased and accepts a publish request while the theme is still being installed.

Impact

An attacker could publish a paid theme without buying it, then edit and download its files, leading to content theft and lost profit; the attack must be timed correctly and may fail if sent too early.

What the attacker needed

A Shopify admin account; Google Chrome browser; timing the request during installation

How it was found

  1. Have the default theme installed and published, then install and publish a free theme.
  2. Copy the ThemePublishLegacy request from the browser developer tools.
  3. Open the paid theme page and click Try theme to start installation.
  4. Refresh the admin themes tab and find the installing theme's ID in the ThemesProcessingLegacy response.
  5. Replace the theme ID in the saved request and send it before installation completes.
  6. Refresh the page to see the paid theme published.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Shopify themes are normally paid for before you can use them. The report shows that if you send a special publish request at the exact moment a paid theme is still installing, the shop treats it as yours. That lets you keep and download a theme you never bought.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More by saltymermaid

View all

6 more disclosed reports, best first.

More from Shopify

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.