Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
KVE-2018-366, 379, 397 취약점 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Jun 5, 2018
1 parent 3f44d16 commit fdfb83a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions adm/board_form_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
if ($file = $_POST['bo_include_head']) {
$file_ext = pathinfo($file, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file) ) {
alert('상단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
$_POST['bo_include_head'] = $file;
}

if ($file = $_POST['bo_include_tail']) {
$file_ext = pathinfo($file, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file) ) {
alert('하단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
$_POST['bo_include_tail'] = $file;
}
Expand Down
8 changes: 4 additions & 4 deletions adm/contentformupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@

$file_ext = pathinfo($co_include_head, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $co_include_head) ) {
alert('상단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
}

if( $co_include_tail ){

$file_ext = pathinfo($co_include_tail, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $co_include_tail) ) {
alert('하단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
}

Expand Down
8 changes: 4 additions & 4 deletions adm/qa_config_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
if( $qa_include_head ){
$file_ext = pathinfo($qa_include_head, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $qa_include_head) ) {
alert('상단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
}

if( $qa_include_tail ){
$file_ext = pathinfo($qa_include_tail, PATHINFO_EXTENSION);

if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) ) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $qa_include_tail) ) {
alert('하단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
}
}

Expand Down
2 changes: 2 additions & 0 deletions adm/sms_admin/form_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

if ($page < 1) $page = 1;

$fg_no = isset($fg_no) ? (int) $fg_no : '';

if (is_numeric($fg_no))
$sql_group = " and fg_no='$fg_no' ";
else
Expand Down
1 change: 1 addition & 0 deletions adm/sms_admin/num_book.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
if ($page < 1) $page = 1;

$bg_no = isset($bg_no) ? (int) $bg_no : 0;
$st = isset($st) ? preg_replace('/[^a-z0-9]/i', '', $st) : '';

if (is_numeric($bg_no))
$sql_group = " and bg_no='$bg_no' ";
Expand Down
2 changes: 1 addition & 1 deletion lib/common.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3493,7 +3493,7 @@ function is_include_path_check($path='', $is_input='')
return false;
}

if( preg_match('/\/data\/(file|editor)\/[A-Za-z0-9_]{1,20}\//', $path) ){
if( preg_match('/\/data\/(file|editor|qa|cache|member|member_image|session|tmp)\/[A-Za-z0-9_]{1,20}\//i', $path) ){
return false;
}
}
Expand Down

0 comments on commit fdfb83a

Please sign in to comment.