Lab 2 JWT authentication bypass via flawed signature verification

PreviousLab 1 JWT authentication bypass via unverified signatureNextLab 3 JWT authentication bypass via weak signing key
Last updated
This lab uses a JWT-based mechanism for handling sessions. The server is insecurely configured to accept unsigned JWTs.
To solve the lab, modify your session token to gain access to the admin panel at /admin, then delete the user carlos.
You can log in to your own account using the following credentials: wiener:peter
Vuln: Server accepts unsigned (alg: none) tokens.
Steps:
Log in as wiener, capture session JWT.
Change sub claim → administrator.
Change header alg → none.
Strip signature, keep trailing dot (header.payload.).
Send to /admin → access granted.
Delete carlos via /admin/delete?username=carlos.
Root cause: Server trusts alg from the token instead of enforcing it server-side.
Fix: Whitelist accepted algorithms server-side; explicitly reject none.

Last updated