Sau is an Easy Difficulty Linux machine that features a Request Baskets instance that is vulnerable to Server-Side Request Forgery (SSRF) via [CVE-2023-27163](https://nvd.nist.gov/vuln/detail/CVE-2023-27163). Leveraging the vulnerability we are to gain access to a Maltrail instance that is vulnerable to Unauthenticated OS Command Injection, which allows us to gain a reverse shell on the machine as puma. A sudo misconfiguration is then exploited to gain a root shell.
Area of Interest
Web Application Injections
Technology
Request Baskets Maltrail
Vulnerabilities
OS Command Injection Server Side Request Forgery (SSRF)
Security Tools
Netcat Nmap
Languages
Bash
Techniques
Reconnaissance SUDO Exploitation
CVE
CVE-2023-26604 CVE-2023-27163
Task 0 - Deploy machine
🎯 Target IP: 10.129.229.26
Create a directory on the Desktop with the machine's name, and inside this directory, create another directory to store the materials and outputs needed to run the machine, including the scans made with nmap.
Task 1 - Reconnaissance
suecho"10.129.229.26 sau.htb">>/etc/hostsmkdir-phtb/sau.htbcdhtb/sau.htbmkdir{nmap,content,exploits,scripts}# At the end of the room# To clean up the last line from the /etc/hosts filesed-i'$ d'/etc/hosts
I prefer to start recon by pinging the target, this allows us to check connectivity and get OS info.
Sending these three ICMP packets, we see that the Time To Live (TTL) is ~64 secs. this indicates that the target should be a *nix system, while Windows systems usually have a TTL of 128 secs.
1.1 - Which is the highest open TCP port on the target machine?
Strangely enough, port 80 is filtered, but there seems to be some relationship with the service active on port 55555, let's go and see.
Browsing it: http://sau.htb:55555/web we see that there's up a web app to create a basket to collect and inspect HTTP requests. using request-baskets app vs 1.2.1.
and now we can concatenate basket value to our URL and finally reach filtered port 80: http://sau.htb:55555/hbvoml
maltrail
2.2 - There is an unauthenticated command injection vulnerability in MailTrail v0.53. What is the relative path targeted by this exploit?
Googling 'MailTrail v0.53' we discover that's vulnerable to an unauthenticated OS Command Injection (RCE)
the username parameter of the login page doesn't properly sanitize the input, allowing an attacker to inject OS commands.
The exploit creates a reverse shell payload encoded in Base64 to bypass potential protections like WAF, IPS or IDS and delivers it to the target URL using a curl command The payload is then executed on the target system, establishing a reverse shell connection back to the attacker's specified IP and port.