Bizness HTB

IP

10.129.177.4

initial nmap scan

sudo nmap -p- --min-rate 10000 10.129.177.4 | cut -d"/" -f1 | tr '\n' ','

results

22,80,443,42275

Lets run a more in-depth scan of the target

sudo nmap -sCV -p22,80,443,42275 -oA tcp_ports 10.129.177.4

results

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-server-header: nginx/1.18.0
|_http-title: Did not follow redirect to https://bizness.htb/
443/tcp   open  ssl/http   nginx 1.18.0
|_http-title: Did not follow redirect to https://bizness.htb/
|_ssl-date: TLS randomness does not represent time
|_http-server-header: nginx/1.18.0
| 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-nextprotoneg: 
|_  http/1.1
| tls-alpn: 
|_  http/1.1
42275/tcp open  tcpwrapped
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Looks like we have

For good measures we will also run a UDP nmap scan

results

After we have adit our hosts file lets check out the HTTP site

we can see the following

if we scroll to the bottom of the web page we can see the following

what is Apache OFBiz?

  • is an open-source enterprise resource planning system

is it vulnerable?

  • Possibly as we dont have the version number, we can make an educated guess, this box was created this year (2023) and there is a vulnerable version of this software that was found in 2023, what we can do is utilize the following scanner and check if it is indeed vulnerable to the CVE-2023-51467

Tool

After we have cloned the tool lets install the requirements.txt

Now lets run the scanner

And the scanner says our target is vulnerable

Now what is CVE-2023-51467?

  • this security flaw enables attackers to bypass authentication authentication, leading to SSRF (Sever Side Request Forgery) exploit. When sending a web request to the specific path /webtools/control/ping?USERNAME&PASSWORD=test&requirePasswordChange=Y

we can confirm this by navigating to to the specified url

we can use the following script to gain a shell on the target

Okay so the plan is

  1. we want to copy nc into our directory where we will host a python3 server so

  1. Lets start the python server

  1. Lets run the exploit script and specify to use wget and install nc on the system

  1. Now we want to start a nc listener to catch the reverse-shell

  1. Now we want to execute nc on the target to establish a reverse-shell back to our local machine

we now have a shell on the system

Lets upgrade our shell

Lets get some persistence on the machine

  1. Lets create the .ssh/authorized_keys file and directory in the user ofbiz home directory

  1. Now that we have /.ssh/authorized_keys Lets create our pivate and public key pair using ssh-keygen on our local machine

  1. we should now have our id_rsa and id_rsa.pub we want to copy and paste our public key over to the machine

  1. give the appropriate permissions to our private key

  1. Now we should be able to login via ssh and our private key

  • this should make it abit easier to enumerate the system

lets check for SUID files

  • nothing interesting

any internal ports listening

  • nothing interesting

Lets save some time and download and run linpeas.sh and see if we can automate some of this

for good measure lets run it again but place the output to the file linpease.txt (i know i miss spelled it but didnt want to wait for it to execute again 😂)

target machine

local machine, we will use scp

  • this way we can still have the highlights, rather then copy and paste it onto our local machine

Couldnt find anything within linpeas except for what i believe to be a rabbit hole

Lets search for file types and see if we can find anything

  • we did find something interesting while searching for xml files

looking through the file we do find a hash

  • unable to crack it back to the drawing board

looking back in the linpeas output we can see the presence of derby

What is derby?

  • also known as Apache Derby, is an open-source database management system (RDBMS) that is implemented in Java

Why is this interesting?

  • we could possibly be able to enumerate sensitive information from the .dat files within the derby directory, keep in mind these data files, so to find anything interesting we would need to use a tool like strings to find anything interesting

Lets search for .dat files

we can see majority of the .dat file are coing from the /opt/ofbiz/runtime/data/derby/ofbiztenant/seg0/ directory

Lets copy all these files into a single .txt file and copy it to our local host

target machine

local machine

Now that we have a copy of the .dat files on our local host lets see if we can find anything interesting with strings

after a couple of attempts we can find a SHA-encrypted password for Admin

Lets see if we can crack it

  • no luck, but this has to be the admins password right?

after abit of googling I found the ofbiz GitHub repo where we can actually see HashCrypt.java functions

from this we can write a python script to encrypt each line in rockyou.txt and compare it to our hash

this will identify the password and from here we can

and we are root

Last updated