Let’s start by scanning the machine to find out which ports are open. We will use Nmap for this.
We can see that there are several ports open, but let’s focus on port 80 http for now. Don’t forget to add <ip> mailing.htb to /etc/hosts file.
There is an installation functionality which will download an instruction file. This maybe vulnerable to LFIs, so I run dirsearch to find any hidden directories.
The download.php as pinpointed in POC section, is vulnerable to LFI (Local File Inclusion). We can use this to read files on the server. For the hMailServer.ini file, we can use the following URL to read it:
There are two passwords in the hMailServer.ini file. The AdministratorPassword and database password. The first one can be cracked easily just by using CrackStation or hashcat.
I tried telnet with several ports, but none of them brought back any valuable information.
And because this is a mail service, so why don’t we send a phishing email? Then I found this exploitation script where you can send a malicious email to the victim. And with Reponder, we can capture the NTLM hash.
And the script will be like this:
For the url parameter, if the one above does not work, you can try customize it to your own. And the --subject can be anything you want.
Because I changed my openvpn so the IP address is different between the script and the Responder, but you get the idea.
Now we can crack the NTLM hash using hashcat, and because the hash is in NetNTLMv2 format, we can use the following command:
With this password, we can now login to maya:m4y4ngs4ri and get the user flag.
Privilege Escalation
Enumeration
I checked the Applications that available on the machine, and found that LibreOffice is installed. This is interesting cause I think Windows users don’t usually use this application.
So I did some research and found that there is a CVE for LibreOffice which allows Improper access control in editor components of The Document Foundation LibreOffice allowed an attacker to craft a document that would cause external links to be loaded without prompt. In the affected versions of LibreOffice documents that used "floating frames" linked to external files, would load the contents of those frames without prompting the user for permission to do so. This was inconsistent with the treatment of other linked content in LibreOffice.
But where should we put the malicious file? I found that there is an Important Documents folder in the same level withProgram Files and Program Files (x86).
Exploitation
I will use this exploit to exploit the machine. Here is a step-by-step guide to deliver the file to the victim:
Now we have the exploit file and the SMB server running, we can now deliver the file to the victim. From evil-winrm:
You can check the role of the user maya by running net user maya.
And now the user maya is a member of the Administradores group. You are eligible to get the root flag.