Skip to content
OAuth / SSO Write-up Intermediate

JWT Refresh Token Manipulation

The authorisation server did not check that a refresh token belonged to the same user as the access token being refreshed. An attacker could use their own refresh token to obtain a new, valid access token for a victim's account, even if the victim's original access token had expired.

Mikail Tunç Follow

Published on emtunc.org

This is a quick blog about a bug I found in a private bounty program on Bugcrowd. The reason for me writing about it is to increase awareness around these issues and implementation flaws so that fellow bug bounty hunters/people in Infosec/developers can use the information in this article for the betterment of…

Mikail Tunç (@emtunc), on emtunc.org

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 authorisation server did not verify that the refresh token presented matched the user who owned the access token being refreshed.

Impact

An attacker could obtain a brand new, valid access token for a victim account using only their own refresh token, and revoking the victim's token would not help because any refresh token would work.

What the attacker needed

A valid refresh token for any account; a victim's access token (even expired)

The fix

The authorisation server should validate that the refresh token belongs to the user submitting the access token, and never refresh an access token without the corresponding correct refresh token.

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 JSON Web Token (JWT) is a signed piece of data a server gives a client to prove who it is. A refresh token is a longer-lived secret used to get a new access token when the old one expires. Here the server failed to check that the refresh token and the access token belonged to the same person, so anyone with any valid refresh token could mint a fresh access token for someone else.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by Mikail Tunç

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.