JWT Testing Checklist for QA Engineers

To test a JSON Web Token (JWT), decode it, then check that the server rejects every version of it that it shouldn't trust: a changed payload, a removed or none signature, an expired token, and a token meant for a different audience or issuer. If any of those still returns 200, authentication is broken. This checklist shows how a QA engineer can run those checks with Burp Suite and automate them.

JWT problems fall under API2:2023 Broken Authentication in the OWASP API Security Top 10. They are usually configuration and library mistakes, which makes them very testable.

Only test applications you're authorized to test: your own product, a staging environment you have permission for, or a bug bounty programme whose scope includes the target.

1. Decode the token and read what's inside

A JWT is three base64url parts separated by dots: header.payload.signature. The header and payload are encoded, not encrypted, so anyone holding the token can read them. Decode one from your test session:

node -e "const p=process.argv[1].split('.'); console.log(JSON.parse(Buffer.from(p[0],'base64url')), JSON.parse(Buffer.from(p[1],'base64url')))" "$TOKEN"

Avoid pasting real production tokens into online decoders. Decode locally, or use the JWT Editor extension in Burp Suite. Then note:

2. Tamper with the payload and keep the signature

Change one claim, for example "role": "user" to "role": "admin" or the sub to another user's ID, re-encode the payload and send the token with the original signature. The server must reject it, usually with 401. If it accepts the change, it isn't verifying the signature. Do the same for each claim the application trusts.

3. Test the "alg: none" and algorithm-confusion cases

4. Check for weak signing secrets

With HS256, the whole scheme depends on the secret being long and random. On a staging token you're authorized to test, you can try a wordlist offline. Hashcat supports JWT with mode 16500. If a short or default secret like secret or the app's name cracks, anyone can forge tokens. Report it and recommend a random secret of at least 32 bytes, or an asymmetric algorithm.

5. Validate the claims, not just the signature

A token with a valid signature can still be wrong for the request. Test each of these and expect a rejection:

6. Test header parameters that point to keys

Some headers tell the server where to find the verification key: kid, jku, jwk and x5u. The server must never trust a key the token supplies for itself. Try these:

7. Test the token's lifecycle

Once authentication holds, check authorization too, with the two-account method in my IDOR testing checklist.

8. Automate the checks in Playwright

Manual findings should become regression tests. Playwright's API testing support is enough for this. Here are two examples, one for alg: none and one for a tampered payload:

import { test, expect } from "@playwright/test";

const b64 = (o) => Buffer.from(JSON.stringify(o)).toString("base64url");

test("rejects an unsigned alg=none token", async ({ request }) => {
  const token = `${b64({ alg: "none", typ: "JWT" })}.${b64({ sub: "1042", role: "admin" })}.`;
  const res = await request.get("/api/profile", {
    headers: { Authorization: `Bearer ${token}` },
  });
  expect(res.status()).toBe(401);
});

test("rejects a tampered payload", async ({ request }) => {
  const [h, , s] = fixtures.userA.token.split(".");
  const forged = `${h}.${b64({ sub: "1", role: "admin" })}.${s}`;
  const res = await request.get("/api/profile", {
    headers: { Authorization: `Bearer ${forged}` },
  });
  expect(res.status()).toBe(401);
});

Add expired-token and wrong-audience cases the same way, using tokens generated by your test environment. Run them in CI alongside your functional suite, as described in QA automation and security testing in one CI pipeline.

9. Report JWT findings so they get fixed

Key takeaways

FAQ

Is a JWT encrypted?

No. A standard signed JWT (JWS) is only base64url-encoded and signed. Anyone can read its contents, but only the holder of the key can create a valid signature. If you need to hide the contents, use an encrypted token (JWE) or keep the data on the server.

What is the most common JWT vulnerability?

Weak or missing verification: accepting alg: none, not checking the signature, using a guessable HS256 secret, or skipping expiry and audience checks. All of them are quick to test, which is why they belong in a QA security checklist.

Which tools do I need to test JWTs?

Burp Suite with the JWT Editor extension for manual tampering, Hashcat for offline secret testing on tokens you're authorized to test, and Playwright or any API test tool to automate the checks in CI.