Join our Newsletter — 33% off our NHI Course
Home› FAQ› Authentication, Authorisation & Trust› What happens when refresh tokens are not protected…
Authentication, Authorisation & Trust

What happens when refresh tokens are not protected with cookie attributes and origin controls?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 31, 2026 Domain: Authentication, Authorisation & Trust

If refresh tokens are exposed to JavaScript or accepted from overly broad origins, an attacker who gains script execution or cross-site request capability can keep minting new access tokens. That turns a short-lived compromise into a persistent session takeover. Proper protection depends on httpOnly, Secure, SameSite cookies and tight CORS rules for refresh requests.

Why unprotected refresh tokens turn a brief compromise into persistence

Refresh tokens are designed to outlive access tokens, so they become the durable prize once an attacker can reach them. If JavaScript can read the token, or if a browser will send it across loose origins, the attacker does not need to win the login flow again. They can keep exchanging that token for fresh access until the token is revoked or expires.

That changes the security model from “short-lived access token theft” to “repeatable session renewal.” A stolen refresh token is especially valuable because it can survive password changes and MFA prompts unless the deployment is engineered to bind, restrict, or revoke it.

Which browser controls stop token exfiltration and cross-site reuse?

The core browser protections are complementary. Cookie Security Guide covers the attributes that keep refresh tokens out of script reach and limit where the browser will send them. httpOnly blocks JavaScript access, Secure confines transmission to HTTPS, and SameSite reduces cross-site request abuse.

Those cookie attributes do not work alone. If the application accepts refresh requests from too many origins, a hostile site can still try to ride the browser’s ambient trust. Tight origin checks and a restrictive CORS policy keep credentialed refresh endpoints from becoming a cross-site token vending channel.

For teams standardising token behaviour, the Token and Session Security Guide is the broader reference for refresh-token lifetime, replay resistance, and session binding decisions. It helps separate ordinary session expiry from controls that actually limit replay after theft.

Why origin controls matter as much as storage controls

Protecting the cookie is only half the problem. If the refresh endpoint accepts credentialed requests from a wide origin set, a malicious page can trigger the browser to send the cookie even when it cannot read it directly. That is why origin allowlisting, correct preflight handling, and no wildcard credentialed CORS are part of the same control plane as cookie attributes.

The CORS Misconfiguration Guide is directly relevant here because refresh endpoints are a common place where origin reflection, overly broad allowlists, or permissive credential settings create an unintended trust bridge. The practical test is simple: if an arbitrary site can cause a refresh request to succeed, the browser boundary is not doing its job.

When teams want a deeper policy baseline for refresh behaviour, OAuth Refresh Token Rotation and Expiry Guide explains rotation, reuse detection, and expiry patterns that reduce the value of a stolen token. Rotation does not replace cookie and origin controls, but it limits how long a stolen token family remains useful.

What else you should check once exposure is suspected

If refresh tokens were exposed to script or accepted cross-origin, assume the attacker may already have minted access tokens. That means you need to look for suspicious non-interactive sign-ins, unexpected client or IP changes, and refresh reuse patterns. The question is not just whether the token was stolen, but whether it was already used to refresh a live session.

How to detect use of a stolen OAuth refresh token focuses on the signals that distinguish benign churn from replay, including reuse events and abnormal sign-in context. If the token can still be replayed, revocation and session invalidation should outrun forensic certainty.

Risk and Threat Considerations

When refresh tokens are reachable by JavaScript or usable from overly broad origins, the attacker’s goal is persistence, not just one-time access. That turns a single browser compromise, injected script, or cross-site request path into an ongoing token minting capability with a much larger blast radius.

Failure mechanism: The browser either exposes the refresh token directly to script or sends it in requests that an untrusted origin can trigger, allowing the attacker to exchange the token repeatedly for new access tokens.

Impact: Session takeover can continue after the original access token expires, often until the refresh token is revoked, rotated, or naturally expires. That can extend the compromise window, complicate incident containment, and preserve access to downstream applications and data.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, CIS Controls v8 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementRefresh tokens are authenticators whose lifecycle and protection control session continuity.
IA-2 — Identification and Authentication (Organizational Users)Browser-mediated refresh flows affect how authenticated sessions stay valid over time.
Recommendation — Protect refresh-token lifecycle, rotation, and revocation as managed authenticators. Require strong user authentication before issuing refresh-capable sessions.
CIS Controls v8CIS-6 — Access Control ManagementRefresh-token exposure expands access and needs strict control of who can refresh sessions.
Recommendation — Restrict and review refresh-capable access paths and revoke them quickly when exposed.
OWASP ASVSV7 — Session ManagementRefresh tokens directly extend session lifetime and replay risk.
V10 — OAuth and OIDCThe issue is specific to OAuth refresh-token handling, origin trust, and renewal security.
Recommendation — Validate session renewal, expiration, and invalidation controls for refresh flows. Enforce OAuth refresh-token handling rules that prevent replay and cross-site abuse.

Practitioner Guidance

What to verify: Confirm that refresh tokens are set only in httpOnly, Secure cookies and that credentialed refresh requests are accepted only from the intended origin set. Also verify that the refresh endpoint does not accept wildcard or reflected origins when cookies are involved.

Decision rule: If a refresh token can be read by JavaScript or reused from an origin you do not explicitly trust, treat it as an active session security defect, not a cosmetic browser setting. Fix the cookie and origin controls before you assume token rotation or MFA will contain the risk.

Practitioner takeaway: Refresh-token security is about preserving the browser boundary, not just hiding a value in storage. If origin trust is loose, the token can remain operational even when the rest of the session appears short lived.

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
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org