Page cover

Trickster

Synopsis

Trickster is a medium linux machine created by EmSecarrow-up-right. The subdomin shop.trickster.htb uses PrestaShop version 8.1.5 which is vulnerable to CVE-2024-34716 XSS vulnerability which gives us the shell as www-data. The mysql database contains the james hash which is crackable. The docker container is running and port 5000 of docker container is running the changedetection.io version 0.45.20 which is vulnerable to CVE-2024-32651 SSTI vulnerability which allows the RCE. The docker container contains the Backups directory with .br file which contains the adam's credentials. The adam is allowed to execute prusaslicer which is vulnerable to CVE-2023-47268 arbitrary code execution vulnerability which gives us shell as root.

OS
Difficulty
Points
Release Date
Retired Date

Linux

Medium

30

21-09-2024

01-02-2025


Enumeration

Nmap

Started the nmap scan and found ssh and http services running.

nmap -p- -Pn -sC -sV --min-rate=1000 10.10.11.34
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-01-30 19:17 EST
Warning: 10.10.11.34 giving up on port because retransmission cap hit (10).
Nmap scan report for 10.10.11.34
Host is up (0.55s latency).
Not shown: 64272 closed tcp ports (conn-refused), 1261 filtered tcp ports (no-response)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   256 8c:01:0e:7b:b4:da:b7:2f:bb:2f:d3:a3:8c:a6:6d:87 (ECDSA)
|_  256 90:c6:f3:d8:3f:96:99:94:69:fe:d3:72:cb:fe:6c:c5 (ED25519)
80/tcp open  http    Apache httpd 2.4.52
|_http-title: Did not follow redirect to http://trickster.htb/
|_http-server-header: Apache/2.4.52 (Ubuntu)
Service Info: Host: _; OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 199.07 seconds

Add the trickster.htb domain in /etc/hosts file.

Web - trickster.htb

The trickster is a online shopping platform where we can shop to all our shopping needs.

VIsiting the contact and shop endpoints, the contact form and shop.trickster.htb subdomain is found.

Add the shop.trickster.htb in /etc/hosts file.

Web - shop.trickster.htb

The subdomain has listed some of the products and we can buy it or add to cart.

The website is made using the prestashop. The prestashop is a open-source software platform to build the e-commerce websites.

Directory enumeration using fuff reveals the .git directory.

Using gitdumper to dump the content in .git directory.

Listing the contents in .git directory reveals the prestashop admin panel path.

The 8.1.5 version of prestashop is vulnerable to XSS via customer contact, the details about the vulnerability is released by prestashop in their github repositoryarrow-up-right.


Foothold

Shell - www-data [ CVE-2024-34716 Exploit ]

The aelmokhtar has published the script in github repositoryarrow-up-right for exploiting the vulnerability. Git clone the repository.

Change directory to CVE-2024-34716 and run the exploit.py.


Lateral Movement

Pillaging - www-data [ user ]

The prestashop config file parameters.php gives us the credentials for mysql database.

Shell - james

Upgrading the shell and using the credentials to login into mysql.

Enumerating the database gives us the james hash which we can use it into ssh.

Cracked the james hash using hashcat.

circle-info

The user.txt file contains the user flag 👏


Pivoting

Pillaging - james [ user ]

The ps aux reveals that the root is running Docker container and changedetection.py in /datastore directory.

The ip addr reveals the Docker container network interface configuration and its IP address.

The ping sweep is used to find the active and listening ip addresses in docker container. The two ip addresses are active and listening 172.17.0.1 and 172.17.0.2

The port scan finds the 5000 port open.

Pillaging - Port 5000

Curling the 5000 port the changedetection version 0.45.20 service is running in the website.

Port forward the 5000 port via ssh.

The Login page of changedetection.io is presented with password field.

Using the password of james will give us access to the changedetection.

Shell - Docker Container [ root - CVE-2024-32651 changedetection SSTI ]

The changedetection is the open source web page change detection, website watcher, restock monitor and notification service. The source code and documentation is found in this github repositoryarrow-up-right. The changedetection version <= 0.45.20 is vulnerable to CVE-2024-32651 Server Side Template Injection in Jinja2 which allows the RCE. More details and PoC is found herearrow-up-right.

Following the above PoC with below given payloads gives us the shell of root in Docker Container.

Settings > Notification > Insert your payload > click on Send test notification

circle-info

Don't press the OK in alert it will end the shell.

Pillaging - root [ user - Docker Container ]

Enumerating the /datastore directory, found the Backup directory which contains the zip files.

The nc and unzip is not present in the system.

Shell - adam

I will be using tar to compress the Backups directory and use base64 to convert it into base64.

Copy the outputted base64 text and save it into the file in your local machine. Then decompile the base64 and decompress it using tar.

Change directory into Backups directory and unzipping the first file contains the .br file.

The brotli command is used to decompress the .br file. If not present in your system apt install to get it.

Use the credentials to ssh into the system as adam.


Privilege Escalation

Pillaging - adam [ user ]

The user is allowed to run prusaslicer as a sudo without any password.

The /opt/PrusaSlicer contains the two files, one is prusaslicer binary and another is TRICKSTER.3mf

PrusaSlicer is a popular 3D slicing software designed for FFF (Fused Filament Fabrication) and mSLA (mask Stereolithography) 3D printers. The prusaslicer is vulnerable to CVE-2023–47268 arbitrary code execution through 3mf files. The exploitdb has a PoCarrow-up-right for this vulnerability.

Shell - root [ CVE-2023-47268 Exploit ]

1

Move the TRICKSTER.3mf file into your local system because the file belongs to root and we cannot edit it.

2

Extract the file Metadata/Slic3r_PE.config

3

Modify the extracted file for getting shell as root and compress it.

4

Upload the modified TRICKSTER.3mf and execute it with outfile name otherwise it will give the error.

5

Checking whether the /bin/bash has SUID added or not and execute it to get root shell.

circle-info

Change directory to /root, the root.txt file contains the root flag 🎉


Proof of Concept

The below video provides the PoC of Trickster machine.

Last updated