Skip to main content

Enumeration

Run Nmap Scan

Update Hostname

View Website

Untitled

Directory Bruteforcing (Run Gobuster)

Enumerating Subdomain Information

Subdomain Bruteforcing (Failed)

No subdomain is found through bruteforcing

Inspecting Website Code

Untitled Opening network tab, we can find 2 .js files. We are going to inspect the app file, so we can get any additional information.
Download the file and install the file extension for vscode to format the minified js code
Below is the extracted information we found from the js code. We found the link http://api-prod.horizontall.htb/reviews that we can enumerate.

Update Hostname

api-prod.horizontall.htb was included in the hostname

api-prod website directory bruteforcing (Run Gobuster)

Exploitation

Strapi Enumeration

Untitled If we route to /admin , we get this login page. Strapi - Open source Node.js Headless CMS 🚀 It’s a CMS application built in node js.

Finding Exploit

If strapi version is either 17.4 or 17.7, we could exploit this vulnerability.

Finding version no.

Untitled I was searching either 17.4 or 17.7 as those had the vulnerability I could exploit. Here the version is beta.17.4

Using CVE-2019-19609

Exploit

Using Python Reverse Shell (Failed)

First I’m going to check if the target system has python installed
Generate Python Reverse Shell Online - Reverse Shell Generator
Unfortunately the Reverse Shell didn’t work.

Using Telnet Reverse Shell

Privilege Escalation

Finding Credentials from MySQL Configuration File (Failed)

After enumerating the filesystem, I found the credentials from the configuration file.
Unfortunately, the credential didn’t work to escalate the privilege to developer.

Enumerating Network Information

We know 22,80 is the port that we already scanned and port 1337 is the port for the strapi application. But we haven’t enumerated port 8000. However, looking at the ip address, it’s hosted in localhost. So we need to forward the port.

Port Forwarding using SSH

Checking SSH config in the target system

The key file should be in .ssh/authorized_keys path. Meaning in ~/.ssh/authorized_keys path.

Generating SSH Key

Generate the SSH key from our PC and host the generated id_ed25519.pub file (SSH public key).

Download the public key inside the Specified PATH

Port Forward 8000 to Our System.

Enumerating Localhost:8000

Untitled It is a the default laravel (web application) server hosted.

localhost:8000 directory bruteforcing (Run Gobuster)

SSH Port forwarding to port 8000 fails during the gobuster scan to localhost:8000, which results in fail in transmitting packet.
I got a hint from 0xdf-Horizontall for which web directory list file to use.

Exploiting the Vulnerability

Untitled Going to /profiles , here we can see an error occured and know this is a debug menu. Finding Laravel debug mode exploit in google, I found an interesting website. Laravel up to v8.4.2 debug mode: Remote code execution It requires version less than 8.4.2 which can be used to exploit our target system as the target system is using Laravel v8. (Look closely in the Laravel default website)

Generating a Reverse Shell

Online - Reverse Shell Generator
I’m going to use a python reverse shell, since I know python3.6.9 is installed. Download the reverse shell inside the /tmp folder using wget and give execution permission using chmod +x reverse.sh

Using CVE-2021-3129

https://github.com/nth347/CVE-2021-3129_exploit Execute the exploit in our machine, but don’t forget to maintain the SSH Port Forwarding connection.

Listen to Reverse Shell and Exploit

References