IDOR expire other user sessions
An account settings endpoint that expires a user's sessions accepted a user identifier taken from the request path without checking that it belonged to the caller. An attacker could change that identifier to a victim's and force the victim to be logged out.
- Triaged in 21 hours
- Fixed in 23 hours
- Paid in 24 hours
- Disclosed after 28 hours
Hi
here attacker able to expire other user session just changing the request
Steps:
- Login as Attacker
- Go to account settings
- Click on expire all session and capture request
- replace account id with victim and forward
- victim account logged out
request POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1 Host: don432.myshopify.com User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: https://don432.myshopify.com/admin/settings/account/7641433 Cookie: __utma=1.652371099.1420114739.1428608063.1429133861.3; __utmz=1.1428608063.2.2.utmcsr=app.shopify.com|utmccn=(referral)|utmcmd=referral|utmcct=/services/signup/setup; __insp_slim=1428608118179; __insp_wid=723062851; __insp_nv=true; __insp_ref=aHR0cHM6Ly9hcHAuc2hvcGlmeS5jb20vc2VydmljZXMvc2lnbnVwL3NldHVw; __insp_norec_sess=true; _ga=GA1.2.652371099.1420114739; _ab=1; storefront_digest=b4ed3ef7ad8e531a7b8ec20bf70aa78c21eebe0f4062879ce3a064bd785bc7fe; __utmb=1.15.10.1429133861; __utmc=1; _secure_admin_session_id=ddbf71351a2a38541dee544204810315; _gat=1 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 96
utf8=%E2%9C%93&_method=patch&authenticity_token=ttrjwIKbLTYDSprUu9pAvTma%2BdxbIWn9mrjvYSb1Lok%3D
in post request just change 7641433 with victim id
hope you understand
Context
Shopify is a hosted e-commerce platform. Every store gets its own *.myshopify.com subdomain, and store staff manage the shop through an authenticated admin area under /admin. One of the account settings screens lets a store owner or staff member end the sessions of users who have access to the shop.
The report describes an insecure direct object reference in that session-expiry feature: the account identifier of the user whose sessions are to be expired is taken from the request path, and the server acts on whatever identifier it is given.
Setup
- A Shopify store on the
myshopify.comdomain, in the reportdon432.myshopify.com. - Two accounts: the attacker's own account and a victim account.
- A browser with an intercepting proxy, used to capture and modify the expiry request.
- No special tooling or version is mentioned beyond the request itself, which shows Firefox 37 on Windows.
The precondition is that the attacker already holds a valid authenticated session on the store. The bug is about acting on another user's session from inside that authenticated context, not about getting in.
Finding it
The researcher worked through the account settings screen and used the "expire all session" action while capturing traffic. The resulting request carried the target account's numeric identifier directly in the URL path:
POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1
The identifier sits in the path, and the researcher changed it to the victim's identifier.
Exploitation
Step 1: log in as the attacker
Authenticate to the store admin as the attacker account. This produces the _secure_admin_session_id cookie used in the captured request below.
Step 2: go to account settings
Navigate to the account settings area of the admin, where the session-expiry control lives.
Step 3: click expire all session and capture the request
Trigger the expiry action with the proxy in intercept mode. The captured request is:
POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1
Host: don432.myshopify.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://don432.myshopify.com/admin/settings/account/7641433
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 96
utf8=%E2%9C%93&_method=patch&authenticity_token=[redacted]
The important parts:
- The path segment
7641433is the account identifier of the user whose sessions will be expired. _method=patchin the body overrides the POST method to PATCH, so the action is a state-changing update routed through a POST.authenticity_tokenis the CSRF token sent with the request.- The
Refererpoints at an account settings page with the same identifier.
Step 4: replace the account id with the victim's and forward
The researcher changed 7641433 in the path to the victim's account identifier and forwarded the request.
Step 5: the victim is logged out
The result was that the victim account was logged out. The victim account was logged out.
Root cause
The endpoint takes its target from the path parameter, and the request succeeded against another account. The CSRF token proves the request came from the attacker's own browser session, which is all it is designed to prove; it says nothing about which account the request may act on. Authorisation for the object in the path is simply missing, which is the classic IDOR pattern. The report does not include the server-side code, so the exact check that was absent is inferred from the behaviour rather than shown.
Impact
An authenticated user can expire the sessions of another user by supplying that user's account identifier. The victim is logged out and must authenticate again. The report does not describe any further consequence, such as session theft or privilege change, and the effect shown is denial of the victim's active session. The attacker needs a valid session and the victim's numeric account identifier.
Fix
The report does not state what change was made. The fix that follows from the root cause is a server-side authorisation check on the endpoint: confirm that the account identifier in the path belongs to the caller, or that the caller holds a role permitted to expire that user's sessions, before performing the action. Treating the identifier as untrusted input and resolving the target from the authenticated session rather than the path would also close the gap.
Variants to test
- Other per-user admin actions. Look for endpoints that take a user or staff identifier in the path or body, such as role changes, removal of store access, or password resets for staff, and swap in another user's identifier. A positive result is the action taking effect on the other account while you are authenticated as your own.
- Identifier in the body instead of the path. Where the target is a form field rather than a path segment, change the field value and keep your own CSRF token. A positive result is the same cross-account effect.
- Sequential identifiers. Numeric identifiers like the one in this report invite enumeration. Try neighbouring values and note whether the response differs between a valid and an invalid target, which tells you whether the endpoint leaks existence.
- Method override. The request here uses
_method=patchover POST. Try the same override on related endpoints to see whether authorisation is enforced on the overridden method path.
Hunting notes
Session-management and account-settings screens are good places to look, because they act on user objects and are often written with the assumption that only the right person reaches them. During recon, watch for admin URLs that embed a numeric account or user identifier, especially state-changing actions reached by a button on a settings page. Capturing the request and checking whether the identifier is echoed from your own session or taken from the request is the quickest signal. The researcher demonstrated impact simply and convincingly: capture your own request, change one identifier, and show the other account being logged out.
What happened, in plain words
Shopify is a service that lets anyone run an online shop. When you sign up, your shop gets its own web address ending in myshopify.com, for example don432.myshopify.com. The people who run the shop (the owner and any staff) log in to a private admin area, found under /admin, where they manage products, orders and settings.
One of those settings screens lets someone end login sessions. A session is the period during which you stay logged in after typing your password: the website remembers you, usually with a small piece of data stored in your browser called a cookie. Ending a session means the person is logged out and has to type their password again.
The report describes what happened when the request was changed. When you click the button to end someone's sessions, your browser sends a request to the server, and that request contains a number identifying which account should be logged out. Changing the number to another user's account logged that user out. So the researcher changed the number to another user's account and that other user was logged out.
This kind of flaw has a name: an insecure direct object reference, usually shortened to IDOR. "Object" here just means a thing stored on the server, such as a user account. "Direct reference" means the request points at that thing by its identifier (here, a number). "Insecure" means the server does not check whether you are allowed to touch the thing you named. A simple comparison: imagine a hotel where every room key opens every door, because the door only checks that you have a key, not that it is the key for that room.
Context
Every Shopify store lives on its own *.myshopify.com subdomain. Store staff manage the shop through an authenticated admin area under /admin. One of the account settings screens lets a user end sessions.
The report describes changing the account identifier in the request path to expire another user's sessions.
A request path is the part of a web address after the domain name, the bit that tells the server which page or action you want. When a number sits inside that path, the server can read it and use it to decide what to act on. If the server does not also check who is asking, that number becomes a way to reach other people's data.
Setup
- A Shopify store on the
myshopify.comdomain, in the reportdon432.myshopify.com. - Two accounts: the attacker's own admin account and a victim account.
- A way to capture and modify the expiry request.
- No special tooling or version is mentioned beyond the request itself, which shows Firefox 37 on Windows.
An intercepting proxy is a program that sits between your browser and the website. Instead of the browser talking straight to the server, the traffic passes through the proxy, which can pause it, show it to you, and let you edit it before it continues. It is like a postal worker who opens your letter, lets you rewrite a line, and then seals it and delivers it.
The attacker is already logged in to the store admin when the request is sent. The bug is about acting on another user's session from inside that authenticated context, not about getting in. In other words, the attacker is already a legitimate user of the shop; the flaw lets that legitimate user affect someone else.
Finding it
The researcher went to account settings, clicked expire all session and captured the request. The resulting request carried the target account's numeric identifier directly in the URL path:
POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1
Line by line:
POSTis the type of request. Browsers use different request types for different jobs:GETis normally used to fetch a page,POSTis normally used to send data or trigger an action. Here the browser is asking the server to do something, namely expire sessions./admin/settings/account/expire_specific_users_sessions/7641433is the path. Reading it left to right: it is inside the admin area, under settings, under account, and the action is "expire specific user's sessions". The final7641433is the account identifier of the user whose sessions will be expired.HTTP/1.1is the version of the language the browser and server use to talk to each other.
Because that identifier is client-supplied and sits in the path, it looked like a candidate for an IDOR: if the server does not check that the caller is allowed to expire the sessions of the account named in the path, changing the number should expire someone else's sessions. "Client-supplied" means the value comes from your side, from the browser, so you can change it before it reaches the server. The researcher changed the number and forwarded the request.
Exploitation
Step 1: log in as the attacker
Authenticate to the store admin as the attacker account. This produces the _secure_admin_session_id cookie used in the captured request below.
A cookie is a small piece of text that a website asks your browser to store and send back with every later request to that site. The captured request includes a _secure_admin_session_id cookie. Without it, the server would treat the request as coming from a stranger.
Step 2: go to account settings
Navigate to the account settings area of the admin, where the session-expiry control lives.
Step 3: click expire all session and capture the request
Trigger the expiry action and capture the request. The captured request is:
POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1
Host: don432.myshopify.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://don432.myshopify.com/admin/settings/account/7641433
Cookie: [redacted]
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 96
utf8=%E2%9C%93&_method=patch&authenticity_token=[redacted]
Line by line:
POST /admin/settings/account/expire_specific_users_sessions/7641433 HTTP/1.1is the request line: the action type, the path with the target account number, and the protocol version.Host: don432.myshopify.comtells the server which website the request is for. One server can host many sites, so it needs to know which one you mean.User-Agent: ...describes the browser that sent the request. Here it says Firefox 37 on 64-bit Windows. Servers often use this to tailor their response.Accept: ...lists the kinds of content the browser is willing to receive, such as HTML pages or XML data.Accept-Language: en-US,en;q=0.5says the browser prefers English, with a quality value of 0.5 for plainen.Accept-Encoding: gzip, deflatesays the browser can accept compressed responses, which saves bandwidth.Referer: https://don432.myshopify.com/admin/settings/account/7641433tells the server which page the request came from. The Referer points at an account settings page with the identifier 7641433.Cookie: [redacted]carries the stored cookies, including the admin session cookie that proves the attacker is logged in. The actual values are hidden here because they are secrets: anyone holding them could act as that user.Connection: keep-aliveasks the server to keep the network connection open for further requests instead of closing it after this one.Content-Type: application/x-www-form-urlencodedsays the body of the request is formatted like a web form, as pairs of names and values.Content-Length: 96says the body is 96 bytes long, so the server knows where it ends.- The blank line separates the headers (the labelled lines above) from the body (the data being sent).
utf8=%E2%9C%93&_method=patch&authenticity_token=[redacted]is the body. It is a set of name=value pairs joined by&.utf8=%E2%9C%93is an encoded checkmark character._method=patchis a field in the request body.authenticity_tokenis a security token, explained below.
The important parts:
- The path segment
7641433is the account identifier of the user whose sessions will be expired. In the captured request it is the account used when the action was triggered. _method=patchin the body overrides the POST method to PATCH, so the action is a state-changing update routed through a POST. PATCH is a request type meant for changing something that already exists.authenticity_tokenis a token sent in the request body.
CSRF stands for cross-site request forgery. It is an attack where a malicious website tricks your browser into sending a request to another site where you are logged in. To defend against it, sites include a secret, unpredictable token in each form; a request without the correct token is rejected. The key point here is what the token does not do: it proves the request came from the attacker's own browser session, but it says nothing about which account the request is allowed to act on. It is like a stamped envelope that proves you posted the letter yourself, not that you were allowed to write to that address.
Step 4: replace the account id with the victim's and forward
The researcher changed 7641433 to the victim's identifier and forwarded the request. The researcher changed 7641433 in the request to the victim's identifier and forwarded it.
This is the heart of the test.
Step 5: the victim is logged out
The result was that the victim account was logged out. The victim account was logged out after the identifier was changed.
Root cause
Changing the identifier in the path logged out the other account, which points to a missing authorisation check. The CSRF token proves the request came from the attacker's own browser session, which is all it is designed to prove; it says nothing about which account the request may act on. Authorisation for the object in the path is simply missing, which is the classic IDOR pattern.
An endpoint is a specific address on a server that performs a specific job, like a service counter in a large building. Authentication and authorisation are often confused, so it helps to separate them: authentication is proving who you are (showing your passport), while authorisation is deciding what you are allowed to do (whether your ticket lets you into this particular room). Here the attacker was properly authenticated; the missing piece was authorisation.
Impact
An authenticated admin user can expire another user's sessions by supplying that user's account identifier. The victim is logged out and must authenticate again. The report does not describe any further consequence, such as session theft or privilege change, and the effect shown is denial of the victim's active session. The attacker needs a valid admin session and the victim's numeric account identifier.
Fix
The report does not state what change was made.
"Server-side" means the check must happen on the server, not in the browser. Anything the browser does can be changed by the user, so a check that only exists in the page is no protection at all.
Variants to test
Enumeration means trying a series of values one after another, for example 7641432, 7641433, 7641434, to discover which ones exist. If the server answers differently for a real account than for a made-up one, it is leaking information about which accounts exist.
Hunting notes
The researcher captured their own request, changed one identifier, and showed the other account being logged out.
Recon, short for reconnaissance, is the early stage of looking around a target to understand how it is built before testing anything. A state-changing action is one that alters data on the server, such as logging someone out, changing a role or deleting something, as opposed to simply viewing a page.
Glossary
-
API: a defined way for one piece of software to ask another to do something, like a service counter with fixed rules for what you can request.
-
Authentication: proving who you are, usually by logging in with a password.
-
Authorisation: deciding what an authenticated person is allowed to do.
-
Cookie: a small piece of data a website stores in your browser and receives back on later requests, often used to keep you logged in.
-
CSRF (cross-site request forgery): an attack that tricks your browser into sending a request to a site where you are logged in; sites defend against it with secret tokens.
-
CSRF token / authenticity_token: a secret, unpredictable value placed in forms so the server can tell a genuine request from a forged one.
-
Endpoint: a specific address on a server that performs a specific action.
-
Enumeration: trying a series of values, such as consecutive numbers, to discover which ones exist.
-
GET / POST / PATCH: types of HTTP request; GET normally fetches, POST normally sends data or triggers an action, PATCH normally changes something that already exists.
-
Header: a labelled line in a request or response carrying extra information, such as the browser type or cookies.
-
Host: the header that tells the server which website the request is for.
-
HTTP: the language browsers and servers use to exchange requests and responses.
-
IDOR (insecure direct object reference): a flaw where a request names a stored object by its identifier and the server does not check that you are allowed to access that object.
-
Intercepting proxy: a tool that sits between browser and server, letting you view and edit traffic before it is sent.
-
Method override (
_method): a hidden form field that tells the server to treat a POST as another request type such as PATCH. -
Path: the part of a web address after the domain name that identifies the page or action.
-
Recon (reconnaissance): the early stage of exploring a target to understand how it works before testing.
-
Referer: a header telling the server which page the request came from.
-
Request body: the data sent along with a request, after the headers.
-
Session: the period during which a site remembers you as logged in.
-
State-changing action: an action that alters data on the server, such as logging someone out or changing a role.
-
Subdomain: a prefix on a domain name, such as
don432indon432.myshopify.com, giving a site its own address. -
User-Agent: a header describing the browser and operating system that sent the request.