Friendzone
HTB Writeup: friendzone
Introduction
Friendzone was my third box to own on HackTheBox. I learnt alot from this box. Such as exploiting Local File Inclusion (LFI) to have PHP execute my reverse shell, to understanding more about DNS and the ways python imports libraries.
Enumeration
nmap
Running nmap on a server will give a lot of information on what ports are open on the machine and what services those ports belong to.
|
|
From running the above command we see the following services and ports running on friendzone.
- ftp 21
- ssh 22
- domain 53
- http 80
- samba 139
- https 443
- samba 445
Looking into the samba share.
Kali comes with a great tool smbmap for doing recon on samba shares.
|
|
Running it we get this result.
|
|
This tells use we have read only access to general and can read and write to Development. Lets start of by seeing what can be found in general. To do this I used smbclient on kali:
|
|
When prompted for a password you can just hit enter and get a smb shell. Hitting ls
there is a file called creds.txt lets grab that with get creds.txt
putting it onto the local machine and using cat to read it we get:
creds for the admin THING:
admin:WORKWORKHhallelujah@#
Lets have a quick look into Development using the same smbclient command as before and see if there is anything interesting. It just contains rubbish but lets remember for the future we can write to this directory and that can be incredible useful for exploitation.
The Website
So we have admin credential that do not work for ssh so maybe the website contains. I used dirb which is a peice of software that takes a list of common urls and trys them against a target. Dirb proved to not find anything other than a mocking robots.txt and an index page:
That is when I remembered the server was running a DNS service…
Digging through DNS.
DNS is the service that resolves a human readable website url such as www.google.com to an ip address. Thanks to ippsec1 video were he uses a range of tools to enumerate DNS. The only command he used that was any use was dig. Running:
|
|
Getting the domain friendzoneportal.red from the home page email address returns:
|
|
admin.friendzoneportal.red
Great! we have found the admin page. Lets update our /etc/hosts file to use these new domains. Unfortuantly you cannot use the servers dns service as they all resolve to localhost. Initially visiting admin.friendzoneportal.red just shows the same index page. So lets try https
Excellent we have a login form but when we log in we are just told
Admin page is not developed yet !!! check for another one
so more digging is required. Checking the SSL certificate from the website can see the issue is from a friendzone.red lets run dig again but this time zone transfer without the portal in the domain.
|
|
Update /etc/hosts and visit https://administrator1.friendzone.red
Login using the username and password from creds.txt we got earlier from the samba share. On logging in we are told to visit /dashboard.php
Exploiting the LFI.
References
- ippsec [2]:http://pentestmonkey.net/tools/web-shells/php-reverse-shell
- php-reverse-shell