Grandpa Writeup w/ Metasploit

Reconnaissance

Run the nmapAutomatoarrow-up-rightr script to enumerate open ports and services running on those ports.

  • All: Runs all the scans consecutively.

We get back the following result.

We have one port open.

  • Port 80: running Microsoft IIS httpd 6.0

Before we move on to enumeration, letโ€™s make some mental notes about the scan results.

  • The only port that is open is port 80 so this will definitely be our point of entry. The port is running an outdated version of Microsoft IIS and is using the WebDAV protocol. One thing that pops out right away is the number of allowed HTTP methods. As mentioned in the scan results, these methods could potentially allow you to add, delete and move files on the web server.

Enumeration

Visit the web application in the browser.

Look into the directories/files that gobuster found. We donโ€™t find anything useful. Next, letโ€™s test the allowed HTTP methods.

The scan shows that the HTTP PUT method is allowed. This could potentially give us the ability to save files on the web server. Since this is an IIS Microsoft web server, the type of files it executes are ASP and ASPX. So letโ€™s check if weโ€™re allowed to upload these file extensions.

We get back the following result.

Unlike the Granny boxarrow-up-right, there are restrictions put in place that donโ€™t allow us to upload files, so this wonโ€™t be the way we gain initial access to the box. Next, letโ€™s run searchsploit on the web server version.

Microsoft IIS 6.0 is vulnerable to a remote buffer overflow.

Note: Several people I know have tried to solve this box without using Metasploit and have failed to because the shell you get back is too unstable. Therefore, Iโ€™ll be solving this box using Metasploit.

Initial Foothold

Start up Metasploit.

Viewing the exploit on exploitdbarrow-up-right we get a CVE # 2017โ€“7269arrow-up-right. Letโ€™s see if Metasploit has an exploit for it.

It does. Letโ€™s switch to that exploit and configure the RHOST to the Grandpa IP address.

Then run the exploit.

We get a shell! However, when we run the โ€œgetuidโ€ command, we get an operation failed error. This is because weโ€™re running in an unstable process. To fix that, letโ€™s see which processes are running on the box and migrate to one that is running with the same privileges that the meterpreter session is running with.

Letโ€™s migrate to process # 2172 and try running the โ€œgetuidโ€ command again.

Perfect! We have a stable working meterpreter session. Weโ€™re running with low privileges, so weโ€™ll need to escalate our privileges to SYSTEM.

Privilege Escalation

Background the meterpreter session.

Weโ€™ll use the Local Exploit Suggester module to check the box for local vulnerabilities.

Run the Local Exploit Suggester.

Weโ€™ll use MS14โ€“070 to escalate privileges.

The exploit was successful! Letโ€™s go back and enter our meterpreter session and view our privilege level.

Weโ€™re SYSTEM! Grab the user.txt and root.txt flags.

Lessons Learned

We gained initial access to the machine and escalated privileges by exploiting known vulnerabilities that had patches available. So it goes without saying, you should always update your software!

Last updated