security: KVE-2026-2329 XHTML 등 실행형 첨부를 저장 전에 차단
게시판·1:1문의·폼메일·쇼핑몰 로고의 PHP 업로드 검사에서 위험 확장자를 거부한다. 대소문자와 다중 확장자 등 파일명 변형을 검사하고 클라이언트 검사도 일치시킨다. 검증: 위험 파일 및 정상 이미지·문서 파일명 격리 검증, 저장 전 차단 검증, PHP·JavaScript 문법 검사 통과.
This commit is contained in:
1 parent
65875b7f35
commit
873839add7
6 files changed
+33
-13
No files matched your search
+12
-1
@@ -4236,7 +4236,18 @@ function get_safe_filename($name)
|
||||
return $name;
|
||||
}
|
||||
|
||||
// 업로드 파일명이 SVG 또는 SVGZ 확장자인지 확인
|
||||
// 브라우저에서 실행될 수 있는 첨부 확장자를 저장 전에 거부한다.
|
||||
function is_disallowed_active_filename($filename)
|
||||
{
|
||||
if (!is_string($filename)) return true;
|
||||
if (preg_match('/[\x00-\x1f\x7f]/', $filename)) return true;
|
||||
$filename = basename(str_replace('\\', '/', $filename));
|
||||
$filename = rtrim($filename, ' .');
|
||||
// 다중 확장자 및 Windows 대체 데이터 스트림 표기도 차단한다.
|
||||
return (bool) preg_match('/\.(?:svgz?|xhtml|xht|xml|xsl|xslt|mht|mhtml|htc)(?:[. :]|$)/i', $filename);
|
||||
}
|
||||
|
||||
// 기존 스킨 및 플러그인과의 호환을 위한 SVG 검사 함수
|
||||
function is_disallowed_svg_filename($filename)
|
||||
{
|
||||
if (!is_string($filename) || $filename === '') {
|
||||
|
||||
Reference in new issue
Block a user