Stolen OAuth tokens
| Class | Secrets, Authentication |
|---|---|
| Also known as | Token theft, token replay |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1528 Steal Application Access Token; T1550.001 Application Access Token |
| Typical severity | High |
| Affects | Access and refresh tokens held by browser apps, servers, CI pipelines and services that connect to other accounts on a user's behalf |
An API that uses OAuth 2.0 receives requests like this one:1
GET /resource HTTP/1.1
Host: server.example.com
Authorization: Bearer mF_9.B5f-4.1JqMThe string after Bearer is the whole proof. A bearer token can be used in any way by any party that holds it, and the holder does not have to show a key or anything else.1 A stolen OAuth token is one copied from the application, server or pipeline it was issued to and replayed by someone else. The attacker skips the sign-in page and acts with the permissions the token carries.2
Why a token outlasts the password
The sign-in, the password check and the second factor happen once, when the token is issued. Calls made later with the token do not repeat them, so a stolen token defeats two-factor authentication and may keep working after the user changes the password.3 Access tokens often expire, which limits the damage. A refresh token does not have that limit: with one, an attacker can obtain fresh access tokens without the user being asked again.2 Calls made with a stolen token match the integration's normal traffic, which makes them hard to detect.3
Where tokens are taken
An app running in the browser that keeps tokens in browser storage hands them to any script running on its pages. After an Cross-site scripting flaw, the attacker's script reads the tokens and calls the API with them as the app would.4
Browser history and server logs keep URLs with little protection, so a token in a query string can be read there later (see Personal data in URLs).1
In consent phishing the attacker registers an OAuth application, sends the victim a link to its approval screen, and receives a token once the victim approves, without ever seeing the password. The group APT28 ran apps named "Google Defender" and "Google Scanner" to get tokens for Gmail accounts.2 Kali365 has obtained access and refresh tokens by getting victims to complete device sign-in requests the attacker started, and through adversary-in-the-middle proxies.2
On servers, CI/CD jobs hold tokens to deploy and test, a container can read its Kubernetes service account token, and an Azure virtual machine can request tokens for its managed identity from the metadata service. Whoever controls the job or the machine can take them.2
Salesloft Drift, 2025
Salesloft's chat product Drift held OAuth tokens for its customers' integrations, Salesforce among them, so one breach of Drift exposed many customers' connections at once. Between March and June 2025 an attacker got into Salesloft's GitHub account, downloaded repositories, added a guest user and set up workflows. The attacker then reached Drift's AWS environment and took those tokens.5
From 8 August until at least 18 August 2025 the group, tracked by Google as UNC6395, used those tokens to export large amounts of data from many companies' Salesforce instances, then searched the data for AWS access keys, passwords and Snowflake tokens. On 20 August Salesloft and Salesforce revoked every active access and refresh token of the Drift application. On 28 August Google reported that tokens for the "Drift Email" integration had also been taken and used on 9 August to read mail in a small number of Google Workspace accounts; Google revoked them and disabled the integration.6 The breach did not come from a vulnerability in the core Salesforce platform.6 The OAuth 2.0 article describes a similar case at GitHub in 2022.
Making a copied token worth less
Short lifetimes
Bearer tokens should live one hour or less, above all when the client runs in a browser.1 Tokens belong in a header or a request body, not in a page address.1
Refresh token rotation
The authorization server (the service that issues the tokens) hands out a new refresh token at every refresh and invalidates the old one. If an attacker and the real client both hold the same token, one of them will present an invalidated one, and the server learns of the theft. For public clients, which cannot keep a client secret, rotation or sender-constraining is mandatory.7
Sender-constrained tokens
The token is bound to a key at issue, and every request must prove possession of that key.7 With DPoP, the client signs a small JWT for each request, sent in a DPoP header, covering the HTTP method and URL of that request, a timestamp and a unique identifier.8 If the private key cannot be exported from the browser's crypto store, a token copied out of the app is useless on its own. Script injected into the app can still use the key in place, so DPoP does not replace fixing XSS.8
Backend for frontend
In the backend-for-frontend pattern, a server component is the OAuth client and adds the tokens to the API calls it forwards. The browser gets only a session cookie, so there are no tokens in it to take, though injected script can still send requests through the user's open session.4
Revocation and review
A client can tell the authorization server that a token is no longer needed. Servers must support revoking refresh tokens, and revoking one should also invalidate the access tokens issued under the same grant:9
POST /revoke HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
token=45ghiukldjahdnhzdauz&token_type_hint=refresh_tokenOn the user's side, each provider lists the applications holding tokens. At GitHub it is under the profile picture, Settings, Applications in the Integrations section, then the Authorized OAuth Apps tab.10 Organisations can require an administrator to approve OAuth apps instead of letting each user consent, and audit the apps already approved. A scope for offline access or for reading mail deserves the closest look.2 Grants left behind after use are Orphaned access tokens and OAuth grants.
In SecFlash
On the Security page, SF-SEC-503 reports login tokens kept in browser storage, SF-SEC-638 a token in a page address, and SF-SEC-656 a token sent to other sites in the Referer header. SF-SEC-730 reports a sign-in token kept in unencrypted phone app storage. On the Exposure page, SF-EXP-305 reports a token written into the HTML served to logged-out visitors, and SF-EXP-607 and SF-EXP-622 report app link schemes another app can claim, through which a sign-in code or token can reach the wrong app.
See also
- OAuth 2.0
- Refresh tokens
- Orphaned access tokens and OAuth grants
- Over-privileged access token
- Session hijacking
- Infostealer malware
- Adversary-in-the-middle phishing
- Third-party access
- Category: Secrets
References
- a b c d e Jones, M. and Hardt, D. (October 2012). "The OAuth 2.0 Authorization Framework: Bearer Token Usage". RFC 6750. IETF.
- a b c d e f MITRE. "Steal Application Access Token (T1528)". MITRE ATT&CK.
- a b MITRE. "Use Alternate Authentication Material: Application Access Token (T1550.001)". MITRE ATT&CK.
- a b IETF OAuth Working Group (July 2026). "OAuth 2.0 for Browser-Based Applications". draft-ietf-oauth-browser-based-apps-27, work in progress. IETF.
- back Salesloft (September 2025, page updated April 2026). "Drift security updates" and "Summary of the Mandiant Investigation of Drift Applications". Salesloft Trust Center.
- a b Google Threat Intelligence Group and Mandiant (26 August 2025, updated 28 August 2025). "Widespread Data Theft Targets Salesforce Instances via Salesloft Drift". Google Cloud Blog.
- a b IETF (January 2025). "Best Current Practice for OAuth 2.0 Security". RFC 9700. IETF.
- a b Fett, D. et al. (September 2023). "OAuth 2.0 Demonstrating Proof of Possession (DPoP)". RFC 9449. IETF.
- back Lodderstedt, T., ed. et al. (August 2013). "OAuth 2.0 Token Revocation". RFC 7009. IETF.
- back GitHub. "Reviewing your authorized OAuth apps". GitHub Docs.
External links
- Best Current Practice for OAuth 2.0 Security (RFC 9700), IETF
- Use Alternate Authentication Material: Application Access Token, MITRE ATT&CK