Sau

hackthebox.com - Β© HACKTHEBOX

Intro

Box Info

πŸ”— Name

🎯 Target IP

10.10.11.224

πŸ“ˆ Difficulty level

🟩Easy

🐧OS

Linux


Recon

Start Reconnaissance

Browse to http://10.10.11.224:55555/

  • Powered by request-basketsarrow-up-right - version: 1.2.1 - a web service used to colect arbitrary HTTP requests and inspect them via RESTful API or simple web UI


Exploitation

SSRF - Request-baskets

The request-baskets project has been associated with a Server-Side Request Forgery (SSRF) vulnerability, specifically identified as CVE-2023-27163arrow-up-right.

  • This vulnerability affects request-baskets up to version 1.2.1 and allows attackers to forward HTTP requests to internal or private services.

  • The vulnerability is present in the /api/baskets/{name} component, which can be exploited to access network resources and sensitive information.

  • Information Disclosure: The SSRF lets attackers retrieve any internal resource over HTTP, enabling exfiltration of sensitive data beyond just unauthenticated images.

  • Unauthenticated Internal Access: Exploitation grants access to internal services like Nginx, APIs, and databases across the local network without credentials.

  • Port Scanning and Enumeration: Attackers can scan ports and map internal hosts, exposing network architecture and potential attack surfaces.

An exploit for this vulnerability has been published, demonstrating how attackers can leverage the SSRF flaw to create a local proxy for HTTP requests on the targeted machine.

Let's try the following PoC by entr0pie:

Visit the generated URL -> http://10.10.11.224:55555/izlhms

  • The webserver on port 80 is powered by Maltrail v0.53

  • Same on port 8338


Foothold

RCE - Maltrail

Maltrail v0.53 is associated with the CVE-2023-27163arrow-up-right vulnerability, which is a remote code execution (RCE) flaw.

  • Use the generated URL in the following Maltrail Exploit -> http://10.10.11.224:55555/oxmauw

  • The exploit encodes a reverse shell payload in Base64 to bypass potential WAF, IPS/IDS protections, delivers it via a curl request to the target URL and executes it to establish a reverse shell back to the attacker's IP and port.

  • In this specific case, remove the + "/login" on line 28 of the exploit.py, save and run the modified script

  • Shell upgrade

Shell as user puma


Privilege Escalation

Systemd CVE-2023-26604

  • puma user can run a specific systemctl command as root without password

Google Systemd 245.4 CVE

Shell as root

Run the following command with puma user and exploit less

  • Since the weird TTY and screen, the output gets passed to less

  • Enter !sh that will run sh and drops to a shell with the root user


Summary

  1. Target runs Request Baskets.

  2. CVE-2023-27163 SSRF vulnerability present.

  3. Malicious basket created to proxy internal requests.

  4. Internal Maltrail service discovered via SSRF.

  5. Maltrail has unauthenticated OS command injection.

  6. Exploited injection to get reverse shell as puma.

  7. Enumerated sudo permissions.

  8. Found systemd less pager vulnerability (CVE-2023-26604).

  9. Abused less to execute commands as root.


Extra


Last updated