~$ cd ~

HTB: MonitorsThree

Shell as www-data

We have port 22 and 80 open

Webpage

Forgot password page, if we enter something random we get unable to process. If we enter admin we get success. SO we have username enumeration

Screenshot 1 Screenshot 2

This page also has a sql injection vulnerability. We can confirm this by entering a single ' and we get a sql error(I cant get the error to come up again but it was there the first time I tried it)

Screenshot 3

Copy the request to a file and send it to sql map

POST /forgot_password.php HTTP/1.1
Host: monitorsthree.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
Origin: http://monitorsthree.htb
Connection: keep-alive
Referer: http://monitorsthree.htb/forgot_password.php
Cookie: PHPSESSID=cont06q4tpjc9u1f3phjq7oata
Upgrade-Insecure-Requests: 1
Priority: u=0, i

username=*

sqlmap -r req.txt --batch --dump -T users

The hash is a little broken as I stopped and restarted it half way through.

Screenshot 4

Full hash - 31a181c8372e3afc59dab863430610e8

Screenshot 5

Admin:greencacti2001

I missed a subdomain at the start because we had to use autofiltering or filter by something other than size as this domain shows up with 0 size.

ffuf -u http://10.10.11.30 -H "Host:FUZZ.monitorsthree.htb" -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-20000.txt -ac
Screenshot 6

On this page we can login, also note the version at the bottom 1.2.26

Screenshot 7

Shell using meterpreter

Screenshot 8

Shell as Marcus

After running linpeas we see the database username and pass

$database_username = 'cactiuser';
$database_password = 'cactiuser';

We can get the hash for marcus and crack it

Screenshot 9 Screenshot 10

Then we switch user to marcus and get user flag

Screenshot 11

marcus:12345678910

We can also grab the id_rsa key for marcus so we have ssh access.

Root

This docker compose file shows something running on port 8200, we can forward it to our machine

ssh -L 8200:localhost:8200 [email protected] -i id_rsa
Screenshot 12

We have a Duplicati login page

Screenshot 13

We have a login bypass for Duplicati, this article walks us through it.

https://read.martiandefense.llc/duplicati-bypassing-login-authentication-with-server-passphrase-024d6991e9ee

First we need to recover the server-passphrase for duplicati which we find here

Screenshot 14

Copy the database files locally

sqlite3 Duplicati-server.sqlite
Screenshot 15

-2||server-passphrase|Wb6e855L3sN9LTaCuwPXuautswTIQbekmMAr7BrK2Ho=
-2||server-passphrase-salt|xTfykWV1dATpFZvPhClEJLJzYA5A4L74hX7FK8XmY0I=
 

Next step is to base64 decode the passphrase and turn it into hex which we can do with cyberchef

Screenshot 16

hex - 59be9ef39e4bdec37d2d3682bb03d7b9abadb304c841b7a498c02bec1acad87a


Next we need to get the nonce so we will login and capture the request then we need to select “Do intercept response to this request”

Screenshot 17

The response will have the nonce that we need

Screenshot 18

Then following the guide again we can get teh nonced pwd with the javascript code below

Screenshot 19

With the password we forward the burp request one more time and it will prompt us for a password, we change the password to the noncedpwd output above and urlencode it. Then once we forward it for the last time we will get a login

Screenshot 20

And we are presented with the duplicati landing page

Screenshot 21

Exploit duplicati to get root flag

Add new backup > Configure a new backup

No encrpytion and give it any name

Screenshot 22

Select a destination and we need to make sure we select the folder under “source” in order for it to show up on the machine(took me a while to realize there are multiple folders and the source folders are on the actual machine itself)

Screenshot 23

Then select the source data

Screenshot 24

When we run the first time we will get an error and have to repair it

Screenshot 25

After we click repair and run again we will get the flag

Screenshot 26 Screenshot 27