
// TL;DR
On a private bug bounty program, the session JWT was an RS256 token — signed with a private key, meant to be verified against the public key on every request. The backend wasn’t actually doing that verification: it accepted a token whose signature didn’t match its payload. So I could take one user’s token, keep its signature, and swap in a different user’s payload, and the server trusted the forged claims — modifying that other user’s account. A JWT whose whole purpose is to be tamper-proof was tamper-proof in name only. Found, reported and was confirmed, fixed, and rewarded.
JWT in 60 seconds
A JSON Web Token (JWT) is three base64url parts joined by dots:
header.payload.signature
- Header — the algorithm, e.g.
{"alg":"RS256","typ":"JWT"}. - Payload — the claims: who you are,
user_id,email, expiry, etc. - Signature — a cryptographic signature over
header.payload, so the server can detect if either was tampered with.
The token used RS256 — asymmetric RSA. The server signs with a private key and verifies with the matching public key. The entire security model rests on one step: on every request, the server must recompute and verify the signature over the payload it received. If it skips that, the payload is just attacker-editable JSON.
That’s exactly what happened here.
The bug: a signature nobody checks
The backend accepted a token as long as it had a signature — but it never verified that the signature actually corresponded to the payload. In other words, the server treated “there’s a signature here” as good enough, instead of “this signature is cryptographically valid for this payload.”
The consequence is total. If the signature isn’t checked against the payload, I can change the payload to anything — a different user_id, a different email — while keeping a signature that was never going to match it, and the server still accepts it. It reads my forged claims and acts on them. The token’s identity becomes whatever I type into the payload.
The proof: swapping payloads
The cleanest way to prove “the signature isn’t verified” is to send a payload and a signature that don’t belong together and watch the server accept it. The flow, using two accounts I control (User A = me, User B = a second account):
- Log in as User A and open the account settings page.
- Submit a settings update, intercepting the request in Burp and sending it to Repeater. Strip the other cookies and keep only the session JWT.
- Log in as User B in a separate browser and grab their session JWT — specifically, just the payload (the middle segment).
- Graft User B’s payload into User A’s request: keep User A’s signature, swap in User B’s payload, and set a changed value (e.g. a different username) in the POST body.
- Send it. The update applied to User B’s account.
Conceptually, the tampered token looks like this — header and signature from User A, payload from User B. (This is a fabricated example token for illustration only; never publish a real JWT, which carries real account claims.)
session_jwt =
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9 <-- header (User A)
.eyJ1c2VyX2lkIjoidXNlci1CIiwiZW1haWwiOiJ2aWN0aW1AZXhhbXBsZS5jb20ifQ <-- payload (User B, forged in)
.RANDOM_SIGNATURE_FROM_USER_A_TOKEN <-- signature (User A)
That middle segment decodes to attacker-chosen claims — e.g. {"user_id":"user-B","email":"victim@example.com"} — while the signature belongs to a completely different token. Payload from one user, signature from another, and the server honoured it, modifying User B’s settings. That mismatch working is the whole proof: the backend is not verifying the signature. From there it’s trivial IDOR / account-modification across users by editing the user_id in the payload.
PoC note: I recorded a video walking the swap end to end. If you reproduce this concept on your own targets, use two accounts you own, and never paste a live token containing real PII anywhere.
Why manual testing caught this
Worth being clear about how this was found: I found it manually. The whole bug is a logic failure — a payload and signature that don’t match, accepted anyway. That’s the recurring truth with JWT and access-control bugs: the highest-impact ones are logic bugs, and logic bugs come from understanding what the token is supposed to guarantee and then checking whether the server enforces it. A scanner can flag some JWT issues, but not all — and it doesn’t know that your payload’s user_id is supposed to be bound to a verified signature. You do.
A Burp Pro JWT scan profile worth having
None of that means automation is useless — it means you point it precisely. Rather than scanning an entire site (slow, noisy), build a dedicated Burp Suite Pro scan configuration that only runs JWT checks, so you can aim it at a token and get a fast first read. It won’t replace the manual work above, but it’s a good quick pass.
And it genuinely finds real bugs. This exact JWT profile caught me a different signature-verification bypass on another target: there, the backend only validated the length of the signature — literally any string of the right length (aaaaa…) was accepted as a valid signature — and the payload could be freely manipulated on top of that. The scanner flagged the unverified signature; manual tampering confirmed it and worked out the payload manipulation. So a scoped scan profile is a legitimate part of the workflow — it just works best as a first pass that you confirm and extend by hand.
Build the profile once:
- Burp → Settings → Configuration library → New → Auditing.
- Name it
JWT. - Under Issues reported, choose individual issues, unselect all, then search
JWTand select every JWT-related check (signature not verified,alg:none, algorithm confusion, weak secret, etc.). - Under Insertion point types, select cookie parameter values and HTTP headers (that’s where tokens live — in this case the JWT was a cookie). Save.
Then, to test a token correctly — this part matters:
- Get a request that carries a valid, live JWT and send it to Repeater. Fire it and confirm the token is working and not expired — you should see the authenticated response you expect.
- Duplicate that request into a second Repeater tab and remove the JWT. Fire it.
- Compare the two responses. They must be clearly different (authenticated vs unauthenticated). If removing the token doesn’t change the response, Burp has no way to tell “valid” from “forged,” and the JWT checks come back meaningless. This differential is what lets the scanner judge whether a tampered token is still accepted.
- Once you’ve confirmed that difference, on the request with the valid token, select the JWT value and run an active scan with your
JWTprofile. Then review the scan’s requests/responses yourself under the scan details — don’t just trust the issue flag; read what the scanner sent and what came back.
And know its limits. A JWT profile is good for the common, mechanical issues — an unverified signature, alg:none, a trivially weak HMAC secret. But Burp cannot reliably detect every JWT attack class in one automated scan. Algorithm confusion (RS256→HS256, signing with the public key as the HMAC secret), kid path-traversal / SQL injection, jwk / jku header injection, and logic bugs in how claims are used generally need manual understanding and hand-crafted tokens — the scanner has no idea what your claims mean. Treat the profile as a fast first pass that flags the obvious, never as proof the token is safe. Everything it doesn’t flag, you test by hand — which, again, is exactly how the bug in this post was found.
Learn JWT attacks properly
If JWTs are new to you, don’t learn them from a single writeup — go do the labs. PortSwigger’s Web Security Academy has a free, excellent JWT attacks module that walks you through every variant hands-on: unverified signatures, alg:none, weak HMAC secrets, jwk/kid injection, and algorithm confusion. Working those labs teaches you to recognise each class instantly in the wild — and, just as importantly, to test each one by hand, which is where the real findings come from.
On the CLI, jwt_tool (ticarpi/jwt_tool) is the go-to: it decodes tokens, runs a full set of tampering/exploit playbooks (including the “signature not checked” and alg:none tests), cracks weak secrets, and can forge tokens once you’ve found the weakness. Between a Burp JWT profile for a quick pass and jwt_tool for hands-on tampering, you’ve got JWT testing covered.
The fix
The fix is simple to state: verify the signature on every request, server-side, before trusting a single claim.
- Always cryptographically verify
header.payloadagainst the expected key. For RS256, verify with the correct public key; reject the token if verification fails. - Pin the algorithm. Only accept
RS256(the algorithm you issue). Rejectalg:noneand reject HMAC algorithms on an RS256 token, so attackers can’t downgrade or confuse the verifier. - Use a vetted JWT library and let it verify — don’t hand-roll the check, and never treat “a signature is present” as verification.
- Authorize off verified claims only. The
user_idyou act on must come from a token whose signature you’ve validated, never from raw payload bytes.
Takeaways
- The fastest JWT test is a mismatch test. Pair a tampered payload with a signature that doesn’t belong to it and send it. If the server accepts it, the signature isn’t being verified — the single highest-impact JWT bug.
- The biggest JWT bugs are found by hand. Signature-not-verified, broken access control, claim-logic flaws — these are logic bugs. You find them by understanding what the token should guarantee and checking whether the server enforces it, not by waiting for a scanner to flag them.
- Create dedicated scan profiles instead of scanning at random. Targeted scans — scoped to one attack class (like JWT) and the right insertion points — give far better, cleaner results than firing a full scan at the whole app. Build a profile per attack type and point it precisely, as a quick first pass.
- Give the scanner a signal it can read. Confirm authenticated-vs-unauthenticated responses differ before scanning a token, or the JWT checks can’t distinguish valid from forged.
- The scanner is a first pass, not a verdict. Burp catches the mechanical JWT bugs, but not algorithm confusion,
kid/jkuinjection, or claim-logic flaws. What it doesn’t flag, you test by hand. - Learn the class, not the instance. Do the PortSwigger JWT labs and keep
jwt_toolhandy; JWT bugs repeat across targets, and knowing every variant makes them fast to spot.
Thanks for reading — hope it was useful. Happy hacking!
Leave a Reply