Penetration Testing with Kali Linux OffSec


curl -i http://192.168.50.16:5002/users/v1/login


səhifə117/132
tarix21.12.2023
ölçüsü
#187693
1   ...   113   114   115   116   117   118   119   120   ...   132
PEN-200

curl -i http://192.168.50.16:5002/users/v1/login
HTTP/1.0 404 NOT FOUND 
Content-Type: application/json 
Content-Length: 48 
Server: Werkzeug/1.0.1 Python/3.7.13 
Date: Wed, 06 Apr 2022 12:04:30 GMT 
{ "status": "fail", "message": "User not found"}
Listing 111 - Inspecting the ‘login’ API 
Although we were presented with a 
404 NOT FOUND
message, the status message states that 
the user has not been found; another clear sign that the API itself exists. We only need to find a 
proper way to interact with it. 
We know one of the usernames is 
admin
, so we can attempt a login with this username and a 
dummy password to verify that our strategy makes sense. 


Penetration Testing with Kali Linux
PWK - Copyright © 2023 OffSec Services Limited. All rights reserved. 
229 
Next, we will try to convert the above GET request into a POST and provide our payload in the 
required JSON
356
format. Let’s craft our request by first passing the admin username and dummy 
password as JSON data via the -d parameter. We’ll also specify “json” as the “Content-Type” by 
specifying a new header with -H. 
kali@kali:~$ 
curl -d '{"password":"fake","username":"admin"}' -H 'Content-Type: 
application/json' http://192.168.50.16:5002/users/v1/login
{ "status": "fail", "message": "
Password is not correct for the given username.
"} 
Listing 112 - Crafting a POST request against the login API 
The API return message shows that the authentication failed, meaning that the API parameters 
are correctly formed. 
Since we don’t know admin’s password, let’s try another route and check whether we can register 
as a new user. This might lead to a different attack surface. 
Let’s try registering a new user with the following syntax by adding a JSON data structure that 
specifies the desired username and password: 
kali@kali:~$

Yüklə

Dostları ilə paylaş:
1   ...   113   114   115   116   117   118   119   120   ...   132




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin