A non-privileged user may create an admin account in Stocky
A non-privileged Stocky user could send a crafted POST request to the /users/create_admin endpoint to create a new admin account, bypassing the normal login screen. The attacker could then log in with the new account and gain full admin privileges within Stocky.
- Triaged in 3 days
- Fixed in 59 days
- Paid in 10 days
- Disclosed after 5 months
Summary by the program
@stapia reported that it was possible to create a new user by posting directly to the /users/create_admin endpoint in Stocky. This bypassed the Stocky user login screen entirely, for a staff member with Apps permission.
Note that certain types of issues in Stocky are not currently being accepted on our program, so please remember to review the program page before digging into this app.
The report
##Summary: A non-privileged Stocky user (created within Stocky) may be able to create a new admin user.
##Steps to reproduce: 1.Create a non-privileged user in Stocky, don't give admin privileges to that user. 2.Login with the non-privileged user and go to https://stocky.shopifyapps.com/users/me, update any field and intercept the request. 3. Make a POST request to /users/create_admin with the Cookies and Token that you intercepted from the previous steps. 4. Log out from Stocky and Login with the new user, you will have admin privileges.
POST /users/create_admin HTTP/2
Host: stocky.shopifyapps.com
Cookie:[REPLACE COOKIES]
Content-Length: 277
Cache-Control: max-age=0
Sec-Ch-Ua: "Chromium";v="91", " Not;A Brand";v="99"
Sec-Ch-Ua-Mobile: ?0
Upgrade-Insecure-Requests: 1
Origin: https://stocky.shopifyapps.com
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://stocky.shopifyapps.com/preferences/users
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close
utf8=%E2%9C%93&authenticity_token=[REPLACE TOKEN]&user%5Bfirst_name%5D=██████&user%5Blast_name%5D=████████&user%5Bemail%5D=██████████&commit=Create+%26+Login
Impact
A non-privileged Stocky user may get full admin privileges within the app, which would allow that user to update the inventory, stock, vendors, place purchase orders, etc, even if that user doesn't have those privileges within Shopify.
Context
Stocky is a Shopify-developed app for inventory and purchase order management, reachable at stocky.shopifyapps.com. Like most Shopify apps, it has its own user model: staff members are created inside Stocky and given a set of privileges there, separate from the permissions they hold in the Shopify admin. The feature at the centre of this report is user management, specifically the screen at /preferences/users where an administrator creates new Stocky users.
The report describes a privilege escalation: a Stocky user who was deliberately created without admin rights could still cause a new admin account to be created, and then log in as that account. The program's own summary states that this bypassed the Stocky user login screen entirely, for a staff member holding the Apps permission.
Setup
The preconditions are minimal and are all described in the reproduction steps:
- A Stocky account in which you can create users, so that you can set up the victim-side condition.
- A non-privileged user created inside Stocky, explicitly without admin privileges.
- A browser with developer tools or an intercepting proxy, used to capture and replay requests.
- The session cookies and the authenticity token belonging to the non-privileged user.
The researcher's captured request shows Chrome 91 on Windows (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36), with the request issued over HTTP/2. No other tooling is named.
Finding it
The researcher's summary is short: a non-privileged Stocky user, created within Stocky, may be able to create a new admin user. The endpoint /users/create_admin accepted a request from a non-privileged user's session. The non-privileged user's own session was enough to reach it.
The interesting part is how the request was obtained. Rather than guessing at the endpoint's parameters, the researcher took a legitimate request that the non-privileged user was allowed to make, from the profile page at https://stocky.shopifyapps.com/users/me, and reused its credentials and token against the privileged endpoint.
Exploitation
Step 1: create a non-privileged user
Create a user inside Stocky and do not grant that user admin privileges. This user is the attacker's foothold: it represents a staff member with limited rights.
Step 2: capture a legitimate request
Log in as the non-privileged user and go to https://stocky.shopifyapps.com/users/me. Update any field on that page and intercept the resulting request. That request carries two things the next step needs: the session cookies and the authenticity token.
Step 3: post to the admin creation endpoint
With the intercepted cookies and token, send a POST request to /users/create_admin:
POST /users/create_admin HTTP/2
Host: stocky.shopifyapps.com
Cookie:[REPLACE COOKIES]
Content-Length: 277
Cache-Control: max-age=0
Sec-Ch-Ua: "Chromium";v="91", " Not;A Brand";v="99"
Sec-Ch-Ua-Mobile: ?0
Upgrade-Insecure-Requests: 1
Origin: https://stocky.shopifyapps.com
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://stocky.shopifyapps.com/preferences/users
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close
utf8=%E2%9C%93&authenticity_token=[REPLACE TOKEN]&user%5Bfirst_name%5D=██████&user%5Blast_name%5D=████████&user%5Bemail%5D=██████████&commit=Create+%26+Login
The parts that matter:
Cookieandauthenticity_tokenare the values lifted from the non-privileged user's own request in step 2. The token is the value lifted from the non-privileged user's own request in step 2.- The body is form-encoded.
utf8=%E2%9C%93is the usual Rails UTF-8 marker, and the threeuser[...]fields carry the new account's first name, last name and email address. The values are redacted in the published report. commit=Create+%26+Loginis the submit button value, decoded asCreate & Login. It is the submit button value, decoded asCreate & Login.Referer: https://stocky.shopifyapps.com/preferences/usersis the user management page.
The report does not include the server's response to this request.
Step 4: log in as the new account
Log out of Stocky and log in with the newly created user. According to the report, that account has admin privileges.
Root cause
The endpoint /users/create_admin created an admin account when called with a non-privileged user's session. A session belonging to a non-privileged Stocky user was accepted, and the CSRF token from that user's own session satisfied the framework's anti-forgery check, because the token was genuine; it simply belonged to a low-privileged account.
In other words, the CSRF protection worked as designed and did nothing to help here: the request was not forged, it was authorised at the wrong level. The report does not describe the code, so the exact location of the flaw is not stated. The report does not describe the code, so the exact location of the flaw is not stated; the above follows from the observed behaviour.
Impact
A non-privileged Stocky user can obtain full admin privileges within the app. The report lists what that enables: updating inventory, stock and vendors, and placing purchase orders. This is possible even if the user does not hold those privileges within Shopify itself.
The program classified the issue as medium severity with a CVSS score of 4.2, under the privilege escalation weakness, against the Shopify Developed Apps asset. The report does not record a bounty amount.
Fix
What the behaviour calls for is a server-side authorisation check on /users/create_admin that verifies the caller holds admin rights in Stocky before any account is created, so that possession of a valid session and CSRF token from a non-privileged user is not sufficient.
Variants to test
- Other named administrative endpoints in the same application. A route whose name encodes a privileged action, such as account creation with elevated rights, is worth calling directly with a low-privileged session.
- Reusing a CSRF token and cookies captured from a permitted action against a different endpoint.
- The same pattern in other Shopify-developed apps that maintain their own user records alongside Shopify staff permissions.
- The
commitparameter'sCreate & Loginbehaviour: check whether other endpoints that create objects also log the caller in as the created principal.
Hunting notes
This bug lives in the gap between two permission systems: the host platform's staff roles and the app's own user table. During recon, look for apps that create their own users and expose user management under paths such as /preferences/users, and note any endpoint names that promise an elevated outcome (create_admin and similar). Those names are a strong signal that the route exists and that its authorisation deserves a direct test.
The technique that made this report cheap to produce is worth reusing: perform an action the low-privileged account is allowed to do, capture the cookies and authenticity token, then replay them against the privileged route. It requires no guessing of parameters beyond the obvious form fields, and it demonstrates the escalation end to end by logging in as the created account.
One practical note from the program: certain types of issues in Stocky were not being accepted at the time, and the program page should be reviewed before digging into the app.
What happened, in plain words
Stocky is an app made by Shopify for keeping track of stock and ordering supplies. It lives on the web at stocky.shopifyapps.com. You open it in a browser like any other website.
Stocky has its own list of people who can use it. Those people are called users. Each user has a set of permissions, which are the things they are allowed to do. Some users are admins, meaning they can do everything. Others are limited: they can look at some things but not change important settings.
The researcher found that a limited user could create a brand new admin account. The limited user did this by sending a request straight to a part of the app called /users/create_admin. The name of that address says what it does: create an admin. The request from the limited user's session was accepted. So a user with few rights could make a powerful account, then log in as it and have full control.
This kind of problem is called privilege escalation. Privilege means how much power you have. Escalation means going up. A user climbs from low power to high power without anyone granting it.
Background you need first
What an app like Stocky is
Shopify is a platform that shops use to run their online stores. Stocky is a separate app that plugs into that world and handles inventory: how much of each product you have, which suppliers you buy from, and the purchase orders you send them. A purchase order is a formal request to a supplier to send you goods.
Stocky keeps its own user accounts. That matters. A person can have certain permissions inside Shopify itself and a different set of permissions inside Stocky. The two lists are separate. The report is about the Stocky list.
What a request is
When you click a link or press a button in a browser, the browser sends a message to a server. The server is the computer that runs the website. The message is called a request. The server sends back a reply, called a response.
Think of it like ordering at a restaurant. You tell the waiter what you want (the request), and the kitchen sends back a plate (the response). The address you are asking for, such as /users/create_admin, is like the item on the menu.
What an endpoint is
An endpoint is a specific address on a server that does a specific job. https://stocky.shopifyapps.com/users/me is the endpoint for your own profile page. /users/create_admin is the endpoint for creating an admin user. The name after the slash is a strong hint about what the endpoint is for.
What a cookie is
A cookie is a small piece of text that a website stores in your browser. It is how the site remembers who you are between page loads. When you log in, the server gives your browser a cookie. On every later request, your browser sends that cookie back, and the server uses it to recognise your session.
A session is one continuous logged-in visit. The cookie is like a wristband at an event: you show it at the door and you get in without showing your ticket again.
What a token is
A token is a secret string of characters that proves a request came from the real page and not from somewhere else. The request carries a token called the authenticity token for this purpose. The idea is to stop another website from quietly making your browser send requests on your behalf. That attack is called CSRF, short for cross-site request forgery.
The token is genuine in this report. It really did come from the limited user's own session. That is the point: the protection worked, but it was never meant to check privilege.
What a proxy or developer tools are
A browser's developer tools are a built-in panel that shows the requests the browser makes. An intercepting proxy is a separate program that sits between the browser and the server and lets you pause a request, look at it, change it, and send it on. Either one lets you capture a request and replay it, which means sending the same request again, possibly with changes.
Setting up
The report lists what you need before you start:
- A Stocky account where you can create users. You need this to set up the limited user in the first place.
- A user created inside Stocky with no admin rights. This is the attacker's starting position: a staff member with few permissions.
- A browser with developer tools, or an intercepting proxy, to capture and resend requests.
- The session cookies and the authenticity token belonging to that limited user.
The captured request shows the browser was Chrome 91 on Windows, and the request was sent over HTTP/2. HTTP/2 is simply a newer version of the language browsers and servers use to talk. No other tools are named in the report.
Finding it
The researcher's summary is one sentence: a non-privileged Stocky user, created within Stocky, may be able to create a new admin user.
The clue is the endpoint name. /users/create_admin says exactly what it does. The limited user's own session was enough to reach the endpoint. The limited user's own session was enough.
The clever part is how the request was built. Instead of guessing what the endpoint expected, the researcher took a request the limited user was allowed to make, from the profile page at https://stocky.shopifyapps.com/users/me, and reused its cookies and token against the powerful endpoint. The credentials were real. They just belonged to the wrong level of user.
Carrying out the attack
Step 1: create a limited user
Create a user inside Stocky and do not give that user admin privileges. This user is the foothold. It stands for a staff member with limited rights, the kind of account a shop might hand to someone who only needs to check stock levels.
Step 2: capture a legitimate request
Log in as the limited user and go to https://stocky.shopifyapps.com/users/me. That is the profile page. Change any field on it, for example your first name, and intercept the request the browser sends when you save.
Why this step? Because that request is one the limited user is allowed to make. It carries two things the next step needs: the session cookies, which prove who you are, and the authenticity token, which proves the request came from the real page. By taking them from a permitted action, you get valid credentials without having to forge anything.
Step 3: send the request to the admin creation endpoint
With the captured cookies and token, send a POST request to /users/create_admin. POST is the method browsers use when they are sending data to be saved, as opposed to GET, which is used for simply fetching a page.
POST /users/create_admin HTTP/2
Host: stocky.shopifyapps.com
Cookie:[REPLACE COOKIES]
Content-Length: 277
Cache-Control: max-age=0
Sec-Ch-Ua: "Chromium";v="91", " Not;A Brand";v="99"
Sec-Ch-Ua-Mobile: ?0
Upgrade-Insecure-Requests: 1
Origin: https://stocky.shopifyapps.com
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: https://stocky.shopifyapps.com/preferences/users
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close
utf8=%E2%9C%93&authenticity_token=[REPLACE TOKEN]&user%5Bfirst_name%5D=██████&user%5Blast_name%5D=████████&user%5Bemail%5D=██████████&commit=Create+%26+Login
Here is what each part means, line by line.
POST /users/create_admin HTTP/2: the method, the endpoint and the version of the protocol. This is the instruction: create an admin at this address.Host: stocky.shopifyapps.com: which website the request is for. One server can host many sites, so the server needs to know which one you mean.Cookie:[REPLACE COOKIES]: the session cookies captured in step 2. In the published report the real values are replaced with a placeholder. This is the wristband that tells the server who is asking.Content-Length: 277: how many bytes of data follow the blank line. The server uses this to know when the body has ended.Cache-Control: max-age=0: tells any cache in between not to store a stale copy. A cache is a temporary store that keeps copies of pages to speed things up.Sec-Ch-Ua,Sec-Ch-Ua-Mobile: headers in which the browser describes itself and whether it is on a mobile device. The?0means no.Upgrade-Insecure-Requests: 1: the browser saying it would prefer a secure (HTTPS) version of the page if one exists.Origin: https://stocky.shopifyapps.com: which site the request came from. Servers use this to decide whether to trust a request.Content-Type: application/x-www-form-urlencoded: the format of the body. It means the data is laid out like the fields of a web form, as name equals value pairs joined by&.User-Agent: the browser's name and version. Here it is Chrome 91 on Windows.Accept: the kinds of content the browser is willing to receive back, such as HTML pages and images.Sec-Fetch-Site: same-origin: the browser telling the server the request is going to the same site it came from.Sec-Fetch-Mode: navigate: the request is a page navigation, as if you had clicked a link.Sec-Fetch-User: ?1: the request was triggered by a person, not by a script running in the background.Sec-Fetch-Dest: document: the browser expects a full page back.Referer: https://stocky.shopifyapps.com/preferences/users: the page the request came from. That is the user management screen, which fits with the request having been shaped from the app's own interface.Accept-Encoding: gzip, deflate: the browser can accept compressed replies to save bandwidth.Accept-Language: en-US,en;q=0.9: the browser prefers English.Connection: close: close the connection after this exchange rather than keeping it open.- The blank line separates the headers from the body. Everything after it is the data being sent.
utf8=%E2%9C%93: a marker Rails puts in forms to say the text is UTF-8, a standard way of encoding characters. The encoded value decodes to a tick symbol.authenticity_token=[REPLACE TOKEN]: the anti-forgery token captured in step 2. Again the real value is replaced in the published report.user%5Bfirst_name%5D=██████,user%5Blast_name%5D=████████,user%5Bemail%5D=██████████: the new account's first name, last name and email address. The%5Band%5Dare encoded square brackets, souser%5Bfirst_name%5Dmeansuser[first_name]. The values are blacked out in the report.commit=Create+%26+Login: the value of the button that was pressed, which decodes toCreate & Login. The+stands for a space and%26stands for&. The wording is the value of the button that was pressed, which decodes toCreate & Login.
The report does not include the server's reply to this request.
Step 4: log in as the new account
Log out of Stocky and log in with the newly created user. According to the report, that account has admin privileges. That is the proof: not just that the request was accepted, but that the resulting account really is powerful.
Why it worked
The endpoint /users/create_admin created an admin account when called with a limited user's session. A session belonging to a limited user was accepted.
The anti-forgery token did not help, and it was never supposed to. The token was real, taken from the limited user's own session, so the framework's check passed. The request was not forged. It was simply allowed at the wrong level.
The report does not describe the code, so the exact place where the check was missing is not stated. That check has to happen on the server, because anything the browser does can be changed by the person using it. The explanation above follows from what was observed.
What an attacker could do with it
A limited Stocky user could gain full admin rights inside the app. The report lists what that allows: updating inventory, stock and vendors, and placing purchase orders. A vendor is a supplier you buy goods from.
The important detail is that this works even if the person does not have those rights in Shopify itself. This works even if the person does not have those rights in Shopify itself. Someone trusted with a little could take a lot.
The program rated the issue medium severity, with a CVSS score of 4.2, under the privilege escalation category, against the Shopify Developed Apps asset. CVSS is a standard scoring system for how serious a security flaw is. The report does not record a bounty amount.
How it should be fixed
The report does not describe the fix that was applied. What the behaviour calls for is a check on the server, on /users/create_admin, that confirms the caller is an admin in Stocky before any account is created. A valid session and a valid token from a limited user should not be enough on their own.
Similar things to look for
- Other endpoints with administrative names in the same app. If a route's name promises a powerful action, such as creating an account with elevated rights, try calling it directly with a limited user's session.
- Reusing cookies and a token captured from a permitted action against a different endpoint.
- The same pattern in other Shopify-made apps that keep their own user records alongside Shopify's staff permissions.
- The
Create & Loginbehaviour of thecommitparameter. Check whether other endpoints that create things also log you in as the thing they created.
Notes for anyone hunting here
This bug lives in the gap between two permission systems: the platform's staff roles and the app's own user list. While looking around, watch for apps that create their own users and put user management under paths such as /preferences/users. Note any endpoint names that promise something powerful, like create_admin. Those names are a strong signal that the route exists and that its permission check deserves a direct test.
The technique that made this report cheap to produce is worth reusing. Do something the limited account is allowed to do, capture the cookies and the authenticity token, then send them to the powerful route. You do not have to guess parameters beyond the obvious form fields, and you can show the escalation from start to finish by logging in as the created account.
One practical note from the program: at the time, certain types of issues in Stocky were not being accepted, so check the program page before spending time on the app.
Glossary
- Admin: a user with full permissions, able to change settings and manage other users.
- API: a set of addresses and rules that let one piece of software talk to another. Here the app's endpoints are the interface the browser talks to.
- Authenticity token: a secret value placed in forms by the Rails framework to prove a request came from the real page. Also called a CSRF token.
- Cache: a temporary store that keeps copies of pages or data to speed up later requests.
- Cookie: a small piece of text a website stores in your browser so it can recognise you on later requests.
- CSRF (cross-site request forgery): an attack where another website tricks your browser into sending a request you did not intend. Anti-forgery tokens exist to stop it.
- CVSS: a standard scoring system for the severity of a security flaw.
- Endpoint: a specific address on a server that performs a specific job.
- Form-encoded: a way of laying out data in a request body as name equals value pairs joined by
&, like the fields of a web form. - GET / POST: two request methods. GET fetches something; POST sends data to be saved.
- Header: a line of extra information attached to a request or response, such as the browser's name or the content type.
- HTTP/2: a version of the protocol browsers and servers use to exchange requests and responses.
- Intercepting proxy: a program that sits between browser and server and lets you pause, inspect, change and resend requests.
- Inventory: the stock of goods a shop holds.
- Origin: a header saying which site a request came from.
- Privilege: how much a user is allowed to do.
- Privilege escalation: gaining more power than you were granted, such as a limited user becoming an admin.
- Purchase order: a formal request sent to a supplier to buy goods.
- Rails: a popular framework for building web applications, used by Stocky. It supplies the authenticity token mechanism.
- Referer: a header saying which page a request came from.
- Request: a message a browser sends to a server asking it to do something.
- Response: the server's reply to a request.
- Session: one continuous logged-in visit, identified by cookies.
- Severity: how serious a flaw is judged to be, often expressed with a CVSS score.
- Stocky: a Shopify-made app for managing inventory and purchase orders.
- Token: a secret string used to prove something, such as that a request came from the real page.
- User-Agent: a header in which the browser describes its name and version.
- UTF-8: a standard way of encoding characters as bytes.
- Vendor: a supplier a shop buys goods from.
- Weakness: the category a security flaw falls into, such as privilege escalation.