root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat permx.md
// writeups

PermX

6 Jul 2024 · 10 min read · root access
PermX - maquina de Hack The Box

Executive summary — PermX chains an unauthenticated file upload in Chamilo LMS (CVE-2023-4220) with a credential reuse between the application's database and a system account, ending in a symlink abuse of a sudo script wrapping setfacl — the script's path validation trusts that -f means "it's a file", but that's also true for a symlink pointing outside the allowed directory.

PlatformHack The Box
Operating systemLinux
DifficultyEasy
StatusRetired
Target IP10.129.39.120

Attack map

[80] permx.htb — static "eLEARNING" template, no backend
   │  vhost lms.permx.htb -> Chamilo LMS 1.11.24
   ▼
[80] lms.permx.htb — Chamilo LMS
   │  CVE-2023-4220 — unauthenticated file upload (bigUpload.php)
   ▼
[RCE]  www-data
   │  configuration.php leaks DB credentials, reused as the SSH
   │  password for the system user mtz
   ▼
[SSH]  mtz  (user.txt)
   │  sudo NOPASSWD /opt/acl.sh -> setfacl follows symlinks,
   │  the script only validates the path prefix (not the real type)
   ▼
[ROOT]  symlink to /etc/shadow + setfacl -> overwrite root's hash

1. Reconnaissance

nmap -p- --min-rate 5000 -T4 -oN nmap_all_ports.txt 10.129.39.120

Only two open ports:

nmap -p22,80 -sC -sV -oN nmap_sc.txt 10.129.39.120
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    Apache httpd 2.4.52
|_http-title: Did not follow redirect to http://permx.htb
echo "10.129.39.120 permx.htb" | sudo tee -a /etc/hosts

permx.htb turns out to be a static template for an "eLEARNING" company (Bootstrap, no real backend). A page like that makes it worth suspecting a subdomain tied to the business theme. A blind gobuster vhost produced a long list of false positives: the server answers with a generic 302 to permx.htb for any unconfigured vhost, and the tool didn't filter by response size. That output was discarded and manually verified against a random control vhost instead:

curl -s -o /dev/null -w "%{http_code} %{size_download}\n" -H "Host: lms.permx.htb" http://permx.htb/
# 200 19347   (vs 302 292 for a random, non-existent vhost)
echo "10.129.39.120 lms.permx.htb" >> /etc/hosts
curl -s -i http://lms.permx.htb/ | grep -iE "powered-by|generator"
X-Powered-By: Chamilo 1
<meta name="generator" content="Chamilo 1">
🔒 Clearance required

This content is Root Access only. Everything else on the site — the free tier, the whole public library — stays open.

See Root Access plans

No account? Create one free then upgrade from your console.