webfreemedium

Conversor (Full Box)

hackthebox

Task: Full HackTheBox machine with an XML-to-HTML converter web app and Linux privilege escalation. Solution: Exploited XSLT injection via exsl:document to write a Python reverse shell through a cron job for user access, then used CVE-2024-48990 needrestart PYTHONPATH injection for root.

$ ls tags/ techniques/
hash_crackingdatabase_extractionxslt_file_writecron_job_abuseshared_library_injectionconstructor_hijacking

$ cat /etc/rate-limit

Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.

Conversor — HackTheBox (Full Box)

Challenge Info

FieldValue
PlatformHackTheBox
Target10.129.1.165
CategoryWeb / Linux Privilege Escalation
DifficultyMedium
User Flagaeff561c839d56cfced2c19e6ec562eb
Root Flag4f83b59aad1bc7ababce8678ff0feaed

Overview

This is a complete HackTheBox machine involving:

  1. User Flag: XSLT Injection → Cron Job RCE → Credential Theft → SSH Access
  2. Root Flag: CVE-2024-48990 needrestart PYTHONPATH Injection → Local Privilege Escalation

PART 1: User Flag

Reconnaissance

Port Scanning

nmap -sV -sC 10.129.1.165

Results:

PortServiceVersion
22SSHOpenSSH 8.9p1
53DNS-
80HTTPApache 2.4.52

The HTTP service redirects to conversor.htb - added to /etc/hosts:

echo "10.129.1.165 conversor.htb" | sudo tee -a /etc/hosts

Web Application Analysis

Initial Exploration

The website is an XML to HTML converter using XSLT transformation:

  1. User registers an account
  2. User uploads XML file
  3. User uploads XSLT stylesheet
  4. Server transforms XML using XSLT
  5. Returns HTML result

Source Code Discovery

On the /about page, found a download link:

/static/source_code.tar.gz
curl -O http://conversor.htb/static/source_code.tar.gz tar -xzf source_code.tar.gz

Source Code Analysis

Key File: app.py

from lxml import etree # XML Parser - SECURE configuration (XXE blocked) parser = etree.XMLParser( resolve_entities=False, # No XXE no_network=True, # No external requests dtd_validation=False, load_dtd=False ) xml_tree = etree.parse(xml_path, parser) # XSLT Parser - INSECURE configuration (no restrictions!) xslt_tree = etree.parse(xslt_path) # Default parser = vulnerable! transform = etree.XSLT(xslt_tree)

...

$ grep --similar

Similar writeups