[KVE-2019-0335, 0344 다중 취약점] 수정

This commit is contained in:
thisgun
2019-03-06 18:00:32 +09:00
parent 2c61975b49
commit 4227356108
9 changed files with 48 additions and 14 deletions

View File

@ -9,7 +9,10 @@ auth_check($auth[$sub_menu], 'w');
check_admin_token();
if (!$_POST['gr_id']) { alert('그룹 ID는 반드시 선택하세요.'); }
$gr_id = isset($_POST['gr_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_POST['gr_id']) : '';
$bo_admin = isset($_POST['bo_admin']) ? preg_replace('/[^a-z0-9_\, \|\#]/i', '', $_POST['bo_admin']) : '';
if (!$gr_id) { alert('그룹 ID는 반드시 선택하세요.'); }
if (!$bo_table) { alert('게시판 TABLE명은 반드시 입력하세요.'); }
if (!preg_match("/^([A-Za-z0-9_]{1,20})$/", $bo_table)) { alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); }
if (!$_POST['bo_subject']) { alert('게시판 제목을 입력하세요.'); }
@ -75,11 +78,11 @@ $str_bo_category_list = isset($_POST['bo_category_list']) ? preg_replace("/[\<\>
$_POST['bo_subject'] = strip_tags($_POST['bo_subject']);
$_POST['bo_mobile_subject'] = strip_tags($_POST['bo_mobile_subject']);
$sql_common = " gr_id = '{$_POST['gr_id']}',
$sql_common = " gr_id = '{$gr_id}',
bo_subject = '{$_POST['bo_subject']}',
bo_mobile_subject = '{$_POST['bo_mobile_subject']}',
bo_device = '{$_POST['bo_device']}',
bo_admin = '{$_POST['bo_admin']}',
bo_admin = '{$bo_admin}',
bo_list_level = '{$_POST['bo_list_level']}',
bo_read_level = '{$_POST['bo_read_level']}',
bo_write_level = '{$_POST['bo_write_level']}',

View File

@ -35,6 +35,7 @@ $url = clean_xss_tags($url);
if (!$url) $url = clean_xss_tags($_SERVER['HTTP_REFERER']);
$url = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", $url);
$url = preg_replace('/\r\n|\r|\n|[^\x20-\x7e]/','', $url);
// url 체크
check_url_host($url, $msg);
@ -48,11 +49,9 @@ if($error) {
<script>
alert("<?php echo $msg; ?>");
//document.location.href = "<?php echo $url; ?>";
<?php if ($url) { ?>
document.location.replace("<?php echo str_replace('&amp;', '&', $url); ?>");
<?php } else { ?>
//alert('history.back();');
history.back();
<?php } ?>
</script>

View File

@ -2,9 +2,15 @@
include_once('./_common.php');
include_once(G5_PATH.'/head.sub.php');
$url1 = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", clean_xss_tags($url1));
$url2 = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", clean_xss_tags($url2));
$url3 = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", clean_xss_tags($url3));
$pattern1 = "/[\<\>\'\"\\\'\\\"\(\)]/";
$pattern2 = "/\r\n|\r|\n|[^\x20-\x7e]/";
$url1 = preg_replace($pattern1, "", clean_xss_tags($url1));
$url1 = preg_replace($pattern2, "", $url1);
$url2 = preg_replace($pattern1, "", clean_xss_tags($url2));
$url2 = preg_replace($pattern2, "", $url2);
$url3 = preg_replace($pattern1, "", clean_xss_tags($url3));
$url3 = preg_replace($pattern2, "", $url3);
// url 체크
check_url_host($url1);

View File

@ -3488,7 +3488,7 @@ function get_call_func_cache($func, $args=array()){
return $result;
}
// include 하는 경로에 data file 경로가 포함되어 있는지 체크합니다.
// include 하는 경로에 data file 경로나 안전하지 않은 경로가 있는지 체크합니다.
function is_include_path_check($path='', $is_input='')
{
if( $path ){
@ -3499,6 +3499,14 @@ function is_include_path_check($path='', $is_input='')
if( stripos($path, 'rar:') !== false || stripos($path, 'php:') !== false || stripos($path, 'zlib:') !== false || stripos($path, 'bzip2:') !== false || stripos($path, 'zip:') !== false || stripos($path, 'data:') !== false || stripos($path, 'phar:') !== false ){
return false;
}
$replace_path = str_replace('\\', '/', $path);
$slash_count = substr_count(str_replace('\\', '/', $_SERVER['SCRIPT_NAME']), '/');
$peer_count = substr_count($replace_path, '../');
if ( $peer_count && $peer_count > $slash_count ){
return false;
}
try {
// whether $path is unix or not
@ -3536,7 +3544,10 @@ function is_include_path_check($path='', $is_input='')
return false;
}
if( preg_match('/\/data\/(file|editor|qa|cache|member|member_image|session|tmp)\/[A-Za-z0-9_]{1,20}\//i', str_replace('\\', '/', $path)) ){
if( preg_match('/\/data\/(file|editor|qa|cache|member|member_image|session|tmp)\/[A-Za-z0-9_]{1,20}\//i', $replace_path) ){
return false;
}
if( preg_match('/\.\.\//i', $replace_path) && preg_match('/plugin\//i', $replace_path) && preg_match('/okname\//i', $replace_path) ){
return false;
}
}

View File

@ -1,11 +1,13 @@
<?php
include_once('./_common.php');
if( isset($_REQUEST['exe']) && isset($exe) && $exe ){
die('bad request');
}
// 금일 인증시도 회수 체크
certify_count_check($member['mb_id'], 'hp');
//include_once('./hpcert.config.php');
// KISA 취약점 내용(KVE-2018-0291) hpcert1.php의 $cmd 함수에 대한 인자 값은 hpcert_config.php 파일에서 설정되나, 이를 다른 페이지에서 포함한 뒤 호출할 시 임의 값 설정 가능
// 이에 include_once 를 include 로 수정함
include('./hpcert.config.php');

View File

@ -1,6 +1,9 @@
<?php
include_once('./_common.php');
//include_once('./hpcert.config.php');
if( isset($_REQUEST['exe']) && isset($exe) && $exe ){
die('bad request');
}
// KISA 취약점 내용(KVE-2018-0291) hpcert1.php의 $cmd 함수에 대한 인자 값은 hpcert_config.php 파일에서 설정되나, 이를 다른 페이지에서 포함한 뒤 호출할 시 임의 값 설정 가능
// 이에 include_once 를 include 로 수정함

View File

@ -7,6 +7,7 @@ if(!$config['cf_cert_use'] || $config['cf_cert_ipin'] != 'kcb')
// key 디렉토리 체크
include_once('./key_dir_check.php');
$exe = '';
// 실행모듈
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
if(PHP_INT_MAX == 2147483647) // 32-bit

View File

@ -1,6 +1,10 @@
<?php
include_once('./_common.php');
if( isset($_REQUEST['exe']) && isset($exe) && $exe ){
die('bad request');
}
// 금일 인증시도 회수 체크
certify_count_check($member['mb_id'], 'ipin');

View File

@ -1,6 +1,11 @@
<?php
include_once('./_common.php');
include_once('./ipin.config.php');
if( isset($_REQUEST['exe']) && isset($exe) && $exe ){
die('bad request');
}
include('./ipin.config.php');
//아이핀팝업에서 조회한 PERSONALINFO이다.
@$encPsnlInfo = $_POST["encPsnlInfo"];