Challenges
JWT: weak key and admin signature
Web
Medium
Cracking the HS256 JWT secret key offline and unlocking the protected response with a role=admin token
Solves: 2
JWT: weak key and admin signature
Author: CyberSamSU
Points
50
During a system authentication audit, you were handed the jwt_audit.zip archive. It contains three files:
session_curl.log— theHS256JWT token obtained by the user viaPOST /api/v1/login, the403 Forbiddenresponse to the/api/v1/admin/vaultendpoint, and the401rejection response for thealg=noneattempt.wordlist.txt— a list of suspected weak HMAC secret keys.admin_vault.json— encrypted response entries that can only be decrypted with a validrole="admin"token signature and the secret key (a decoy entry is also included among them).
Task: using wordlist.txt, find the HS256 signing key offline, change the role field in the login payload to "admin", compute a new HS256 signature over compact JSON (with no whitespace and key order preserved), and decrypt the matching verify_tag entry in admin_vault.json to obtain the flag.
admin_vault.json specifies the key derivation rule: XOR with a key_i = SHA256(forged_sig_b64url + ":" + secret + ":" + str(i)) stream. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).
Attached files
jwt_audit.zip
Log in to download
Theory: learn the topic
To submit a flag, log in.