Insufficient session expiration in the **com.shopify.ping** android app
The Shopify Ping Android app did not invalidate the OAuth access token when the user logged out, because the logout request was missing a required token hint and the server rejected it. An attacker who obtained the token could continue to use it to access the user's account after logout.
- Triaged in 4 days
- Fixed in 4 months
- Paid in 6 days
- Disclosed after 7 months
It was identified that despite a logout action will be taken by the user at the com.shopify.ping application, the authentication token is not invalidated which allows fully recovery of the initially acquired session. More specifically, after the user provides the required credentials, an access_token will be fetched from the server at accounts.shopify.com/oauth/token. After establishing a session and by selecting logout from the corresponding control, the application will send the following DELETE request:
DELETE /api/v1/logout HTTP/1.1
authorization: Bearer atkn_**********************************
Host: accounts.shopify.com
Connection: close
Cookie: __cfduid=***********; _y=***************; _shopify_y=***************; request_method=POST
User-Agent: okhttp/3.12.12
The server will reply as follows:
{"error":"Missing Logout Token Hint"}
And will cancel the invalidation process, as the token will still be valid on a subsequent request (e.g.):
GET /oauth/userinfo HTTP/1.1
Accept-Encoding: gzip, deflate
authorization: Bearer ***************
....
REPLY:
{"sub":"...","email":"[email protected]","email_verified":true,"family_name":"Doe","given_name":"....","locale":"en","name":".... ...","nickname":".....","updated_at":.....,"zoneinfo":"....","tfa_enabled":false}
Impact
An application should always revoke an access token by the time that the end user choses to Log Off from a session. Keeping a token active, while the user is not aware of it imposes a big risk, since by the time that an unauthorised entity fetches it, may recover a fully "functional" session.
Context
The target is the com.shopify.ping Android application, part of Shopify's mobile applications, which are in scope under the Shopify bug bounty program on HackerOne. The feature under examination is the logout flow. When a user signs in, the app obtains an OAuth access token from Shopify's accounts service and uses it as a bearer credential for subsequent API calls. Logging out is supposed to end that session by invalidating the token on the server side, so that the credential can no longer be used by anyone who holds a copy of it.
The report is a low severity finding (CVSS 2.3) classified as Insufficient Session Expiration, disclosed on 26 November 2021.
Setup
The researcher worked against the live Shopify accounts service at accounts.shopify.com, using the Android application as the client. The only precondition is a normal user account: the researcher signed in with valid credentials, which caused the app to fetch an access token from the OAuth token endpoint at accounts.shopify.com/oauth/token.
The app's HTTP client identifies itself as okhttp/3.12.12 in the User-Agent header.
Finding it
The researcher noticed that after the user selects logout in the app, the app does send a request intended to end the session, but the server does not actually invalidate the token. The logout request is a DELETE to /api/v1/logout on accounts.shopify.com, carrying the bearer token. The server answers with an error and cancels the invalidation, so the same token still works afterwards. The researcher confirmed this by replaying the token against a user information endpoint and receiving the account's profile data back.
Exploitation
Step 1: obtain the access token
After the user provides the required credentials, the application fetches an access_token from the server at accounts.shopify.com/oauth/token. This token is the credential that the rest of the flow depends on.
Step 2: log out and capture the request
With a session established, selecting logout from the corresponding control makes the application send the following request:
DELETE /api/v1/logout HTTP/1.1
authorization: Bearer atkn_**********************************
Host: accounts.shopify.com
Connection: close
Cookie: __cfduid=***********; _y=***************; _shopify_y=***************; request_method=POST
User-Agent: okhttp/3.12.12
The important part is the authorization: Bearer header, which carries the same access token the app uses for normal API calls. The request is a DELETE to the logout path, so the intent is clearly to revoke that token server side. The request carries cookies (__cfduid, _y, _shopify_y, request_method=POST) and the client is okhttp 3.12.12.
Step 3: observe the server's response
The server replies:
{"error":"Missing Logout Token Hint"}
The server answers with an error stating that a "logout token hint" is missing. The invalidation process is cancelled: the token is not revoked.
Step 4: reuse the token after logout
The researcher then sent the token again on a subsequent request to the user information endpoint:
GET /oauth/userinfo HTTP/1.1
Accept-Encoding: gzip, deflate
authorization: Bearer ***************
....
The server answered with the account's profile:
{"sub":"...","email":"[redacted]","email_verified":true,"family_name":"Doe","given_name":"....","locale":"en","name":".... ...","nickname":".....","updated_at":.....,"zoneinfo":"....","tfa_enabled":false}
The response contains the user's subject identifier, email address, verification status, name fields, locale, nickname, update timestamp, time zone and two-factor status. In other words, the token that the user believed had been destroyed at logout still authenticates as that user and returns personal data.
Root cause
The logout endpoint requires a parameter it calls a "logout token hint", and the Android client does not send it. The server therefore answers {"error":"Missing Logout Token Hint"} and abandons the invalidation. The client treats the logout as complete from the user's point of view, but the server-side token remains valid.
The logout request is answered with an error about a missing logout token hint, and the token stays valid. A logout that cannot be completed should not leave the credential live; the server could revoke the presented bearer token regardless, or the client could be fixed to send the required hint. The report does not describe the server-side implementation, so the exact reason the hint is mandatory is not stated.
Impact
An application should always revoke an access token by the time the end user chooses to log off. Keeping a token active while the user is unaware of it is a real risk: if an unauthorised entity obtains the token, it can recover a fully functional session. The report does not describe how an attacker would obtain the token.
Fix
The corrective direction that follows from the finding is to make logout actually revoke the presented token: either have the Android client send the logout token hint the endpoint expects, or have the server invalidate the bearer token even when the hint is absent, so that a failed logout cannot leave a live credential behind.
Variants to test
- Other mobile clients of the same identity provider. Repeat the logout capture on every Shopify app that uses
accounts.shopify.com. A positive result is a logout request whose response is an error, followed by a successfulGET /oauth/userinfowith the same token. - Logout endpoints that take a hint or token parameter. Look for logout calls with query or body parameters such as a token hint, id token hint or redirect URI. A positive result is that omitting or altering the parameter produces an error response while the token stays valid.
- Token revocation endpoints. Check whether a dedicated revocation endpoint exists and whether the client calls it. A positive result is that the client only calls logout, never revocation, and the token survives.
- Refresh tokens. If the flow issues refresh tokens, test whether logout invalidates them. A positive result is a refresh succeeding after logout.
- Server-side session cookies. Where logout is cookie based, replay the captured cookie jar after logout. A positive result is an authenticated response from a protected endpoint.
Hunting notes
This class of bug hides in the gap between what the client shows the user and what the server actually does. The signal during testing is a logout request that returns an error body, an unexpected status, or a response that does not mention revocation, while the app's UI returns to the signed-out state. Mobile apps are good candidates because their logout logic is often a thin call to a shared identity service, and a missing parameter is easy to overlook.
The way the researcher demonstrated impact here is simple and effective: capture the token, perform the in-app logout, then replay the token against a user information endpoint and show that it still returns the account's profile. That replay is the evidence a triager needs, and it is what turns a "logout looks odd" observation into an accepted report.
What happened, in plain words
Shopify has a mobile app called com.shopify.ping (a Shopify app for Android phones). Like most apps, it lets you sign in and later sign out. Signing out is supposed to be the moment when the app tells the server "this person is leaving, please throw away the key that lets them in".
In this app, the sign-out request was sent, but the server answered with an error and never actually threw the key away. The researcher showed this by taking the key (called an access token), logging out in the app, and then using the same key again to ask the server for the user's profile. The server answered with the profile. So the key still worked after logout.
The report is rated low severity (CVSS 2.3) and is classified as Insufficient Session Expiration, which simply means "a session that should have ended did not really end". It was disclosed on 26 November 2021 under the Shopify bug bounty program on HackerOne.
To follow the rest of this article you only need to understand a few everyday ideas, which are explained as they come up.
Context
The target is the com.shopify.ping Android application, one of Shopify's mobile applications, which are in scope under the Shopify bug bounty program on HackerOne. The feature under examination is the logout flow.
When a user signs in, the app obtains an OAuth access token from Shopify's accounts service and uses it as a bearer credential for subsequent API calls. Two terms need unpacking here:
- An API (Application Programming Interface) is the set of web addresses a program uses to talk to a server. Think of it as the service counter at a bank: the app does not walk into the vault, it goes to a specific window and asks for a specific thing.
- An access token is a long string of characters that the server hands out after a successful login. It works like a cloakroom ticket: whoever holds the ticket can collect the coat, without the attendant asking who they are. A bearer credential means exactly that: the server trusts whoever presents the token, so the token must be kept secret and must be destroyed when it is no longer needed.
Logging out is supposed to end that session by invalidating the token on the server side, so that the credential can no longer be used by anyone who holds a copy of it. The report is a low severity finding (CVSS 2.3) classified as Insufficient Session Expiration, disclosed on 26 November 2021.
Setup
The researcher worked against the live Shopify accounts service at accounts.shopify.com, using the Android application as the client. The only precondition is a normal user account: the researcher signed in with valid credentials, which caused the app to fetch an access token from the OAuth token endpoint at accounts.shopify.com/oauth/token.
A proxy sits between the phone and the internet and lets you read, and replay, every request and response. It is like standing behind someone at the bank counter and writing down everything they say, then being able to say the same words again later. That is how the researcher could read the app's requests, including the authorization header and the cookies. The app's HTTP client identifies itself as okhttp/3.12.12 in the User-Agent header. The User-Agent is a line the client sends to say what software it is, a bit like a caller introducing themselves on the phone.
Finding it
The researcher noticed that after the user selects logout in the app, the app does send a request intended to end the session, but the server does not actually invalidate the token. The logout request is a DELETE to /api/v1/logout on accounts.shopify.com, carrying the bearer token. The server answers with an error and cancels the invalidation, so the same token still works afterwards. The researcher confirmed this by replaying the token against a user information endpoint and receiving the account's profile data back.
Exploitation
Step 1: obtain the access token
After the user provides the required credentials, the application fetches an access_token from the server at accounts.shopify.com/oauth/token. This token is the credential that the rest of the flow depends on. Signing in normally produced the token.
Step 2: log out and capture the request
With a session established, selecting logout from the corresponding control makes the application send the following request:
DELETE /api/v1/logout HTTP/1.1
authorization: Bearer atkn_**********************************
Host: accounts.shopify.com
Connection: close
Cookie: __cfduid=***********; _y=***************; _shopify_y=***************; request_method=POST
User-Agent: okhttp/3.12.12
Line by line:
DELETE /api/v1/logout HTTP/1.1is the request line.DELETEis the HTTP method, a verb that says "remove this thing"./api/v1/logoutis the path on the server, andHTTP/1.1is the version of the protocol being spoken. The choice ofDELETEshows the intent is to revoke something, not just to close a screen.authorization: Bearer atkn_...is the header that carries the access token. The wordBearertells the server "the holder of this string is authorised". The token itself starts withatkn_and the rest is masked here. This is the important part: it is the same access token the app uses for normal API calls.Host: accounts.shopify.comsays which website the request is addressed to. One server can host many sites, so the request names the one it wants.Connection: closeasks the server to close the network connection after answering, rather than keeping it open for more requests.Cookie: ...carries small pieces of data the browser or app stored earlier and sends back automatically. A cookie is like a stamp on your hand at an event: the door staff can see it without asking for your ticket again. The request carries cookies (__cfduid,_y,_shopify_y,request_method=POST).User-Agent: okhttp/3.12.12identifies the client software, here the okhttp library version 3.12.12 that the Android app uses to make HTTP calls.
Step 3: observe the server's response
The server replies:
{"error":"Missing Logout Token Hint"}
This is a small JSON object, a common text format for structured data built from names and values in curly braces. The single field is error, and its value is the message Missing Logout Token Hint. In plain words, the server refuses the logout because the request lacks a "logout token hint". The error message names a "logout token hint" that the request did not include. The invalidation process is cancelled: the token is not revoked. From the user's point of view the app has signed them out, but on the server the key is still in the lock.
Step 4: reuse the token after logout
The researcher then sent the token again on a subsequent request to the user information endpoint:
GET /oauth/userinfo HTTP/1.1
Accept-Encoding: gzip, deflate
authorization: Bearer ***************
....
Line by line:
GET /oauth/userinfo HTTP/1.1asks the server to return information.GETis the method used to read something, and/oauth/userinfois the endpoint that returns details about the signed-in user.Accept-Encoding: gzip, deflatetells the server which compression formats the client can handle, so the answer can be sent smaller.authorization: Bearer ***************presents the same token again, masked in the report. This is the replay: the researcher is acting as if they were still logged in.....stands for further headers that the report does not show.
The server answered with the account's profile:
{"sub":"...","email":"[redacted]","email_verified":true,"family_name":"Doe","given_name":"....","locale":"en","name":".... ...","nickname":".....","updated_at":.....,"zoneinfo":"....","tfa_enabled":false}
Each field means something:
subis the subject identifier, a unique ID for this user.emailis the account's email address, andemail_verifiedsays whether it has been confirmed.family_name,given_name,nameandnicknameare the user's name fields.localeis the language setting, hereenfor English.updated_atis a timestamp of when the record was last changed.zoneinfois the user's time zone.tfa_enabledsays whether two-factor authentication is switched on, herefalse.
In other words, the token that the user believed had been destroyed at logout still authenticates as that user and returns personal data.
Root cause
The logout endpoint requires a parameter it calls a "logout token hint", and the Android client does not send it. The server therefore answers {"error":"Missing Logout Token Hint"} and abandons the invalidation. The client treats the logout as complete from the user's point of view, but the server-side token remains valid.
The logout request is answered with an error about a missing logout token hint, and the token stays valid. A logout that cannot be completed should not leave the credential live; the server could revoke the presented bearer token regardless, or the client could be fixed to send the required hint. The report does not describe the server-side implementation, so the exact reason the hint is mandatory is not stated.
Impact
An application should always revoke an access token by the time the end user chooses to log off. Keeping a token active while the user is unaware of it is a real risk: if an unauthorised entity obtains the token, it can recover a fully functional session.
Fix
The corrective direction that follows from the finding is to make logout actually revoke the presented token: either have the Android client send the logout token hint the endpoint expects, or have the server invalidate the bearer token even when the hint is absent, so that a failed logout cannot leave a live credential behind.
Variants to test
- Other mobile clients of the same identity provider. Repeat the logout capture on every Shopify app that uses
accounts.shopify.com. A positive result is a logout request whose response is an error, followed by a successfulGET /oauth/userinfowith the same token. - Logout endpoints that take a hint or token parameter. Look for logout calls with query or body parameters such as a token hint, id token hint or redirect URI. A positive result is that omitting or altering the parameter produces an error response while the token stays valid.
- Token revocation endpoints. Check whether a dedicated revocation endpoint exists and whether the client calls it. A positive result is that the client only calls logout, never revocation, and the token survives.
- Refresh tokens. If the flow issues refresh tokens, test whether logout invalidates them. A positive result is a refresh succeeding after logout.
- Server-side session cookies. Where logout is cookie based, replay the captured cookie jar after logout. A positive result is an authenticated response from a protected endpoint.
Hunting notes
This class of bug hides in the gap between what the client shows the user and what the server actually does. The signal during testing is a logout request that returns an error body, an unexpected status, or a response that does not mention revocation, while the app's UI returns to the signed-out state. Mobile apps are good candidates because their logout logic is often a thin call to a shared identity service, and a missing parameter is easy to overlook.
The way the researcher demonstrated impact here is simple and effective: capture the token, perform the in-app logout, then replay the token against a user information endpoint and show that it still returns the account's profile. That replay is the evidence a triager needs, and it is what turns a "logout looks odd" observation into an accepted report.
Glossary
- Access token: a secret string handed out after login that proves who you are to the server; whoever holds it is treated as you.
- API: the set of web addresses and rules a program uses to talk to a server.
- Bearer credential: a credential where possession alone is enough, with no further proof of identity required.
- Bug bounty program: a scheme where a company pays researchers for reporting security problems responsibly.
- Client: the program making the request, here the Android app.
- Cookie: a small piece of data stored by the client and sent back automatically with later requests.
- CVSS: a scoring system that rates the severity of a security issue, here 2.3.
- DELETE: an HTTP method meaning "remove this thing".
- Endpoint: a specific address on a server that performs a specific job.
- GET: an HTTP method used to read something from a server.
- Header: an extra line in a request or response carrying information such as the token or the client software.
- Hint (logout token hint): an extra piece of information the server expects alongside a logout request.
- HTTP: the protocol browsers and apps use to exchange requests and responses with web servers.
- HTTP interception proxy: a tool placed between client and server that records and can replay traffic.
- Insufficient Session Expiration: a weakness where a session that should have ended stays usable.
- JSON: a text format for structured data built from names and values.
- OAuth: a standard way for apps to obtain tokens from an identity service instead of handling passwords directly.
- okhttp: an HTTP client library for Android, here version 3.12.12.
- Refresh token: a credential used to obtain a new access token without signing in again.
- Revocation: the act of cancelling a token so it no longer works.
- Severity: how serious an issue is judged to be, here low.
- Token: a string of characters used as proof of authorisation.
- Two-factor authentication (2FA): signing in with a password plus a second proof such as a code.
- User-Agent: a header in which the client says what software it is.
- Vulnerability: a weakness in software that can be used to cause harm.