Try Harder Next Time

Mission failed, we'll get 'em next time

I spent the last three days on an “easy” box called Optimum To give an idea of how much I struggled, here’s the folder I threw everything Optimum-related into. Note to self: work on folder organization.

sinkorswim_messy_folder.png

Yesterday, I finally rooted and looted Optimum for a chestful of XP. Here’s what happened.

The Nmap scan discovered that only port 80 was open.

scan.png

Webpage: webpage.png

The server hosts HTTPFileServer 2.3. Searchsploit showed the following vulnerabilities:

hfs_vuln.png

Score! An exploit existed in Metasploit.

hfs_metasploit.png

But it didn’t work :(.

hfs_metasploitfail.png

In retrospect, the exploit didn’t work because I didn’t set the local IP to my VPN address. Instead of realizing that, I decided to take the Metasploit training wheels off. I had to use a custom exploit and even understand it potentially. I dug into many exploits but eventually found the ticket: 39719.py. Getting 39719.py to work was hard.

39719.py.png

The next day, a n00b like me from work helped me pull off the exploit with the power of teamwork. Sam and I decoded the url-encoded VBS payload that 39719.py injected into the site’s unsanitized REGEX query and discovered it was attempting to download nc.exe from an HTTP server.

decodedVBS.png

Then Sam did the unthinkable: he actually read the developer’s comments. Soon we had a Python HTTP server ready to go on port 80 and Netcat server on port 1234 - like what the comments said to do. Houston, we have a shell!

ncshell.png

Rooting the machine through this shell turned out to be even more difficult. I didn’t know where to go from a shell so I Googled for ways to upgrade to a Meterpreter session. Msfvenom generated the reverse_tcp payload but how do I run it on the machine? Thanks to Stack Exchange, I found out that certutil.exe can do the job.

certutildownload.png

It worked! I ran local_exploit_suggester in Metasploit but neither of the two results worked. I still don’t know what to look for when enumerating a system so I desperately need these automated exploit suggesters. Fortunately, I found GDSSecurity\Windows-Exploit-Suggester which suggested these vulnerabilities based on the target’s systeminfo.

Unfortunately, many of them were proof-of-concepts. I spent several hours trying to use Local Privilege Escalation (MS16-032) (PowerShell) because I’m familiar with PowerShell, but did not succeed. On Monday evening, I gave up. All the tools and information were in front of me but I didn’t want to “try harder” to figure out the solution myself.

After Googling the box, I discovered that other players experienced the same issue of Metasploit modules not working as expected against Optimum. I found the solution on Raj Chandel’s blog: use Microsoft Windows 8.1 (x64) - RGNOBJ Integer Overflow (MS16-098) manually to escalate privileges; rooting with this exploit was as easy as uploading the binary then running it in a cmd shell!

rooting.png


I tried swimming on my own but ultimately, I didn’t believe myself and sank into the cold embrace of failure walkthroughs. I learned a lot about the basics - using common tools like Netcat, deploying Msfvenom payloads, dissecting exploit scripts, and working outside of Metasploit - but I will believe in myself more in the future. At the moment, giving up means using a walkthrough. On the OSCP exam, giving up means losing points. I had the solution staring at me from the Windows-Exploit-Suggester output. If I tried harder and iterated down the list, I could have solved this box without the answer.

*****
Written by Nibs on 09 July 2019