Hackthebox Notes Optimum Pwned
Optimum
I have no idea how this one will go.
Started out with autorecon scan, which took so much longer than my typical #nmap -sV -A -p- -oN outfile ipaddress scan.
Autorecon scans have finished.
Nothing unremarkable, port 80 open with HFS 2.3 marked as service version.
Navigated to 10.10.10.8:80 in browser, and yeah it’s a webserver with HttpFileServer 2.3.
Searched exploit-db for httpfileserver 2.3, found some exploits
Reviewed code for exploits and chose the Remote Code Execution exploit that looked the most promising, https://www.exploit-db.com/exploits/39161
I immediately reassigned the variables ip_addr & local_port to match my own.
I then pasted the variable vbs into an http decoder.
So essentially, the vbs script will look for nc.exe (netcat binary) at ip_addr (my vpn IP), and save it to C:\Users\Public.
Afterward, the exploit code will execute nc.exe in CMD at my ip address and given port.
So I copied nc.exe to a folder on my machine, and started an http server with #python3 -m http.server (this is python3 syntax).
I then started a netcat server with #nc -lnvp portnumber, where portnumber matches local_port from above script.
I then executed the exploit from my terminal with $python3 exploit.py 10.10.10.8 80.
It errored out.
I did some finagling and edited/troubleshot all the way down to the very bottom of the script (print statement), then I realized that the python script is written for python 2.7.
So I un-finagled the script, and ran it again with $/usr/bin/python2.7 exploit.py 10.10.10.8 80.
Exploit ran, I saw the http server I started hand out nc.exe with a 200 OK, and the open netcat shell connected with a CMD prompt.
I navigated to user desktop and type’ed flag, then ran systeminfo.
Meanwhile, on my own machine, I located windows-exploit-suggester. I updated it, pasted the sysinfo content into a systeminfo.txt, and ran the script with the updated database and txt.
Apparently this machine is vulnerable to an integer overflow.
I downloaded the suggested exploit with $wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/41020.exe into the http.server directory.
I then closed and started up a new http.server at a different port.
I messed around with a few variants of downloading via powershell and eventually this one worked:
I then navigated to that directory and executred the new exploit.
I saw no special output in the shell, until I ran whoami.
Yep, that’s me!
I then navigated to the Administrator’s desktop and type’d the root flag.
Another machine from the TJ Null OSCP Prep list complete. This makes 11 machines rooted so far.
Let me know what you think of this article on twitter @cpardue09 or leave a comment below!