A refresh token is stolen at 9:00 AM. By 9:15, the attacker has used it to obtain fresh access tokens. By 9:30, they're querying your CRM for customer records. By 10:00, they've exported six months of sales data. Your security team discovers the breach at 2:00 PM when a customer reports suspicious activity. The token is revoked at 2:15 PM. The data left your environment five hours ago.
This scenario plays out across enterprise environments every week. Refresh token security represents one of the most overlooked blind spots in modern SaaS supply chain security. Unlike access tokens that expire quickly, refresh tokens persist for days or weeks, operating independently of your SSO and MFA controls. They're the bridges attackers walk across to move laterally between your SaaS applications, and by the time you detect the breach, the damage is done.
Understanding Refresh Token Security: Best Practices for OAuth Token Protection requires confronting an uncomfortable truth: your strongest authentication controls are irrelevant once an attacker holds a valid refresh token. This article explains the mechanisms that make refresh tokens dangerous, the four primary threat vectors security teams face, and the behavioral detection strategies that catch token abuse before data exfiltration completes.
Key Takeaways
- Refresh tokens bypass MFA and SSO on every subsequent use after initial authentication, creating an invisible attack path that traditional controls cannot stop
- Token theft happens faster than revocation processes, with attackers exfiltrating sensitive data hours before security teams detect compromise
- Token rotation and sender-constraining mechanisms reduce risk but don't detect active abuse; behavioral monitoring is required to identify compromised tokens during exploitation
- Appropriate token lifetimes (7-30 days for sensitive apps, 24 hours maximum for SPAs) limit exposure windows but must be paired with anomaly detection
- Behavioral baselines for refresh token usage enable detection of deviations in access patterns, timing, volume, and network location that signal compromise
Why Refresh Token Security Is Different from Access Token Protection
Most security teams understand access token risks. Access tokens grant temporary access to protected resources, typically expiring within 5-60 minutes. This short lifespan limits the window for attackers to exploit stolen tokens. Refresh tokens operate under entirely different risk parameters.
They're Long-Lived Bearer Tokens
Refresh tokens persist for days, weeks, or even months depending on configuration. While access tokens expire before attackers can execute comprehensive data exfiltration, refresh tokens give adversaries time to explore your environment, identify valuable data repositories, and establish persistence. Most SaaS apps implement OAuth tokens as bearer tokens-something like a key. Whoever has this key can use it.
This extended lifetime transforms refresh tokens into high-value targets. A compromised access token might grant 15 minutes of unauthorized access. A compromised refresh token grants the ability to generate fresh access tokens for weeks, enabling sustained reconnaissance and multi-stage attacks.
They Bypass Your Authentication Controls
Your organization invested in multi-factor authentication. You enforce SSO across all applications. You monitor failed login attempts. None of these controls apply to refresh token usage.
Refresh tokens function independently of your SSO and MFA infrastructure. Once an attacker possesses a valid refresh token, they can obtain new access tokens without triggering authentication flows. No login events appear in your SIEM. No MFA prompts challenge the request. No failed authentication attempts signal suspicious activity.
The attacker's requests look identical to legitimate application behavior. Your strongest authentication control is irrelevant.
They Operate in the Hidden Layer Between SaaS Apps
Refresh tokens represent the bridges between your SaaS applications. When Salesforce integrates with Slack, or when your marketing automation platform connects to your CRM, those connections rely on OAuth tokens. These SaaS-to-SaaS integrations create invisible attack paths that bypass traditional perimeter controls.
Security teams can see the applications. They struggle to see the tokens connecting them. This hidden layer is where attackers operate, riding trusted connections straight into customer environments without triggering traditional detection mechanisms.
The Four Refresh Token Threats Security Teams Must Address
Token Theft from Storage Locations
Refresh tokens must be stored somewhere. Every storage location represents a potential compromise vector:
Browser-based storage exposes tokens to any JavaScript running in the same origin. Single-page applications storing refresh tokens in localStorage create opportunities for cross-site scripting attacks to extract credentials. Any malicious script can access these tokens.
Mobile application storage faces similar challenges. Insecure storage on mobile devices, inadequate encryption, or improper keychain usage creates extraction opportunities for attackers with device access.
Server-side databases containing refresh tokens become high-value targets. Database compromises expose not just user data but the tokens that grant ongoing access to connected systems.
Log files inadvertently capturing tokens during debugging or error logging create persistent copies that survive long after the original token is rotated.
The mitigation strategy seems straightforward: secure storage with encryption, access controls, and minimal logging. But assume eventual compromise. Storage security reduces risk; it doesn't eliminate it. Your security architecture must account for stolen tokens.
Token Interception in Transit
Network-level attacks target tokens moving between clients and authorization servers:
Man-in-the-middle attacks on compromised networks intercept token exchanges. While HTTPS encrypts traffic, TLS stripping attacks downgrade connections to HTTP, exposing tokens in transit.
Compromised proxy servers sitting between clients and authorization servers can capture tokens during legitimate exchanges. Enterprise environments with SSL inspection capabilities create additional interception points.
Public WiFi networks and other untrusted network infrastructure provide opportunities for adversaries to position themselves in the communication path.
HTTPS everywhere mitigates interception risk. But stolen tokens still work. Once an attacker captures a valid refresh token, the encryption protecting it in transit becomes irrelevant. The token grants access regardless of how it was obtained.
Token Extraction from Compromised Third-Party Vendors
Your organization authorizes third-party applications to access your SaaS environment. Those applications store refresh tokens to maintain ongoing access. When the vendor gets breached, your tokens are compromised.
The Salesloft-Drift incident demonstrated this threat vector. A single OAuth integration extended into tools like Gainsight and multiple Salesforce instances, multiplying the number of affected accounts to more than 700 companies. The risk is not theoretical.
Third-party applications represent one integration away from your core data. When attackers compromise the vendor, they inherit the OAuth scopes and permissions your organization granted. Those inherited permissions enable lateral movement across your SaaS supply chain.
Vendor breach notifications arrive after the compromise. By the time you receive notification, attackers may have already used your tokens to access your environment. The operational burden of identifying which tokens to revoke, which data may have been exposed, and which users are affected creates response delays that extend attacker dwell time.
Token Replay After Rotation Failures
Token rotation strategies require careful implementation. Race conditions, database locking failures, or improper invalidation logic create windows where multiple valid tokens exist simultaneously.
The attacker scenario: A refresh token is stolen. The attacker uses it to obtain a new access token before the legitimate application's next refresh cycle. The authorization server issues a new refresh token to the attacker and invalidates the old one. When the legitimate application attempts to refresh, its request is rejected. The attacker maintains access while the legitimate user gets locked out.
Without proper reuse detection, this scenario enables attackers to maintain persistence while creating user experience degradation that security teams attribute to application bugs rather than active compromise.
Implementing Refresh Token Security Controls That Actually Work
Token Rotation with Automatic Reuse Detection
Each time a client exchanges a refresh token for a new access token, the authorization server must generate a new refresh token and immediately invalidate the old one. This ensures only one valid refresh token exists per client at any time.
Reuse detection is critical. If a previously invalidated refresh token is presented to the authorization server, it signals compromise. The entire token family must be invalidated immediately. This automatic reuse detection transforms token rotation from a passive security measure into an active detection mechanism.
Implementation requires:
- Atomic database operations that update token state without race conditions
- Database locks during rotation to prevent multiple valid tokens from existing simultaneously
- Token family tracking that links related tokens across rotation cycles
- Immediate revocation triggers when reuse is detected
Organizations implementing rotation without reuse detection gain minimal security benefit. The detection component is what catches active attacks.
Sender-Constraining Mechanisms (DPoP and Mutual TLS)
According to OWASP recommendations, refresh tokens should either be sender-constrained or use refresh token rotation to prevent token replays. Sender-constraining binds tokens to cryptographic keys that must be presented during use.
Demonstration of Proof of Possession (DPoP) requires clients to prove they possess a private key associated with the token. The authorization server validates this proof on each request. A stolen token without the corresponding private key is useless to attackers.
Mutual TLS for OAuth 2.0 establishes cryptographic binding between tokens and client certificates. The token only works when presented alongside the correct certificate.
These mechanisms transform bearer tokens into proof-of-possession tokens. The token alone is insufficient; the client must demonstrate ownership of the associated cryptographic material. This significantly raises the bar for attackers, who must now steal both the token and the cryptographic keys.
Appropriate Token Lifetimes Based on Application Sensitivity
RFC 9700, published in January 2025 as the most current Best Current Practice for OAuth 2.0 Security, provides updated guidance on token lifetimes. The appropriate expiration window depends on application sensitivity and use case.
Sensitive APIs handling financial data, healthcare information, or other regulated content should use access token expirations as short as 5-15 minutes. Refresh tokens for these applications should expire within 7-30 days maximum.
General-purpose APIs can extend access token lifetimes to 30-60 minutes to balance security and usability. Refresh tokens may persist for several weeks.
Single-page applications face unique constraints. Long-lived refresh tokens are not suitable for SPAs due to browser storage vulnerabilities. Refresh token rotation mitigates this by limiting refresh token lifespan to that of the short-lived access token. Maximum 24-hour refresh token lifetimes for SPAs reduce exposure windows.
Never configure "no expiration" for refresh tokens. Unlimited lifetime tokens create permanent compromise risk. Even long-lived tokens should eventually expire, forcing re-authentication and providing natural rotation points.
Organizations implementing short-lived access tokens paired with refresh tokens have reported significant reduction in replay attack success rates, particularly when combined with strict expiry validation. Access tokens past their expiration date must be invalidated even if cached locally, with regular synchronization with the authorization server ensuring consistent enforcement of expiry policies.
Revocation Capability and Integration with Security Workflows
OAuth defines standard endpoints for revoking tokens. These should be integrated into logout mechanisms to ensure both access and refresh tokens are invalidated when users log out. But revocation capability must extend beyond user-initiated logout.
Security teams must be able to revoke tokens on demand:
- On employee departure: Immediately invalidate all tokens associated with departing employees, including those granted to third-party applications on their behalf
- On security incident: Bulk revocation of tokens matching specific patterns (all tokens from a compromised vendor, all tokens accessing a specific resource)
- On vendor breach notification: Rapid identification and revocation of tokens granted to the compromised vendor
The operational challenge is identifying which tokens to revoke. Without comprehensive visibility into OAuth token relationships, security teams resort to broad revocation that disrupts legitimate business operations or narrow revocation that leaves compromised tokens active.
Obsidian's approach to token security provides the visibility required to make informed revocation decisions. Understanding which tokens access which data, which users authorized which integrations, and which vendors hold which permissions enables surgical revocation that minimizes business disruption while maximizing security impact.
The Detection Problem: Why Security Controls Aren't Enough
Token rotation, lifetime limits, sender-constraining, and revocation capability are defensive measures. They reduce risk. They limit exposure windows. They make exploitation harder. They don't detect active abuse.
An attacker with a valid refresh token looks identical to a legitimate application. The token has proper OAuth scopes. It was authorized through legitimate flows. It accesses data it has permission to access. Traditional security controls see normal behavior.
Why Token Security Controls Fail at Detection
Rotation doesn't help if the attacker uses the token first. The race between legitimate application refresh cycles and attacker token usage determines who maintains access. Without behavioral context, security teams can't distinguish between legitimate rotation and attacker-initiated refresh.
Lifetimes don't help if attackers act quickly. A 7-day refresh token lifetime gives attackers 7 days to exfiltrate data. Shorter lifetimes reduce the window but don't eliminate it. Detection within hours matters more than prevention over days.
Revocation requires knowing which tokens to revoke. Broad revocation disrupts business. Narrow revocation misses compromised tokens. The decision requires understanding normal token behavior and identifying deviations.
What Detection Must Answer About Refresh Token Behavior
Effective detection requires answering specific questions about each token:
- "Is this token being used normally?" Does current usage match historical patterns for this token?
- "Has the behavior pattern changed?" Are there deviations in access patterns, timing, or volume?
- "Does this look like automation or exfiltration?" Is the request pattern consistent with human interaction or bulk data extraction?
- "Is the source location expected?" Does the network location match previous usage patterns?
These questions require behavioral baselines. Static security controls can't answer them. You need continuous monitoring of token behavior across your SaaS environment.
Behavioral Detection for Refresh Token Security
Establish Baselines for Normal Token Behavior
Every refresh token has a normal usage pattern. Understanding that pattern enables deviation detection:
Data access patterns: Which resources does this token typically access? Which API endpoints does it call? Which data fields does it retrieve? Tokens accessing data they've never touched before signal reconnaissance or privilege escalation.
Temporal patterns: What time of day is this token normally used? Business hours usage suddenly shifting to 3 AM suggests compromised credentials. Tokens active during known vacation periods indicate unauthorized access.
Volume patterns: What is the typical request volume for this token? A token that normally makes 50 API calls per day suddenly making 5,000 calls suggests bulk data exfiltration or automated scanning.
Network patterns: Which IP addresses and autonomous system numbers (ASNs) does this token connect from? New source locations, especially from geographic regions inconsistent with user location or business operations, indicate token theft or unauthorized sharing.
Establishing these baselines requires continuous observation across your SaaS environment. Point-in-time snapshots miss the behavioral context that distinguishes normal from abnormal.
Detect Deviations That Signal Compromise
Once baselines exist, deviations become detectable:
Access anomalies: Token requesting data it has never accessed. Token accessing resources outside its normal scope. Token retrieving sensitive data fields it typically ignores.
Timing anomalies: Token active outside normal business hours. Token usage patterns inconsistent with user work schedule. Token activity during periods when the user is known to be unavailable.
Volume anomalies: Request rate spiking beyond historical norms. Bulk data retrieval operations. Sustained high-volume activity inconsistent with interactive use.
Location anomalies: New source IP addresses appearing. ASN deviation from expected network providers. Geographic location inconsistent with user location or business operations.
These deviations don't always indicate compromise. Legitimate business changes create behavioral shifts. But they require investigation. Behavioral detection surfaces the signals that warrant security team attention.
Correlate Token Behavior with External Threat Intelligence
Token behavior doesn't exist in isolation. External events create risk context:
Vendor breach announcements: When a third-party vendor discloses a breach, immediately check all tokens granted to that vendor. Behavioral monitoring identifies whether those tokens have been used abnormally since the breach timeframe.
Employee departures: When employees leave, check tokens they authorized. Behavioral baselines help identify whether those tokens are still being used (suggesting the employee retained access) or have changed behavior patterns (suggesting someone else is using them).
New OAuth applications: When new integrations are authorized, establish behavioral baselines immediately. This enables rapid detection if the application is later compromised or begins accessing data beyond its stated purpose.
The correlation between external events and token behavior transforms threat intelligence into actionable security insights. Obsidian's Knowledge Graph correlates these relationships, identifying toxic combinations where compromised tokens intersect with sensitive data access.
The Time Advantage: Hours of Detection Difference Equal Terabytes of Data Difference
Security controls prevent some theft and limit some damage. Behavioral detection identifies abuse while it's happening. The difference is measured in hours, and hours determine breach impact.
In the opening scenario, the refresh token was stolen at 9:00 AM. Data exfiltration began at 9:30 AM. Detection occurred at 2:00 PM. Five hours of undetected access.
Behavioral detection reduces that window. Anomaly alerts trigger within minutes of unusual token activity. Security teams investigate while attackers are still in reconnaissance phase, before bulk exfiltration begins.
The operational difference between 5 hours of undetected access and 30 minutes of undetected access is measured in terabytes of exfiltrated data, number of compromised customer records, and regulatory notification requirements. Detection speed determines breach severity.
Implementing Refresh Token Security: Practical Steps for Security Teams
Audit Current Token Configuration
Start with visibility into your current refresh token landscape:
- Inventory all OAuth applications with access to your SaaS environment
- Identify refresh token lifetimes for each application and authorization server
- Document token rotation policies and verify implementation
- Map token permissions to understand OAuth scopes granted
- Identify overprivileged tokens with write/delete permissions that exceed business requirements
This audit reveals blind spots in your current token security posture. Most organizations discover stale integrations with admin permissions, inactive applications maintaining active tokens, and third-party vendors with broader access than necessary.
Implement Token Rotation with Reuse Detection
Work with your authorization server configuration to enable:
- Automatic token rotation on every refresh operation
- Atomic database operations preventing race conditions
- Reuse detection logic that invalidates token families on duplicate use
- Monitoring and alerting when reuse attempts occur
Test rotation implementation thoroughly. Race conditions and database locking failures create security gaps that attackers exploit. Verify that only one valid refresh token exists per client at any time.
Configure Appropriate Token Lifetimes
Review and adjust token lifetimes based on application sensitivity:
- Sensitive applications: 5-15 minute access tokens, 7-30 day refresh tokens
- General applications: 30-60 minute access tokens, 30-90 day refresh tokens
- Single-page applications: 15-minute access tokens, 24-hour refresh tokens maximum
Balance security requirements against user experience. Overly aggressive expiration creates authentication friction that drives users toward workarounds. Overly permissive expiration creates unnecessary risk exposure.
Establish Behavioral Monitoring for Token Usage
Deploy monitoring that tracks:
- Data access patterns for each token
- Temporal usage patterns across time zones and business hours
- Volume metrics for API calls and data retrieval
- Network location patterns including IP addresses and ASNs
Establish baselines over 30-60 days of normal operation. Configure alerting for deviations that exceed statistical thresholds. Integrate alerts into security operations workflows for investigation and response.
Integrate Token Revocation into Security Workflows
Build operational processes for token revocation:
- Employee offboarding: Automatic revocation of all tokens associated with departing employees
- Incident response: Rapid revocation capability for compromised tokens
- Vendor breach response: Process for identifying and revoking vendor-associated tokens
- Periodic review: Scheduled audits of active tokens with revocation of unnecessary access
Document decision criteria for revocation. When does suspicious behavior warrant immediate revocation versus continued monitoring? Clear criteria enable faster response during security incidents.
Detect Token Abuse Before Data Exfiltration
Your refresh tokens are accessing sensitive data right now. Some are legitimate. Some might not be. The difference is behavioral context that traditional security controls can't provide.
Obsidian monitors refresh token behavior across your SaaS environment, establishes baselines for normal usage, and alerts when tokens deviate from expected patterns. Detect compromised tokens before attackers finish exfiltrating data.
The security controls outlined in this article-rotation, sender-constraining, appropriate lifetimes, revocation capability-reduce your attack surface. But by the time you revoke the token, the data may already be gone. Behavioral detection identifies abuse during the exploitation window, when response still prevents data loss.
Refresh Token Security: Best Practices for OAuth Token Protection requires both defensive controls and active detection. Implement the controls to reduce risk. Deploy behavioral monitoring to catch the attacks that bypass those controls. The combination determines whether you detect breaches in hours or days, and that difference determines your breach impact.
Conclusion
Refresh token security represents a critical blind spot in enterprise SaaS environments. These long-lived bearer tokens bypass MFA and SSO controls, operate invisibly in the hidden layer between applications, and give attackers time to explore and exfiltrate data before detection occurs.
Security teams must implement defensive controls-token rotation with reuse detection, sender-constraining mechanisms, appropriate lifetimes, and revocation capability-to reduce attack surface. But controls alone don't detect active abuse. Behavioral monitoring that establishes baselines for normal token usage and alerts on deviations provides the detection layer that catches compromised tokens during exploitation.
The operational challenge is visibility. Without understanding which tokens access which data, which users authorized which integrations, and which vendors hold which permissions, security teams cannot make informed decisions about risk prioritization or incident response.
Start with an audit of your current OAuth token landscape. Identify overprivileged tokens, stale integrations, and configuration gaps. Implement rotation and lifetime controls based on application sensitivity. Deploy behavioral monitoring to detect anomalies. Build operational processes that integrate token security into employee offboarding, incident response, and vendor risk management workflows.
The difference between 5 hours of undetected token abuse and 30 minutes of undetected abuse is measured in terabytes of exfiltrated data. Detection speed determines breach severity. Invest in both the controls that prevent some attacks and the detection that catches the rest.


