IDOR on stocky application-Low Stock-Varient-Settings-Columns
The Stocky app accepted a settings update request for low-stock variant columns without checking that the target record belonged to the requesting user. An attacker with their own store could change another store's column settings by swapping the record identifier in the request.
- Triaged in 4 days
- Fixed in 9 days
- Paid in 6 days
- Disclosed after 3 months
Hello, I have found a IDOR on stocky application Low Stock-Varient-Settings-Columns attribute, in fact malicious user can change the columns of another user.
POC: 1)Create two user A and B, login to A and create a store, test.myshopify.com login to user B and create a store test1.myshopify.com
2)Install stocky application on both the store.
3)Go to user A store and click stocky applicaton and that will take you to https://app.stockyhq.com/ and go to https://app.stockyhq.com/dashboard/ and click low stock variants.
- Go to settings and lick Columns and change the columns settings and turn on the burpsuite and click update, you will recieve below packet.
POST /settings_for_low_stock_variants/111111 HTTP/1.1 Host: app.stockyhq.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 Accept-Language: en-GB,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://app.stockyhq.com/dashboard/low_stock Content-Type: application/x-www-form-urlencoded Content-Length: 968 Origin: https://app.stockyhq.com Connection: close Cookie: utf8=%E2%9C%93&_method=put&authenticity_token=HlhsW6AETAE9Mi7pLqJY%2FdE4jVWu53pNWFrVhkhLcoWuT%2FwBK6c2TDrvxWDZiRDRvwaw3DoXzZ7gAatGF4sRww%3D%3D&settings_for_low_stock_variant%5Bshow_grade%5D=0&settings_for_low_stock_variant%5Bshow_product_title%5D=0&settings_for_low_stock_variant%5Bshow_variant_title%5D=0&settings_for_low_stock_variant%5Bshow_sku%5D=0&settings_for_low_stock_variant%5Bshow_lost_per_day%5D=0&settings_for_low_stock_variant%5Bshow_reorder_point%5D=0&settings_for_low_stock_variant%5Bshow_lead_time%5D=0&settings_for_low_stock_variant%5Bshow_need%5D=0&settings_for_low_stock_variant%5Bshow_depletion_days%5D=0&settings_for_low_stock_variant%5Bshow_depletion_date%5D=0&settings_for_low_stock_variant%5Bshow_next_due_date%5D=0&settings_for_low_stock_variant%5Bshow_stock%5D=0&settings_for_low_stock_variant%5Bshow_on_po%5D=0&settings_for_low_stock_variant%5Bshow_on_order%5D=0&settings_for_low_stock_variant%5Bshow_shopify_products_only%5D=0&commit=Update
- Replace the variants id with user B store variants id the POST request as below.
POST /settings_for_low_stock_variants/111112 HTTP/1.1
6)Send it and you can see 302 message.
7)Go to user B and look at the columns in low variants stock and you can see that the change took in place.
NB: Please find the video POC
Impact
This is a IDOR, make sure to put in place controls
Attachments
Context
Stocky is a Shopify-developed application for inventory management. It runs at https://app.stockyhq.com/ and is installed on a Shopify store, so a merchant reaches it from the Shopify admin. One of its screens is the low stock variants dashboard at https://app.stockyhq.com/dashboard/low_stock, which lists variants that are running low.
The dashboard has a Columns setting that controls which fields are shown in that list, for example grade, product title, variant title, SKU, lost per day, reorder point, lead time, need, depletion days, depletion date, next due date, stock, on PO and on order. Saving the setting sends a form POST to a per-record path, /settings_for_low_stock_variants/<id>, with the column choices in the body.
The report describes an insecure direct object reference in that save action: the identifier in the path is not tied to the caller, so one merchant can change the column settings of another merchant's store.
Setup
Two Shopify stores and two users are needed:
- User A with a store at
test.myshopify.com. - User B with a store at
test1.myshopify.com. - The Stocky application installed on both stores.
- A proxy such as Burp Suite to capture and replay the save request.
The researcher worked from Firefox 75 on Windows, as shown in the captured request headers.
Finding it
The Columns form is saved with a POST to a URL that carries a numeric identifier, /settings_for_low_stock_variants/111111. That identifier is the only thing that says whose settings are being written. Nothing in the visible request ties it to the logged-in user, so the natural test is to swap it for the identifier belonging to a different store and see whether the server accepts the write.
Exploitation
Step 1: create two stores and users
Create user A and user B. Log in as A and create the store test.myshopify.com. Log in as B and create the store test1.myshopify.com.
Step 2: install Stocky on both stores
Install the Stocky application on both stores so that each has its own low stock variants settings record.
Step 3: reach the low stock variants screen as user A
Go to user A's store, click the Stocky application, which takes you to https://app.stockyhq.com/, then go to https://app.stockyhq.com/dashboard/ and click low stock variants.
Step 4: capture the save request
Go to settings, click Columns, change the column settings, turn on Burp Suite and click update. The following request is captured:
POST /settings_for_low_stock_variants/111111 HTTP/1.1
Host: app.stockyhq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://app.stockyhq.com/dashboard/low_stock
Content-Type: application/x-www-form-urlencoded
Content-Length: 968
Origin: https://app.stockyhq.com
Connection: close
Cookie:
utf8=%E2%9C%93&_method=put&authenticity_token=HlhsW6AETAE9Mi7pLqJY%2FdE4jVWu53pNWFrVhkhLcoWuT%[redacted]%3D%3D&settings_for_low_stock_variant%5Bshow_grade%5D=0&settings_for_low_stock_variant%5Bshow_product_title%5D=0&settings_for_low_stock_variant%5Bshow_variant_title%5D=0&settings_for_low_stock_variant%5Bshow_sku%5D=0&settings_for_low_stock_variant%5Bshow_lost_per_day%5D=0&settings_for_low_stock_variant%5Bshow_reorder_point%5D=0&settings_for_low_stock_variant%5Bshow_lead_time%5D=0&settings_for_low_stock_variant%5Bshow_need%5D=0&settings_for_low_stock_variant%5Bshow_depletion_days%5D=0&settings_for_low_stock_variant%5Bshow_depletion_date%5D=0&settings_for_low_stock_variant%5Bshow_next_due_date%5D=0&settings_for_low_stock_variant%5Bshow_stock%5D=0&settings_for_low_stock_variant%5Bshow_on_po%5D=0&settings_for_low_stock_variant%5Bshow_on_order%5D=0&settings_for_low_stock_variant%5Bshow_shopify_products_only%5D=0&commit=Update
The important parts are the path, which names the settings record by number, and the body. The body uses _method=put to tunnel a PUT through a POST, carries a Rails authenticity_token, and sets each column with a settings_for_low_stock_variant[show_...] field. In this capture every column is set to 0, which turns them all off.
Step 5: swap the identifier
Replace the variants id in the path with the id belonging to user B's store. The request then begins:
POST /settings_for_low_stock_variants/111112 HTTP/1.1
Step 6: send it
Send the modified request. The server answers with a 302 redirect, which in this form-driven flow is the normal success response for the update.
Step 7: confirm the change on the other store
Go to user B and look at the columns in the low stock variants screen. The change made through user A's session is in place.
Root cause
The save action looks up the settings record purely from the identifier in the URL and writes the submitted column values to it. It does not check that the record belongs to the store of the authenticated user making the request. The authenticity_token in the body only proves that the request came from a page served to the logged-in session; it does not bind the target record to that session. The identifier is a number, and the two records in the report differ by one, so neighbouring values are worth trying. The report does not show the server-side code, so the exact lookup and authorisation logic is not described; the behaviour is consistent with a missing ownership check on the record.
Impact
An authenticated Stocky user can modify the low stock variants column settings of another merchant's store, provided they know or can guess the identifier of that store's settings record. The effect is limited to that display configuration: the report describes changing which columns are shown, not reading or altering inventory data. The researcher rates it as an IDOR and asks for controls to be put in place. The report does not describe any further consequence of the change.
Fix
The control it asks for is an authorisation check on the save action: the settings record named in the path should be resolved only within the stores the authenticated user is entitled to, and a request for any other record should be rejected rather than applied.
Variants to test
- Swap the numeric identifier on other per-record form actions in the same application, such as settings, preferences or saved views. A positive result is a 302 or 200 success response and a visible change in the second account.
- Try neighbouring identifiers around your own record to see whether the application distinguishes your records from others. A positive result is any accepted write to a record you do not own.
- Repeat the write with the second account's session and check the first account's screen, to confirm the change is persistent and not a cached view.
- Test whether the same identifier can be used on read actions, not only writes, to see whether other users' configuration can be disclosed.
Hunting notes
This kind of bug hides in per-record form endpoints where the record is named by a number in the path and the body carries only the new values. The signal during recon is a save request whose URL contains a small sequential id and whose body has no field identifying the owner. Two accounts on the same multi-tenant product make the test cheap: capture the save as one user, change the id to the other user's record, send, and then look at the second user's screen. The researcher's final step is to check the second store's columns for the change.
What happened, in plain words
Stocky is an inventory management application made by Shopify. It runs at https://app.stockyhq.com/ and is installed on a Shopify store, so a merchant reaches it from the Shopify admin. One of its screens is the low stock variants dashboard at https://app.stockyhq.com/dashboard/low_stock, which lists product variants that are running low on stock.
That dashboard has a Columns setting that controls which fields appear in the list, for example grade, product title, variant title, SKU, lost per day, reorder point, lead time, need, depletion days, depletion date, next due date, stock, on PO and on order. When you save that setting, your browser sends a form POST to a per-record path, /settings_for_low_stock_variants/<id>, with your column choices in the body.
The report describes an insecure direct object reference in that save action: the identifier in the path is not tied to the caller, so one merchant can change the column settings of another merchant's store.
A useful everyday comparison: imagine a hotel where every guest's room key is just a number written on a card, and the front desk hands out a new key to anyone who asks for "room 111112", without checking whether that person is staying in that room. The number is the only thing that decides which room you get into. An IDOR is the same idea in a web application: the application takes an identifier from the request (here, the number in the URL) and acts on the record it names, without checking that the person making the request is allowed to touch that record.
Setup
Two Shopify stores and two users are needed:
- User A with a store at
test.myshopify.com. - User B with a store at
test1.myshopify.com. - The Stocky application installed on both stores.
- A proxy such as Burp Suite to capture and replay the save request.
A proxy is a program that sits between your browser and the website. Your browser sends its requests to the proxy instead of straight to the server, the proxy shows you the request, and then forwards it on. That lets you read exactly what your browser sent, change a value, and send it again. Burp Suite is one such tool.
The researcher worked from Firefox 75 on Windows, as shown in the captured request headers.
Finding it
The Columns form is saved with a POST to a URL that carries a numeric identifier, /settings_for_low_stock_variants/111111. That identifier is the only thing that says whose settings are being written. Nothing in the visible request ties it to the logged-in user, so the natural test is to swap it for the identifier belonging to a different store and see whether the server accepts the write.
A POST is one of the standard request methods a browser uses to send data to a server, typically when you submit a form. The URL is the address the request goes to, and the part after the last slash here is a number that names one particular settings record.
Exploitation
Step 1: create two stores and users
Create user A and user B. Log in as A and create the store test.myshopify.com. Log in as B and create the store test1.myshopify.com.
Two separate accounts are needed because the whole test is about whether one account can affect the other. If you only had one account, you could not tell whether a change landed in someone else's data or your own.
Step 2: install Stocky on both stores
Install the Stocky application on both stores so that each has its own low stock variants settings record.
Each store gets its own record, and each record has its own number. That is what makes the swap in step 5 meaningful: user A's record and user B's record are different objects with different identifiers.
Step 3: reach the low stock variants screen as user A
Go to user A's store, click the Stocky application, which takes you to https://app.stockyhq.com/, then go to https://app.stockyhq.com/dashboard/ and click low stock variants.
You do this as user A because you want to capture a legitimate save request made by A, which you will then modify to point at B's record.
Step 4: capture the save request
Go to settings, click Columns, change the column settings, turn on Burp Suite and click update. The following request is captured:
POST /settings_for_low_stock_variants/111111 HTTP/1.1
Host: app.stockyhq.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://app.stockyhq.com/dashboard/low_stock
Content-Type: application/x-www-form-urlencoded
Content-Length: 968
Origin: https://app.stockyhq.com
Connection: close
Cookie:
utf8=%E2%9C%93&_method=put&authenticity_token=HlhsW6AETAE9Mi7pLqJY%2FdE4jVWu53pNWFrVhkhLcoWuT%[redacted]%3D%3D&settings_for_low_stock_variant%5Bshow_grade%5D=0&settings_for_low_stock_variant%5Bshow_product_title%5D=0&settings_for_low_stock_variant%5Bshow_variant_title%5D=0&settings_for_low_stock_variant%5Bshow_sku%5D=0&settings_for_low_stock_variant%5Bshow_lost_per_day%5D=0&settings_for_low_stock_variant%5Bshow_reorder_point%5D=0&settings_for_low_stock_variant%5Bshow_lead_time%5D=0&settings_for_low_stock_variant%5Bshow_need%5D=0&settings_for_low_stock_variant%5Bshow_depletion_days%5D=0&settings_for_low_stock_variant%5Bshow_depletion_date%5D=0&settings_for_low_stock_variant%5Bshow_next_due_date%5D=0&settings_for_low_stock_variant%5Bshow_stock%5D=0&settings_for_low_stock_variant%5Bshow_on_po%5D=0&settings_for_low_stock_variant%5Bshow_on_order%5D=0&settings_for_low_stock_variant%5Bshow_shopify_products_only%5D=0&commit=Update
Line by line, in plain words:
POST /settings_for_low_stock_variants/111111 HTTP/1.1is the request line.POSTis the method, the path names the settings record by the number111111, andHTTP/1.1is the version of the protocol being spoken.Host: app.stockyhq.comsays which website the request is for. One server can host many sites, so the request has to name the one it wants.User-Agent: ...tells the server which browser and operating system sent the request. Here it is Firefox 75 on Windows.Accept: ...lists the kinds of response the browser is willing to receive, such as HTML pages, XML or images.Accept-Language: en-GB,en;q=0.5says the browser prefers British English, with a lower preference for English in general.Accept-Encoding: gzip, deflatesays the browser can accept a compressed response to save bandwidth.Referer: https://app.stockyhq.com/dashboard/low_stocktells the server which page the request came from, in this case the low stock dashboard.Content-Type: application/x-www-form-urlencodedsays the body is formatted like a URL query string, withname=valuepairs joined by&.Content-Length: 968is the size of the body in bytes.Origin: https://app.stockyhq.comnames the site the request originated from. Servers use it for cross-origin checks.Connection: closeasks the server to close the network connection after this response instead of keeping it open.Cookie:is the header that carries cookies. A cookie is a small piece of data the site stored in your browser earlier, and the browser sends it back with every request so the server can recognise your session. A session is the server's memory of "this is the person who logged in a moment ago". In this capture the cookie value is empty, which is worth noting: the request as shown does not carry a session cookie.- The body is one long line of
name=valuepairs.utf8=%E2%9C%93is a marker that the form was submitted as UTF-8, the standard character encoding._method=putis a trick used by web frameworks: browsers can only send GET and POST from a plain form, so the application puts_method=putin the body to tell the server "treat this as a PUT", which is the method normally used to update an existing record. authenticity_token=...is a security token generated by the server and embedded in the page. It is meant to prove the request came from a page the server actually served to the logged-in session, which defends against cross-site request forgery (CSRF), where another site tricks your browser into submitting a form you did not intend. It is not a check on which record you are allowed to change.- Each
settings_for_low_stock_variant%5Bshow_...%5D=0pair sets one column.%5Band%5Dare the URL-encoded forms of[and], sosettings_for_low_stock_variant[show_grade]is the field name and0is its value. In this capture every column is set to0, which turns them all off. commit=Updateis the name and value of the button that was pressed.
The important parts are the path, which names the settings record by number, and the body. The body uses _method=put to tunnel a PUT through a POST, carries a Rails authenticity_token, and sets each column with a settings_for_low_stock_variant[show_...] field.
Step 5: swap the identifier
Replace the variants id in the path with the id belonging to user B's store. The request then begins:
POST /settings_for_low_stock_variants/111112 HTTP/1.1
This is the whole attack. The only change is the number at the end of the path: 111111 becomes 111112. Everything else, including the token and the column values, stays as it was. If the server checks ownership properly, it should refuse because the record 111112 does not belong to user A. If it does not check, it will write the values to B's record.
Step 6: send it
Send the modified request. The server answers with a 302 redirect, which in this form-driven flow is the normal success response for the update.
HTTP status codes are three-digit numbers the server uses to summarise the result. A 302 means "the thing you asked for is elsewhere, go there instead", and web applications commonly use it after a successful form submission to send the browser back to a results page. Seeing a 302 here is a sign the update was accepted rather than rejected.
Step 7: confirm the change on the other store
Go to user B and look at the columns in the low stock variants screen. The change made through user A's session is in place.
This last step is where you check whether the change made as A appears in B's store.
Root cause
The save action looks up the settings record purely from the identifier in the URL and writes the submitted column values to it. It does not check that the record belongs to the store of the authenticated user making the request. The authenticity_token in the body only proves that the request came from a page served to the logged-in session; it does not bind the target record to that session. The identifier is a number, and the two records in the report differ by one, so neighbouring values are worth trying. The report does not show the server-side code, so the exact lookup and authorisation logic is not described; the behaviour is consistent with a missing ownership check on the record.
"Sequential" means the numbers follow one another, as 111111 and 111112 do here. "Enumerate" means trying a series of values one after another to find the ones that exist.
Impact
An authenticated Stocky user can modify the low stock variants column settings of another merchant's store, provided they know or can guess the identifier of that store's settings record. The effect is limited to that display configuration: the report describes changing which columns are shown, not reading or altering inventory data. The researcher rates it as an IDOR and asks for controls to be put in place. The report does not describe any further consequence of the change.
Fix
The control it asks for is an authorisation check on the save action: the settings record named in the path should be resolved only within the stores the authenticated user is entitled to, and a request for any other record should be rejected rather than applied.
In plain terms: before writing, the server should ask "does this record belong to a store this logged-in user is allowed to manage?" and refuse if the answer is no. The number in the URL should never be trusted on its own.
Variants to test
- Swap the numeric identifier on other per-record form actions in the same application, such as settings, preferences or saved views. A positive result is a 302 or 200 success response and a visible change in the second account.
- Try neighbouring identifiers around your own record to see whether the application distinguishes your records from others. A positive result is any accepted write to a record you do not own.
- Repeat the write with the second account's session and check the first account's screen, to confirm the change is persistent and not a cached view.
- Test whether the same identifier can be used on read actions, not only writes, to see whether other users' configuration can be disclosed.
A 200 status code means "OK, here is the result". A cached view is a copy of a page your browser or a server kept from earlier, which can make a change look like it did or did not happen when it did the opposite.
Hunting notes
This kind of bug hides in per-record form endpoints where the record is named by a number in the path and the body carries only the new values. The signal during recon is a save request whose URL contains a small sequential id and whose body has no field identifying the owner. Two accounts on the same multi-tenant product make the test cheap: capture the save as one user, change the id to the other user's record, send, and then look at the second user's screen. The researcher's final step is to check the second store's columns for the change.
"Recon" is short for reconnaissance: the early, quiet phase of looking at how an application works before trying anything. "Multi-tenant" means one product serves many separate customers from the same installation, each with their own data, which is exactly the situation where an ownership check matters most.
Glossary
- API: a defined way for one piece of software to talk to another, usually over the web with requests and responses.
- Application (app): a program you use through a browser or a phone, as opposed to a website that only shows pages.
- Authenticity token: a value generated by the server and placed in a form, used to prove the request came from a page the server served, which defends against cross-site request forgery.
- Authorisation: the check that a logged-in user is allowed to do a particular thing to a particular record.
- Body: the part of an HTTP request that carries data, such as form fields, as opposed to the headers.
- Burp Suite: a tool that sits between your browser and a website so you can inspect, change and resend requests.
- Cache: a stored copy of something, kept so it can be served again faster, which can make a page look out of date.
- Cookie: a small piece of data a site stores in your browser and the browser sends back with each request, often used to identify your session.
- Cross-site request forgery (CSRF): an attack where another website tricks your browser into submitting a request to a site you are logged in to.
- CSRF: see cross-site request forgery.
- Dashboard: a screen that gathers information and controls in one place.
- Enumeration: trying a series of values one after another to discover which ones exist.
- Form: the part of a web page with fields and a submit button that sends data to the server.
- GET: an HTTP method used to ask for something, such as a page, without changing it.
- Header: a line in an HTTP request or response carrying metadata, such as the host, the browser type or a cookie.
- Host: the name of the website a request is addressed to, such as
app.stockyhq.com. - HTTP: the protocol browsers and servers use to exchange requests and responses.
- HTTP status code: a three-digit number in a response summarising the result, such as 200 for OK or 302 for a redirect.
- IDOR (insecure direct object reference): a bug where the application takes an identifier from the request and acts on the record it names without checking that the requester is allowed to.
- Identifier (id): a value, often a number, that names one particular record among many.
- Inventory management: keeping track of what stock a shop has, where it is and when to reorder.
- Merchant: the shop owner or operator who uses the application.
- Method: the word at the start of an HTTP request saying what kind of action it is, such as GET or POST.
- Multi-tenant: one installation of a product serving many separate customers, each with their own data.
- Origin: a header naming the site a request came from, used for cross-origin checks.
- Path: the part of a URL after the host name, such as
/settings_for_low_stock_variants/111111. - POST: an HTTP method used to send data to the server, typically when submitting a form.
- Proxy: a program that relays traffic between your browser and a server so you can inspect and modify it.
- PUT: an HTTP method normally used to update an existing record.
- Recon (reconnaissance): the early phase of studying how an application works before attempting anything.
- Redirect: a response telling the browser to go to a different address instead.
- Referer: a header telling the server which page the request came from.
- Request: a message a browser sends to a server asking for something or submitting data.
- Response: the message a server sends back to a browser.
- Rails: a web framework for the Ruby programming language, which uses conventions such as
_methodandauthenticity_token. - Record: one stored item in a database, such as one store's settings.
- Sequential: following one another in order, like 1, 2, 3, which makes numbers easy to guess.
- Session: the server's memory of who you are after you log in, usually tied to a cookie.
- SKU: a stock keeping unit, a code a shop uses to identify a particular product variant.
- Stocky: a Shopify-developed inventory management application.
- Token: a value used to prove something, such as that a request came from a genuine page or that a user is logged in.
- URL: the address of something on the web, such as
https://app.stockyhq.com/dashboard/low_stock. - URL encoding: writing special characters in a URL-safe form, such as
%5Bfor[and%5Dfor]. - User-Agent: a header telling the server which browser and operating system sent the request.
- UTF-8: a standard way of encoding characters so text can be stored and sent reliably.
- Variant: a specific version of a product, such as a size or colour, which is what stock is tracked against.
- Vulnerability class: a family of bugs that share the same underlying mistake, such as IDOR.