[KVE-2026-1806] 콘텐츠 include 경로 및 미완료주문 출력 처리 보강

콘텐츠 상단/하단 파일 경로를 저장 전에 먼저 정규화한 뒤 확장자와 위치를
검증하도록 순서를 조정한다. 정규화 과정에서 확장자가 사라져 검증을
우회하던 경로를 차단한다. 실행 직전 bbs/content.php 에서도 승인 확장자와
data 디렉터리 귀결 여부를 다시 확인하는 is_content_include_allowed() 를
적용하고, 콘텐츠 상단/하단 이미지 업로드는 이미지 파일만 허용하도록 검사한다.

미완료주문 상세의 결제방법 출력에 get_text() 인코딩을 적용하고, 임시주문
저장 시 정제한 결제수단 값을 원본에도 반영한다. 개인결제 주문 세션은
결제정보 검증을 통과한 뒤에만 설정한다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 196255d76912531d7e13861821bd59ca15c967d1)
This commit is contained in:
thisgun
2026-08-24 07:44:22 +00:00
parent 35acbfa750
commit 6571119db6
6 changed files with 65 additions and 10 deletions
+27
View File
@@ -4853,6 +4853,33 @@ function filter_input_include_path($path){
return str_replace('//', '/', strip_tags($path));
}
// 콘텐츠 상단/하단 include 대상이 템플릿 파일인지 실행 직전 재확인한다.
// 승인 확장자만 허용하고, 업로드가 저장되는 data 디렉터리로 귀결되는 경로는 거부한다.
function is_content_include_allowed($path){
if( !is_string($path) || $path === '' ){
return false;
}
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if( !in_array($ext, array('php', 'htm', 'html')) ){
return false;
}
$real = @realpath($path);
if( $real !== false && defined('G5_DATA_PATH') ){
$data_real = @realpath(G5_DATA_PATH);
if( $data_real !== false ){
$real_norm = str_replace('\\', '/', $real);
$data_norm = rtrim(str_replace('\\', '/', $data_real), '/').'/';
if( strpos($real_norm, $data_norm) === 0 ){
return false;
}
}
}
return true;
}
function option_array_checked($option, $arr=array()){
$checked = '';