H1514 Session Fixation on multiple shopify-built apps on *.shopifycloud.com and *.shopifyapps.com
Several Shopify-built apps did not issue a new session cookie after OAuth login, so an attacker who could set a victim's session cookie (via a by-design XSS on a related domain) could reuse that session to act as the victim. The reporter demonstrated this against Shopify Flow, Transporter and Launchpad.
Originally disclosed on HackerOne
- Triaged in 26 hours
- Fixed in 6 months
- Paid in 26 hours
- Disclosed after 6 months
Summary by the program
Note: This report was submitted during our H1-514 live hacking event, which had an expanded scope compared to our public bug bounty program. Some of the apps mentioned in this report are not currently in scope for our public program.
@filedescriptor noticed that several add-on applications built by Shopify were vulnerable to session fixation because they did not generate a fresh session cookie during the OAuth2 callback phase. This could have allowed an attacker to gain access to a victim's app session if certain conditions were met.
The report
Hi team!,
I'm reporting a Session Fixation issue on multiple shopify-built apps hosted on *.shopifycloud.com and *.shopifyapps.com. Normally Session Fixation is boring but I discovered a way to simply use by-design XSS to authenticate as a user on those affected apps.
#Details
As the policy pointed out XSS on *.shopifycloud.com and *.shopifyapps.com are N/A. That means finding XSS on them should be fairly trivial. Anyway after the XSS on embedded SDK I started to think what I can do with it. I played around some other shopify-built apps and discovered that some of them use signed session and the other use session id. Looking further I realized some which use session id do not generate a new session id after logging in. They are basically assigning the login status in whatever session id you provide in the cookie header. A straight-out Session Fixation. For example, in Shopify Flow, when you hit the index page, a _flow_session cookie is assigned. When you log in (/auth/callback), the session doesn't change. As an attacker, if I can write my session id cookie to your browser and you log in, I can use the session id to authenticate as you.
So the attack goes like this:
- Attacker goes to Shopify Flow and copies the session id it generates
- Attacker uses XSS on *.shopifycloud.com and writes the cookie scoped to all subdomain to victim
document.cookie='_flow_session=EVIL;domain=.shopifycloud.com;path=/'; - Attacker forces victim to log into Shopify Flow (i.e. https://www.shopify.com/admin/apps/flow which redirects to VICTIM_STORE.shopify.com/admin/apps/flow which triggers the login flow)
- Attacker can now use the session to authenticate as victim
#Steps to Reproduce
- Be logged into your store as an admin and have Shopify Flow installed
- Navigate to https://poorvictim.myshopify.com/products/canvas
- After a while it should redirect to the Shopify Flow page
- (Attacker) Use another browser, go to https://flow.shopifycloud.com/robots.txt and run this code in console
document.cookie='_flow_session=7b2f6c606fab4186d7be385aa66d53d9' - (Attacker) Navigate to https://flow.shopifycloud.com/?shop=YOUR_STORE.myshopify.com and you should see your (Victim) data for a split second (you are supposed to use this in iframe) (Remember to change the YOUR_STORE in the URL)
Impact
An attacker can authenticate as the victim.
I have found Session Fixation on the following apps:
- Shopify Flow
- Transporter
- Launchpad
There are probably some others I haven't tested or forgotten. Let me know if you want me to list them all.
I'm also looking if there's some subdomains on *.shopify.com that suffer from it.
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
The apps reused the pre-login session identifier after authentication instead of issuing a new one, and a separate XSS allowed an attacker to plant a chosen session cookie on a parent domain.
Impact
An attacker could authenticate as the victim in the affected apps, but only if they could first plant a session cookie in the victim's browser using the separate XSS.
What the attacker needed
Victim has the app installed; attacker can run XSS on a related domain; victim logs in after cookie is set
The fix
The apps should generate a fresh session identifier after the OAuth callback.
How it was found
- As an admin with Shopify Flow installed, visit a store product page that redirects to the Flow app.
- In a second browser, open the Flow app's robots.txt page and set a chosen session cookie via the console.
- Navigate to the Flow app with the victim's store parameter and observe the victim's data briefly.
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.
When you log in, a website usually gives you a new session cookie, like a fresh wristband at an event. Here, the app kept the same wristband you arrived with, so if someone else chose your wristband number in advance, they could walk in as you after you logged in. The attacker also needed a way to plant that cookie in your browser, which they got from a separate cross-site scripting flaw.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.