Logged Out But Still In: How I Exploited a JWT Flaw to Bypass Authentication
The application did not revoke JWT tokens on logout, so a captured token remained valid and could be replayed to regain full access. An attacker who obtained a token could therefore access the account even after the user logged out.
Published on medium.com
While testing an application, I decided to inspect how it handled authentication. It used JWTs (JSON Web Tokens), like many modern apps.
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 application used JWTs in a purely stateless way, trusting any cryptographically valid token without server-side session tracking or revocation on logout.
Impact
An attacker who captures a valid session token could reuse it after the user logs out, gaining unauthorized access to the account; the text notes this may be considered a security trade-off rather than a flaw by some programs.
What the attacker needed
Attacker captures a valid JWT; victim logs out (or not)
The fix
The application should implement a mechanism to invalidate tokens on logout, such as a revocation list or server-side session tracking.
How it was found
- Log in normally.
- Capture the JWT token from a request using Burp Suite.
- Log out from the app.
- Wait a bit, then send the same JWT in a request again.
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 like a digital pass that proves who you are. When you log out, the app should cancel that pass so it can't be used again. Here, the app only deleted the pass from the browser but the server still accepted it, so anyone who copied the pass earlier could keep using it.
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.