Skip to content
Business logic Disclosed report Intermediate

Script Editor preview token still working with uninstalled application, even for unpublished script

A preview token generated by the Script Editor kept working after the app was uninstalled and did not appear to expire, so an unpublished discount script could still be previewed on the storefront. Separately, a script name could be set to a zero-width character, which hid the order timeline link and made the script hard to edit through the app.

imgnotfound Follow

Originally disclosed on HackerOne

  • Triaged in 8 days
  • Fixed in 18 days
  • Paid in 11 days
  • Disclosed after 51 days

Within the Script Editor application, it is possible to preview a script on the storefront and proceed to purchase. Once the user click on the preview link, it opens https://{shop}.myshopify.com/admin/scripts/preview?script_id={script_id} which then generate a preview token to be used by the storefront. As an example, it redirects back the user to https://{shop}.myshopify.com/cart?preview_script_id={preview_script_id}. Per my testing, that token doesn't seem to be expiring and can still be used even if the Script Editor application has been uninstalled.

Taking that into consideration, a malicious user could've created an unpublished script applying discounts to carts and if he has access, even uninstall the app. That could be done by a malicious hired Shopify Developer/Collaborator which had to do some work on a given store.

On the other hand, if a script has been applied to an order, a clickable Script name was run on this order (Script Editor) message is left on its Timeline so the admin can better understand why a discount has been applied. That said, it is possible to update a script name to an "empty" character resulting in the user not being able to deep-link from the order timeline to the Script Editor. By doing so, the user is also unable to edit the script as the application itself uses an hyperlink on the script name to open the edit page - meaning that the only way to edit the script would be to directly open the script editor page located at https://script-editor.shopifycloud.com/scripts/{id}.

Steps to reproduce - Updating a script name to an empty character

  1. Open the Script Editor application and create a new script
  2. By clicking Save draft, a request will be made to PATCH https://script-editor.shopifycloud.com/scripts/{id}
  3. Intercept the request and/or replay it by updating the name property to an empty character. A zero-widthspace character can be copied from https://qwerty.dev/whitespace/

Order timeline - Hyperlink suppressed as script name is using empty character

Order_-_Timeline_no_hyperlink.png
Order_-_Timeline_no_hyperlink.png From the original on HackerOne

Script Editor Application - Unable to edit the script

Script_Editor_App_-_No_hyperlink_to_edit.png
Script_Editor_App_-_No_hyperlink_to_edit.png From the original on HackerOne

Impact

A malicious user which had access to the store admin at some point, could've created unpublished script to apply discounts to carts which become a bit invisible to the admin if the application is uninstalled and/or using empty character for the script name.

For example, someone selling its store in the marketplace could make use of this.

To mitigate the issue, introducing a time based expiration of the preview_script_id might do it.

The original report as published on HackerOne, by imgnotfound. 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 the preview token had no expiry and was not invalidated when the app was uninstalled, and the script name field accepted invisible characters without validation.

Impact

A former collaborator or developer could leave an unpublished discount script that still applies to carts and is hard for the admin to notice or edit, which could matter when a store is sold.

What the attacker needed

Admin or collaborator access to the store; Script Editor app installed at some point

The fix

The preview token should expire after a set time, which might mitigate the issue.

How it was found

  1. Open the Script Editor app and create a new script.
  2. Click Save draft, which sends a PATCH request to the scripts endpoint.
  3. Intercept or replay that request and set the name property to a zero-width space character.
  4. Observe that the order timeline link is suppressed and the script cannot be edited from the app.

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.

A preview link lets a shop owner test a script before publishing it. The report says the special code inside that link did not seem to expire, even after the app was removed, so a script that was never published could still change cart prices. A second issue let someone give a script a name made of an invisible character, which broke the links used to find and edit it.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by imgnotfound

View all

15 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.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.