ctf-writeup/Bucket CTF 2023/Auth
Muhammad Daffa 7ffa404e01 feat: added BucketCTF 2023 2023-04-12 21:38:33 +07:00
..
images feat: added BucketCTF 2023 2023-04-12 21:38:33 +07:00
README.md feat: added BucketCTF 2023 2023-04-12 21:38:33 +07:00

README.md

Auth

I just started learning about a new authentication method called JWT. This is my first website with it, could you check if its secure?

About the Challenge

We have been given a plain website and we need to find the flag there

preview

How to Solve?

First, we need to create an account by using the /register endpoint.

register

And then login again and you will see JWT token on the HTTP response body

login

Copy that JWT token, and then try to brute-force the key from the token (Without the key, we won't be able to modify the token's contents). In this case im using this tool (Especially jwt2john script). Im using this command to bruteforce the JWT token

python3 jwt2john.py eyJ...... > hash.txt
john -w=/usr/share/wordlist/rockyou.txt

First, we need to convert the JWT token to john format, and then johntheripper will bruteforce the token

brute

After that, we know the key is s3cret. Now use https://jwt.io to change the username to admin and then set the key in the VERIFY SIGNATURE section

jwt

You will notice in the HTTP response header there is a header called Info and in the header written we need to access /info endpoint

header

and then in the HTTP response body we need to access /validate endpoint also we need to provide the JWT token that we have signed before

validate

Now, go to the /validate endpoint and add the JWT token to the token parameter in order to obtain the flag.

flag

bucket{1_l0v3_jwt!!!1!!!!1!!!!!1111!}