← JWT lesson
IdentityJWTIntermediate30 min+100 XP

Vendor Claim

The Vendor Portal stores its session as unsigned base64url JSON. The server trusts the role claim. Reach the admin console.

“The cookie looked like a signed contract. It was a Post-it note with a role written on it.”

CWE-347OWASP Top 10 A02:2021OWASP ASVS 3.5.3
The story
A JWT is a container for claims. The server must verify who produced it and whether the claims are still allowed. Decoding is not verifying.

Some applications store base64url JSON without a signature. Others accept alg=none, use a guessable HMAC secret, or trust a role claim without checking it against the database. The attacker changes the claim and the server believes it.

Your objective
  • Decode the session cookie
  • Change the role claim to admin
  • Open the admin console and capture the flag
Boundary under test

Token bytes to verified claims

Field guide · request anatomy

Where to look before you type a payload

01Issue

The server creates a header, payload and signature, then sends the token to the client.

02Store

The client keeps it in a cookie or storage. The server must protect it from theft and fixation.

03Present

The token returns in a header or cookie on each request.

04Verify

The server checks the signature, algorithm, issuer, audience, expiry and key before trusting any claim.

Progressive hints

Open one hint at a time. The first two build the model; the last two point at the boundary.

Hint 1

Decode the session cookie. Is it signed, or just base64url JSON?

Hint 2

Inspect the header algorithm and the role claim.

Hint 3

The cookie decodes to JSON without a signature. Change the role to admin and replay it.

Hint 4 · near the answer

Forge an admin token and open the admin console.

Guided workbench

Observe → Hypothesize → Test → Prove → Explain

This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.

0/15steps complete
Observe0/3
Hypothesize0/3
Test0/3
Prove0/3
Explain0/3

Evidence log

Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.

Preview the evidence report
# Lab evidence report — Vendor Claim

- Family: JWT
- Lab ID: web-jwt-vendor-portal
- Date: 2026-12-05

## Workflow

### Observe

- [ ] Open "Vendor Claim" and record /admin, the HTTP method and the role you are given.
- [ ] List every parameter, header, cookie and object identifier the normal flow exposes.
- [ ] Save a baseline response: status, body shape, timing and the fields that change by user.

### Hypothesize

- [ ] Name the server decision that protects /admin, and the evidence it should use.
- [ ] Use the clue as a constraint, not an answer: The session cookie is base64url JSON, not a signed JWT. Change the role claim.
- [ ] Predict the exact status, body or state change that would prove the decision is missing.

### Test

- [ ] Start from the baseline and change one value: the token cookie.
- [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result.
- [ ] Capture the full request and response for the winning attempt, including the flag.

### Prove

- [ ] Capture the flag and name the exact foreign object, role or state change it proves.
- [ ] Repeat from a clean session and confirm the result is not cached or stale.
- [ ] State impact precisely: what data or action did you actually obtain?

### Explain

- [ ] State the root cause without naming the payload: which decision failed?
- [ ] Name the control that prevents recurrence and the layer where it belongs.
- [ ] Write one regression test that fails before the fix and passes after it.

## Evidence

### Target and baseline

_Not recorded._

### Hypothesis

_Not recorded._

### Winning request

_Not recorded._

### Proof

_Not recorded._

### Root cause

_Not recorded._

### Control and regression test

_Not recorded._

## Analyst conclusion

The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
Solution and debrief
Locked until you capture the flag.

The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.

What a reviewer will ask

False positives to rule out

  • The payload is readable: JWT payloads are encoded, not encrypted. Confidentiality requires encryption or avoiding sensitive claims.
  • Changing a claim breaks the signature: that is expected; look for endpoints that decode without verifying.
  • The token uses HS256: HMAC is not inherently weak, but the secret must be long, random and rotated.

Regression tests to name

  • Algorithm pinning: Verification fails and no claims are trusted
  • Claim tampering: The request is rejected
  • Key endpoint: The server uses only its configured key set
The defender's move
  • Allowlist the accepted algorithm and verify the signature before reading claims.
  • Use a strong secret or asymmetric keys, rotate them and keep expiry short.
  • Authorize every sensitive action against server-side state, not only token claims.
See the secure-code pattern and all 4 regression tests →
الخلاصة

التوكن ليس ثقة بحد ذاته؛ الثقة في التحقق من توقيعه ومن صلاحياته.