Token Tunnels: How Misused Refresh Tokens Let Me Hijack Sessions
The refresh token endpoint allowed reuse of the same refresh token indefinitely and accepted a modified scope parameter, enabling an attacker to escalate privileges to admin. An attacker with a low-privileged user's refresh token could maintain persistent access and gain admin-level access.
Free Link 🎈
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the refresh token endpoint did not enforce token expiry, rotation, or scope validation, allowing indefinite reuse and privilege escalation.
Impact
An attacker could maintain persistent session hijacking and escalate privileges from a regular user to admin, potentially accessing sensitive admin functionality.
What the attacker needed
A low-privileged user account; ability to intercept HTTP requests
The fix
The refresh token endpoint should be fixed to enforce token expiry, implement refresh token rotation (invalidate after one use), and validate requested scopes during token exchange.
How it was found
- Intercept a request after logging in to observe the refresh token endpoint.
- Reuse the same refresh token multiple times to obtain new access tokens.
- Continue using the same refresh token even after 24 hours to confirm it remains valid.
- Modify the refresh request to include a scope parameter set to admin.
- Use the newly issued access token with admin scope to access admin-only endpoints.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A refresh token is like a spare key that lets you get a new access pass without logging in again. Normally, each spare key should work only once and expire, but here it could be reused forever and even upgraded to an admin key. This meant someone could keep using the same key to stay logged in and become an administrator.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.