80

We get a login page on the subdomain. I tried my luck and got access to the administrator account abusing SQL injection for the username input - admin' OR '1'='1' — -

Its an RMS (Recruitment Management System). We find a user

This looks like a very simple website.

Turns out, its an actual software and not a custom made by HTB. And there is a CVE for this SQLi vulnerability - CVE-2022-28468.

We can also make modifications to the admin account.

It is prefilled and we can read the password. SuperGucciRainbowCake

Going back to the login page again, we know there is an SQLi vulnerability. Can we further use it to read enumerate the database?

First of all, we do get back results based on our queries. If the query returns True, we get 1. Otherwise we get 3. This is a boolean-based blind SQLi. We can use that to read enumerate the database.

I saved the request in a file:

Using SQLmap

Current User Information

Tables

Dumping data

Reading local files

We can confirm that file read is enabled. Trying to read the /etc/passwd file to find usernames and if they run a shell.

I had to specify --tehcnique= properly otherwise it doesn't work

We know that this box is running NGINX so lets try to read the configuration files, specifically the sites_enabled file to see if we can find other vhosts. The location is /etc/nginx/sites-enabled/default.

We find another subdomain preprod-marketing.trick.htb. And the fastcgi_pass here is different. We do see the name Michael so maybe it runs under the user Michael we saw before? I put that into my /etc/hosts.

i visited the site, nothing interesting there. So reading the index.php file like before:

We see that it id vulnerable to Path Traversal. It takes whatever file name we give it as the path and outputs it but it filters and removes ../ but it still is vulnerable as it only removes it once and it is non-recursive. Meaning, if we input ....// it will remove the ../ but it still leaves another ../.

We know ssh port 22 is open, and we got the username michael, enough to prepare a payload to read the private key and use that to get foothold.

Last updated