Skip to content
Access control Write-up Beginner

JWT Authentication Bypass

The API accepted JWTs without verifying their signature, so a token whose payload had been altered was still treated as valid. An attacker could change claims in the token and use it to reach protected API endpoints that otherwise returned 401 Unauthorized.

medium.com

Published on medium.com

This is a simple write-up about a critical vulnerability I discovered due to a JWT signature validation bypass

d7meealz, on medium.com

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 backend decoded the JWT payload and trusted its claims without verifying the token's signature.

Impact

The bypass worked across the entire API, allowing access to multiple protected endpoints that returned sensitive data, including tokens used to control purchase transactions.

What the attacker needed

Access to a JWT issued by the application; ability to send requests to the API

The fix

The backend should verify the JWT signature with the correct key before trusting any claim in the token.

How it was found

  1. Scan the API and notice that most paths return 401 Unauthorized but the application settings endpoint returns 200 OK.
  2. Decode the JWT used by the application, which is Base64-encoded.
  3. Change the verified claim in the payload from true to false and re-encode the token.
  4. Send the modified token in the Authorization header to another API endpoint such as the users endpoint.
  5. Observe that the endpoint returns 200 OK instead of 401 Unauthorized.

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 JWT is a token a server gives you after login; it contains data and a signature that proves the data was not changed. This server read the data but never checked the signature, so anyone could edit the token and still be trusted. That let the person reach parts of the API that should require a valid login.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.