HackTheBoxActiveDirectoryWindowsVulnLabs

JobTwo

Phishing HR via SMTP with a macro-laced DOCM shells Julian. hMailServer DB decryption exposes Ferdinand's crackable hash. Evil-WinRM pivots laterally. CVE-2023-27532 against Veeam 10.0.1 gives SYSTEM.

Platform: VulnLab Machine: JOB2 IP: 10.129.238.35 Difficulty: Hard OS: Windows


1. Reconnaissance

Port Scan

An nmap service/version scan against the target reveals a rich Windows attack surface:

Notable: the SMTP service accepts unauthenticated mail (AUTH LOGIN) which immediately stands out as an attack vector.

Web Enumeration

The HTTPS site at https://job2.vl hosts a job listing titled "Captain Wanted" — a boat rental company seeking a part-time fishing captain. The critical detail:

"If you are interested in this position, please send your CV to [email protected]envelope as a Microsoft Word Document."

This is a classic macro-based phishing / red team scenario: an HR inbox is actively reading Word documents, making it ideal for a malicious macro payload.


2. Initial Foothold — Malicious DOCM via SMTP

Attack Plan

The objective is to craft a Word document (.docm) containing a VBA macro that calls back to our attack machine, and deliver it via the unauthenticated SMTP port to [email protected].

Step 1 — Craft the Macro

Create a .docm file with an AutoOpen macro. The macro uses WinExec (a low-level Win32 API call via kernel32) to silently run PowerShell and download a reverse shell script from our HTTP server:

  • AutoOpen executes automatically when the document is opened — no user interaction beyond clicking "Enable Macros".

  • uCmdShow = 0 hides the PowerShell window (SHOW_HIDE).

  • The payload is fetched over HTTP from our machine (10.10.16.5) at runtime.

Verify the macro is embedded correctly using olevba:

Step 2 — Host the Reverse Shell

The shell.ps1 is a standard PowerShell TCP reverse shell:

Serve it on port 80:

Step 3 — Set Up Listener

Step 4 — Send the Email

Using sendemail to deliver the .docm to HR over the unauthenticated SMTP server:

The HR bot automatically opens the attachment. Within seconds, our netcat listener receives a connection:


3. Post-Exploitation as Julian

Verify Access

Julian is a standard user (Medium Mandatory Level), member of Remote Desktop Users and BUILTIN\Users. No interesting privileges beyond the baseline.

Process & Application Enumeration

Reviewing running processes and installed software reveals several key services:

  • SQL Server (sqlservr.exe, sqlbrowser.exe, sqlwriter.exe)

  • Veeam Backup & Replication (multiple services: Veeam.Backup.Service.exe, Veeam.Backup.Manager.exe, etc.)

  • hMailServer — visible in C:\Program Files (x86)\hMailServer

The combination of hMailServer and Veeam provides two distinct privilege escalation paths.


4. Privilege Escalation — hMailServer Database

Reading the hMailServer Config

nothing interesting there, we'll see more of installed and running processes, in Program Files (x86) we see hMailServer, which we know is running from our previous nmap scan

The .ini file exposes:

Two hashes are present:

  • The admin UI password (MD5): 8a53bc0c0c9733319e5ee28dedce038e

  • The database encryption password (hMailServer proprietary encryption): 4e9989caf04eaa5ef87fd1f853f08b62

we get the admin hash from here let's try to crack it and use it to access hMailServer.sdf using the password

Decrypt the Database Password

The database password uses hMailServer's reversible XOR-based encryption. Using hmdecryptarrow-up-right (a .NET tool):

Query the hMailServer Database (.sdf)

The database file is a SQL Server Compact Edition (.sdf) file. We load the appropriate DLL and query it directly from PowerShell on the target:

These are the DLLs required to talk to SQL-CE

Results:

These are hMailServer SHA-256 salted hashes (format: sha256($salt.$password)).

Crack with John the Ripper

Cracked:

Account
Password

5. Lateral Movement — Ferdinand via Evil-WinRM

Ferdinand's domain password reuses against the Windows local account. WinRM (port 5985) is open (and get the user flag):


6. Root — CVE-2023-27532 (Veeam Backup & Replication)

Identify the Veeam Version

Version 10.0.1.4854 is vulnerable to CVE-2023-27532 — an unauthenticated credential extraction vulnerability in Veeam Backup & Replication that allows any local (or network) user to extract credentials stored by the backup service, typically leading to SYSTEM execution.

The service listens on port 9401:

Exploit

Upload the pre-compiled exploit and its required DLL dependencies: this is the port running the Veeam backup service this is a pre-compiled binaryarrow-up-right for it.

we will upload these 4 files on our target machine

Start a netcat listener on port 8001, then run the exploit with a base64-encoded PowerShell reverse shell payload targeting the Veeam service on 127.0.0.1:9401:

The Veeam service runs as NT AUTHORITY\SYSTEM, so the injected command executes with full system privileges.

Shell caught:


7. Flags

Flag
Value

User (Ferdinand)

ed99xxxxxxxxxxxxxxxxxxxxxxxxxf413b

Root (Administrator)

0fb1xxxxxxxxxxxxxxxxxxxxxxxxxx39df


Attack Chain Summary


Key Techniques & Tools

Technique
Tool/Method

Network scanning

nmap -sCV

VBA macro analysis

olevba

Malicious document delivery

sendemail via unauthenticated SMTP

PowerShell reverse shell

TCP socket shell (shell.ps1)

hMailServer DB decryption

hmdecrypt (.NET)

SQL CE database querying

PowerShell + SqlServerCe.dll

Password cracking

john --format=hmailserver + rockyou.txt

WinRM shell

evil-winrm

Privilege escalation

CVE-2023-27532 (VeeamHax.exe)

Last updated