Challenges
JWT: alg=none attack
Cryptography
Medium
JWT
Solves: 4
JWT: alg=none attack
Author: CyberSamSU
Points
35
A JWT token consists of three parts: header.payload.signature — each encoded with base64url. Some libraries accept "alg":"none" in the header and do not verify the signature at all. This allows any payload to be forged.
The attached token.txt file contains a regular user token (admin=0) and the encrypted flag returned from the server. Simulated server rule:
javob = flag XOR SHA-256(qabul_qilingan_token)
That is, if you send a valid admin token, the key is determined and the flag is revealed. Construct the following forged token exactly (compact JSON, base64url, without padding), with an empty signature:
- header JSON:
{"alg":"none","typ":"JWT"} - payload JSON:
{"login":"talaba","admin":1} - token =
base64url(header) + "." + base64url(payload) + "."(a dot at the end — the signature is empty)
Attached files
token.txt
Log in to download
SHA-256 checksums
token.txt: 6995c543a6d5eff6d0eb124e53a27363b109ae0d528049c8d5fb46a7244797ba
Theory: learn the topic
To submit a flag, log in.