Skip to content
Access control Write-up Beginner

Revisiting JWT Token Forgery Attack on Recent Bounty Target

The partner portal API accepted unsigned JWTs with the 'none' algorithm, allowing an attacker to forge tokens and bypass authentication. Because the authorization check compared the query parameter id with the id inside the same forged token, an attacker could enumerate partner records by changing the id in both places.

infosecwriteups.com

Published on infosecwriteups.com

Almost every portal I test authenticates with a JWT, and the flow is always the same. You log in, the server signs a token stating who you are and what you can see, and every request after that carries the token instead of a session lookup.

Alvin Ferdiansyah, on infosecwriteups.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

The JWT validation layer did not verify the signature and accepted tokens with the 'none' algorithm, and the authorization check relied on identity data from that same untrusted token.

Impact

An unauthenticated attacker could read partner records including account numbers, addresses, phone and fax numbers, and company emails, with no rate limiting encountered.

What the attacker needed

No account needed; Network access to the API

The fix

The verifier should be configured with an explicit allowlist of expected algorithms and trusted keys, reject unsigned tokens unconditionally, and base authorization on a server-established identity rather than token claims.

How it was found

  1. Send a request without a token and observe a 500 validation error.
  2. Craft a JWT with header alg set to none and an empty signature, containing a user object with a chosen partner id.
  3. Send the forged token in the Authorization header to the partner endpoint with a matching id query parameter.
  4. Receive the partner record with HTTP 200.
  5. Change the partner id in both the token and the query parameter to access other records.
  6. Loop over partner ids to enumerate the directory.

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 that a server gives you after login to prove who you are. It has three parts, and the last part is a signature that stops you from editing it. Here the server never checked that signature, so the tester could write their own token claiming to be any user and the server believed it.

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.