BroncoCTF 2025
Miku’s Autograph Challenge Walkthrough
Challenge
Initial Reconnaissance
Initial Analysis
Upon accessing the website, the source code reveals several interesting components:
|
|
The HTML code shows key features that warrant attention:
- A “Magic Miku Login” button that triggers the
magicMikuLogin()
function - A clearly displayed list of registered users:
miku_user
andmiku_admin
- Client-side JavaScript that handles the authentication flow
The JavaScript code reveals a two-step authentication process:
- Fetch a token from
/get_token
- Submit the token to
/login
for authentication
Technical Analysis
Authentication Flow Investigation
When clicking the Magic Miku Login button, the application makes a request to /get_token
:
The response contains a JWT token. This token becomes particularly interesting as it reveals the authentication mechanism. Looking at the subsequent login request:
The login response shows a critical piece of information: access is denied because the current user is not miku_admin. This suggests that the objective is to gain administrative access.
JWT Token Analysis
Examining the obtained token using a JWT decoder reveals its structure:
The decoded token exposes several important details:
- The token uses the
HS256
algorithm for signing - The payload contains a
sub
claim set tomiku_user
This structure suggests that user authorization is determined by the sub
claim, making it a potential target for manipulation.
Exploitation Strategy
Token Manipulation Process
Using CyberChef as our token manipulation tool, the following modifications were made:
The token manipulation process involved:
- Changing the algorithm from “HS256” to “none” to bypass signature verification
- Modifying the “sub” claim from “miku_user” to “miku_admin”
Successful Exploitation
Using the forged token in a login request yields success:
The response reveals the flag, confirming successful exploitation of the JWT vulnerability. This proves that the application accepts unsigned tokens and relies solely on the “sub” claim for authorization.
Key Takeaways
Vulnerability Analysis
This challenge highlights several critical web security concepts:
- The dangers of trusting client-controlled JWT claims
- The importance of proper token signature validation
- The risks of exposing user role information in tokens
Security Recommendations
To prevent such vulnerabilities:
- Always validate JWT signatures using strong, unique secrets
- Implement proper algorithm enforcement
- Add server-side role validation beyond JWT claims
References
- JWT Attack Guide: https://portswigger.net/web-security/jwt
- OWASP JWT Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_for_Java_Cheat_Sheet.html