HackTheBox - Mango

Nmap scan results

We have two webservers, one running with HTTP and other with HTTPS (Secure). Let's add staging-order.mango.htb to /etc/hosts file. There are two different websites running on staging-order.mango.htb. One on HTTP Protocol and other on HTTPS.


I tried for SQL Injection on Mango Search Page but didn't get anything. Let's scan the website with gobuster for files and directories.
Scanning with gobuster

The login page for insecure i.e HTTP website looks suspicious. Let's try SQL Injection on that.
Trying SQL Injection on login page

I tried all possible SQL Injection payloads but that didn't gave me anything. Also tried sqlmap tool to automate the process but no luck :((
Performing NoSQL Injection on login page
We can also try for NoSQL Injection as the name of the box is similar to Mongo which is a NoSQL database (Uses Key-Value pair to store the values)

And now if you will check the response, it will be a redirect to home.php page.


Extracting usernames and passwords
But that doesn't give us anything. We can also enumerate the data and users using the same method. I have created a script to get all the users and their passwords.

Similarly we can also enumerate the user and get password for that user as well.
Using SSH to get access as mango user


Privilege Escalation using jjs (Java JavaScript)


Now we can edit the /etc/passwd file and change the root password. - This is one way
Another way is to copy the bash file to tmp directory and then changing its permission to 4555 (Setuid permissions)

Last updated
Was this helpful?