Join our Newsletter — 33% off our NHI Course
Home› Guides› How to detect use of a stolen OAuth…
Guide Non-Human Identity (NHI)

How to detect use of a stolen OAuth refresh token: Signals and checks across Entra, Okta, Auth0 and Google

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 28 October 2026 10 min read
On this page

A stolen refresh token lets an attacker mint fresh access tokens silently, without a password or MFA prompt, for as long as the token lives. Refresh tokens are taken from infostealer logs, compromised integrations and badly stored application secrets, and their use looks like normal background traffic. This page shows how to tell legitimate refreshes from replay: what each major identity platform does when a token is reused, which log events and fields to watch, the hunting logic that finds replay, how to confirm a hit, and how to contain it. It is for detection engineers, identity administrators and incident responders. The design side, choosing rotation and lifetimes, is in the OAuth Refresh Token Rotation and Expiry Guide; the full incident process is in the OAuth Token Theft Incident Playbook.

Key takeaways

  • Rotation gives you a tripwire, if the platform has it. Okta and Auth0 invalidate the token family when a rotated refresh token is presented again and log it (app.oauth2.token.detect_reuse, app.oauth2.as.token.detect_reuse, ferrt). Treat every reuse event as a probable theft until explained.
  • Entra does not give you that tripwire. Microsoft states its identity platform does not revoke old refresh tokens when they are used, so detection relies on sign-in context: IP address, autonomous system, user agent, location and Entra ID Protection's Anomalous Token detection.
  • Baseline the client, not just the user. A server-side integration refreshes from a small set of addresses on a steady schedule. A refresh for that client ID from a new network, at a new cadence, is the strongest single signal.
  • Two places at once is replay. The same token, session or client refreshing from two unrelated networks within minutes cannot both be legitimate.
  • Containment means revoking the grant, not resetting a password. In Entra, a password change leaves non-password-based and confidential client refresh tokens alive; revoke refresh tokens or sessions explicitly.

When you need this

  • An integration vendor reports a breach. In the Salesloft Drift breach, OAuth access and refresh tokens taken from Drift's AWS environment were used to call Salesforce APIs as the trusted app, from TOR and anonymising proxies, with a tool user agent of Salesforce-Multi-Org-Fetcher/1.0.
  • A user's device appears in infostealer logs. Browser session material and tokens in the logs can be replayed. See the Infostealer Logs and Session Token Abuse Guide.
  • A secret store, CI system or developer laptop holding OAuth tokens is compromised. Refresh tokens issued to automation and agents are long-lived NHI credentials and need the same hunt.
  • You are building standing detection. The queries below run as scheduled detections, not only during incidents.

Before you start

Know how each authorisation server in your estate handles refresh tokens, because the detection method follows from it.

PlatformRotation and reuse behaviourWhere evidence livesLifetime defaults
Microsoft Entra IDRefresh tokens replace themselves on use, but old ones are not revoked; no reuse eventNon-interactive user sign-ins and service principal sign-ins logs (fields include Request ID and Unique token identifier); Entra ID Protection risk detections90 days; 24 hours for single-page apps
OktaOptional rotation with a grace period (default 30 seconds, 0 to 60); reuse invalidates the most recent refresh token and access tokens issued since authenticationSystem Log: app.oauth2.token.detect_reuse (org server), app.oauth2.as.token.detect_reuse (custom server)Default Unlimited, but expires after seven days of non-use; set refreshTokenLifetimeMinutes
Auth0Rotation with automatic reuse detection; reuse invalidates the most recent token in the familyTenant logs, event code ferrt (failed exchange)Configured per application
Google Workspace (as resource)Third-party app grants by usersOAuth log events: Grant and API call events with Application ID, API method, Scope, IP address, IP ASN, Client type and response bytesGoogle-managed

Also collect: the client IDs of every integration and agent, their expected egress IP ranges or autonomous systems, the user agents of their SDKs, and their normal refresh cadence. RFC 9700, the OAuth 2.0 Security Best Current Practice (BCP 240, January 2025), requires refresh tokens for public clients to be sender-constrained or rotated; note which of your clients meet that, because unrotated, unbound tokens are where detection matters most. Google's OAuth log search defaults to the last 7 days and API call events are only in some editions, so forward logs to your SIEM first.

Step-by-step

  1. Collect the token events centrally. Forward Entra sign-in logs (including non-interactive and service principal sign-ins), Entra ID Protection risk detections, Okta System Log, Auth0 tenant logs and Google Workspace OAuth log events to the SIEM. Google offers forwarding to Cloud Logging.
  2. Alert on every reuse event. In Okta, alert on eventType eq "app.oauth2.token.detect_reuse" or "app.oauth2.as.token.detect_reuse"; in Auth0 on log type ferrt. Enrich with client ID, user, both source IPs and user agents. A reuse event means two parties held the same token; the platform cannot tell which is legitimate, so treat both as suspect.
  3. Build a per-client baseline. For each client ID, record the set of autonomous systems, countries and user agents seen in the last 30 days, and the typical interval between refreshes. Integrations should be stable; human clients vary more.
  4. Hunt for new context on silent refreshes. Flag non-interactive refreshes (no MFA, no password) where the client ID is seen from an autonomous system, country or user agent not in its baseline, especially hosting providers, VPN services or TOR exits. In Google Workspace, sort OAuth API call events by Application ID and IP ASN.
  5. Hunt for impossible concurrency. Group refresh events by user and client ID (in Entra also by session ID where present) and flag pairs from different autonomous systems within a short window, for example ten minutes. Legitimate clients rarely move networks that fast.
  6. Hunt for refreshes after a kill event. Any refresh for a user after offboarding, after a "revoke sessions" action, or after an app grant was removed shows either a revocation gap or a token class you did not revoke.
  7. Watch what the token is used for. High data volume (Google's Number of response bytes), bulk export APIs, or count queries across many objects, as in the Drift case, separate data theft from routine sync.
  8. Use the platform's own analytics. Enable Entra ID Protection's Anomalous Token detection (anomalousToken, Premium), which covers session and refresh tokens and flags unusual lifetimes or tokens played from unfamiliar locations. Microsoft notes it can be noisy at low and medium risk, so route those to triage rather than auto-block.
SignalStrengthFalse positive sources
Rotation reuse event (Okta, Auth0)HighClient bugs that retry with the old token outside the grace period; network retries
Integration client ID from a new autonomous systemHighVendor infrastructure moves; check the vendor's published ranges
Same user and client from two networks within minutesHighSplit-tunnel VPNs, mobile handover
Refresh after revocation or offboardingHighLog lag; tokens of a class you did not revoke
Anomalous Token detectionMediumTravel, new devices; Microsoft notes higher noise at low and medium risk
New user agent for a known clientMediumSDK upgrades

Verify it worked

  • Controlled test: in a non-production tenant, with written approval, issue a refresh token to a test client, then present it from a second, known network. Confirm the concurrency and new-network detections fire, and on a rotating platform present an already-used token to confirm the reuse alert.
  • Replay of history: run the hunts against a known past incident or a red team exercise and check they would have alerted.
  • Coverage check: list every client ID that issued refresh tokens in the last 30 days and confirm each has a baseline and an owner.
MetricTarget
Integrations and agents with a refresh baselineAll production client IDs
Public clients using rotation or sender-constrained tokensAll, per RFC 9700
Time from reuse alert to revocationUnder one hour
Refreshes observed after revocation actionsZero

Rollback and common errors

  • Revocation that does not revoke: in Entra, a user password change leaves non-password-based tokens and confidential client tokens alive, and B2B users' tokens must be revoked in their home tenant. Use Revoke sessions on the user's Overview page or Revoke-MgUserSignInSession -UserId <id>, which Microsoft's revocation table shows revoking all refresh token classes.
  • Forgetting the access token: revoking the refresh token stops new access tokens, but Entra access tokens last about an hour by default and application session cookies are controlled by the application, not Entra. Expect a short tail of activity.
  • Auto-blocking on noisy signals: blocking on low-risk Anomalous Token detections or user agent changes breaks users and integrations. Block automatically only on reuse events and confirmed concurrency; triage the rest.
  • Grace period too wide: an Okta rotation grace period at its 60 second maximum gives a thief a window in which reuse is accepted silently. Keep it as small as clients tolerate.
  • Rollback of a detection: if a new rule floods the queue, set it to log-only, tune the baseline for the offending client IDs, then re-enable. Never disable reuse alerts globally.

Hardening afterwards

  • Bind tokens to the client. Sender-constrained tokens such as DPoP make stolen refresh tokens useless without the key. In Entra, Token Protection in Conditional Access accepts only device-bound sign-in session tokens for supported applications (Windows generally available; Apple and web apps in preview). See the DPoP Guide.
  • Turn on rotation everywhere it exists and shorten idle and absolute lifetimes for public clients. See the Token Lifetime Policy Design Guide.
  • Restrict integrations by network where the resource supports IP restrictions for connected apps, so stolen tokens fail outside the vendor's ranges.
  • Inventory and expire grants. Remove app grants nobody owns; an unowned grant is an unmonitored refresh token.
FrameworkReferenceRelevance
MITRE ATT&CKT1528 Steal Application Access Token; T1550.001 Application Access TokenTheft and replay of OAuth tokens
NIST SP 800-53 Rev. 5SI-4, AU-6, AC-12, IA-11Monitoring, log review, session termination, re-authentication
NIST CSF 2.0DE.CM-03, DE.AE-02, RS.MI-01Monitoring, analysis of adverse events, containment
IETFRFC 9700 (BCP 240) Section 2.2.2Refresh tokens for public clients sender-constrained or rotated

Practitioner checklist

  • Map every authorisation server and whether it rotates refresh tokens and logs reuse.
  • Forward Entra, Okta, Auth0 and Google OAuth logs to the SIEM with enough retention for investigations.
  • Alert on every Okta detect_reuse event and Auth0 ferrt event.
  • Baseline each integration client ID by network, user agent and refresh cadence.
  • Run new-network, concurrency and post-revocation hunts as scheduled detections.
  • Use explicit refresh token or session revocation, not password resets, to contain.
  • Test detections with an approved controlled replay in a non-production tenant.
  • Move public clients to rotation or sender-constrained tokens.

Standards and references

Related NHI Mgmt Group resources: OAuth Token Theft Incident Playbook · OAuth Refresh Token Rotation and Expiry Guide · Okta System Log Detection Guide · Entra ID Primary Refresh Token (PRT) Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 28 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.