HTB - Bounty

Getting Root
The box only had port 80 running which had an application that allows to upload files while preventing asp, aspx and few other file extensions.
I was bale to bypass the upload filter using a null byte
%00.jpgbut the application generated an error giving a clue about something related to web.config.After some research about web.config, I was able to find an article describing how to upload a web.config file with ASP code embedded and I was able to get a shell.
For privilege escalation, I was able to get system using MS10-059
Tools used:
nmap, nikto, gobuster, nishang, windows-exploit-suggester.py
Nmap
Enumerating HTTP
Port 80 just shows a picture. I saved the picture as merling.jpg and used strings, steghide and exiftool but didn't find anything.

Nikto
Nothing much was found with Nikto
Gobuster
Testing transfer.aspx
I tried uploading a file with ASP, ASPX and it failed. But when I uploaded the merling.jpg file it worked. Based on that, I used Burp proxy to intercept the request and used a null byte %00 to attempt to bypass the upload filter.

When I tried to execute the shellie.aspx file http://10.10.10.93/UploadedFiles/shellie.aspx I got the following error below.

I have no idea what to do from here, so I googled "IIS 7.5 web.config exploit" and to my surprise, I found the following link stating that we can actually upload a *.config file with asp code and it would work.

Here is the link:
Explanation of web.config as quoted from the link above:
Web.config
What is a web.config file?
A web.config file lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web.config file in your root directory, it will affect your entire site. If you place it in a /content directory, it will only affect that directory.
With a web.config file, you can control:
web.config files are XML documents. ‘.config’ is not an extension like ‘.html’ or ‘.txt’.
Getting a Reverse Shell
The link I found on google, refers to the following link below for the code they used in order to get RCE.
I used the example code I found but with a few modifications:
Uploading the web.config file


I can also confirm using tcpdump:
I used nishang reverse powershell script and modified the web.config code as follows:
Uploaded the new web.config file
Executed it via
http://10.10.10.93/UploadedFiles/web.configStarted the listener on port 8008 ( I edited on the nishang reverse tcp script)
Got a shell as merlin
Started python http server
Privilege Escalation
I used the windows exploit suggester
I used MS10-059. A google search on MS10-059 github takes you to the following link with an exe executable
Download the executable to the target using certutil
Executing the exploit
Started a Listener
Got Reverse Shell as SYSTEM
Last updated