diff --git a/adm/board_form_update.php b/adm/board_form_update.php index 912887760..2222baadb 100644 --- a/adm/board_form_update.php +++ b/adm/board_form_update.php @@ -72,6 +72,9 @@ $bo_category_list = str_replace($src_char, $dst_char, $bo_category_list); //https://github.com/gnuboard/gnuboard5/commit/f5f4925d4eb28ba1af728e1065fc2bdd9ce1da58 에 따른 조치 $str_bo_category_list = isset($_POST['bo_category_list']) ? preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", "", $_POST['bo_category_list']) : ''; +$_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']}', bo_subject = '{$_POST['bo_subject']}', bo_mobile_subject = '{$_POST['bo_mobile_subject']}', diff --git a/adm/boardgroup_form.php b/adm/boardgroup_form.php index 73e162d98..c9e8338bd 100644 --- a/adm/boardgroup_form.php +++ b/adm/boardgroup_form.php @@ -117,7 +117,7 @@ include_once('./admin.head.php'); - + diff --git a/adm/config_form.php b/adm/config_form.php index 00915fe7d..e4daee961 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -1317,7 +1317,7 @@ if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) { - + diff --git a/adm/config_form_update.php b/adm/config_form_update.php index 03179c345..126786382 100644 --- a/adm/config_form_update.php +++ b/adm/config_form_update.php @@ -26,6 +26,8 @@ if(!$_POST['cf_cert_use']) { $cf_social_servicelist = !empty($_POST['cf_social_servicelist']) ? implode(',', $_POST['cf_social_servicelist']) : ''; +$_POST['cf_title'] = strip_tags($_POST['cf_title']); + $sql = " update {$g5['config_table']} set cf_title = '{$_POST['cf_title']}', cf_admin = '{$_POST['cf_admin']}', diff --git a/adm/contentformupdate.php b/adm/contentformupdate.php index dff780a39..69f82f0b0 100644 --- a/adm/contentformupdate.php +++ b/adm/contentformupdate.php @@ -20,6 +20,7 @@ if ($w == "" || $w == "u") $co_row = sql_fetch($sql); } +$co_id = preg_replace('/[^a-z0-9_]/i', '', $co_id); $co_subject = strip_tags($co_subject); $co_include_head = preg_replace(array("#[\\\]+$#", "#(<\?php|<\?)#i"), "", substr($co_include_head, 0, 255)); $co_include_tail = preg_replace(array("#[\\\]+$#", "#(<\?php|<\?)#i"), "", substr($co_include_tail, 0, 255)); @@ -59,12 +60,12 @@ if( $co_include_tail ){ } } -if( $co_include_head && ! is_include_path_check($co_include_head) ){ +if( $co_include_head && ! is_include_path_check($co_include_head, 1) ){ $co_include_head = ''; $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.'; } -if( $co_include_tail && ! is_include_path_check($co_include_tail) ){ +if( $co_include_tail && ! is_include_path_check($co_include_tail, 1) ){ $co_include_tail = ''; $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.'; } diff --git a/adm/menu_list.php b/adm/menu_list.php index ffe88aee7..4a6c25127 100644 --- a/adm/menu_list.php +++ b/adm/menu_list.php @@ -196,6 +196,20 @@ function base_convert(number, frombase, tobase) { function fmenulist_submit(f) { + + var me_links = document.getElementsByName('me_link[]'); + var reg = /^javascript/; + + for (i=0; i diff --git a/adm/menu_list_update.php b/adm/menu_list_update.php index f05e2ec22..4244d3343 100644 --- a/adm/menu_list_update.php +++ b/adm/menu_list_update.php @@ -23,8 +23,8 @@ for ($i=0; $i<$count; $i++) $code = $_POST['code'][$i]; $me_name = $_POST['me_name'][$i]; - $me_link = $_POST['me_link'][$i]; - + $me_link = preg_match('/^javascript/', $_POST['me_link'][$i]) ? G5_URL : strip_tags($_POST['me_link'][$i]); + if(!$code || !$me_name || !$me_link) continue; diff --git a/bbs/board_head.php b/bbs/board_head.php index 04b60450f..a62706a28 100644 --- a/bbs/board_head.php +++ b/bbs/board_head.php @@ -5,13 +5,13 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 if (G5_IS_MOBILE) { // 모바일의 경우 설정을 따르지 않는다. include_once(G5_BBS_PATH.'/_head.php'); - echo stripslashes($board['bo_mobile_content_head']); + echo html_purifier(stripslashes($board['bo_mobile_content_head'])); } else { if(is_include_path_check($board['bo_include_head'])) { //파일경로 체크 @include ($board['bo_include_head']); } else { //파일경로가 올바르지 않으면 기본파일을 가져옴 include_once(G5_BBS_PATH.'/_head.php'); } - echo stripslashes($board['bo_content_head']); + echo html_purifier(stripslashes($board['bo_content_head'])); } ?> \ No newline at end of file diff --git a/bbs/board_tail.php b/bbs/board_tail.php index 57b81b46e..436e2cc3b 100644 --- a/bbs/board_tail.php +++ b/bbs/board_tail.php @@ -3,11 +3,11 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 // 게시판 관리의 하단 파일 경로 if (G5_IS_MOBILE) { - echo stripslashes($board['bo_mobile_content_tail']); + echo html_purifier(stripslashes($board['bo_mobile_content_tail'])); // 모바일의 경우 설정을 따르지 않는다. include_once(G5_BBS_PATH.'/_tail.php'); } else { - echo stripslashes($board['bo_content_tail']); + echo html_purifier(stripslashes($board['bo_content_tail'])); if(is_include_path_check($board['bo_include_tail'])) { //파일경로 체크 @include ($board['bo_include_tail']); } else { //파일경로가 올바르지 않으면 기본파일을 가져옴 diff --git a/bbs/content.php b/bbs/content.php index f9551ed80..366e11e54 100644 --- a/bbs/content.php +++ b/bbs/content.php @@ -1,6 +1,8 @@ 관리자 모드에서 게시판관리->내용 관리를 먼저 확인해 주세요.'); diff --git a/bbs/member_confirm.php b/bbs/member_confirm.php index 685dec86c..722a78302 100644 --- a/bbs/member_confirm.php +++ b/bbs/member_confirm.php @@ -11,16 +11,16 @@ else $urlencode = urlencode($_SERVER[REQUEST_URI]); */ +$url = clean_xss_tags($_GET['url']); + //소셜 로그인 한 경우 -if( function_exists('social_member_comfirm_redirect') ){ +if( function_exists('social_member_comfirm_redirect') && (! $url || $url === 'register_form.php') ){ social_member_comfirm_redirect(); } $g5['title'] = '회원 비밀번호 확인'; include_once('./_head.sub.php'); -$url = clean_xss_tags($_GET['url']); - // url 체크 check_url_host($url, '', G5_URL, true); diff --git a/bbs/password.php b/bbs/password.php index e5e0a4d4e..646f3b645 100644 --- a/bbs/password.php +++ b/bbs/password.php @@ -43,8 +43,8 @@ switch ($w) { include_once(G5_PATH.'/head.sub.php'); -//if ($board['bo_include_head']) { @include ($board['bo_include_head']); } -//if ($board['bo_content_head']) { echo stripslashes($board['bo_content_head']); } +//if ($board['bo_include_head'] && is_include_path_check($board['bo_content_head'])) { @include ($board['bo_include_head']); } +//if ($board['bo_content_head']) { echo html_purifier(stripslashes($board['bo_content_head'])); } /* 비밀글의 제목을 가져옴 지운아빠 2013-01-29 */ $sql = " select wr_subject from {$write_table} @@ -57,8 +57,8 @@ $g5['title'] = get_text($row['wr_subject']); include_once($member_skin_path.'/password.skin.php'); -//if ($board['bo_content_tail']) { echo stripslashes($board['bo_content_tail']); } -//if ($board['bo_include_tail']) { @include ($board['bo_include_tail']); } +//if ($board['bo_content_tail']) { echo html_purifier(stripslashes($board['bo_content_tail'])); } +//if ($board['bo_include_tail'] && is_include_path_check($board['bo_content_tail'])) { @include ($board['bo_include_tail']); } include_once(G5_PATH.'/tail.sub.php'); ?> diff --git a/bbs/view_image.php b/bbs/view_image.php index 779f83a30..196df9f4c 100644 --- a/bbs/view_image.php +++ b/bbs/view_image.php @@ -4,8 +4,13 @@ include_once('./_common.php'); $g5['title'] = '이미지 크게보기'; include_once(G5_PATH.'/head.sub.php'); -$filename = $_GET['fn']; -$bo_table = $_GET['bo_table']; +$filename = preg_replace('/[^A-Za-z0-9 _ .\-\/]/', '', $_GET['fn']); + +$extension = pathinfo($filename, PATHINFO_EXTENSION); + +if ( ! preg_match('/(jpg|jpeg|png|gif|bmp)$/i', $extension) ){ + alert_close('이미지 확장자가 아닙니다.'); +} if(strpos($filename, 'data/editor')) { $editor_file = strstr($filename, 'editor'); diff --git a/config.php b/config.php index 6d69fe466..16e566c5c 100644 --- a/config.php +++ b/config.php @@ -5,7 +5,7 @@ ********************/ define('G5_VERSION', '그누보드5'); -define('G5_GNUBOARD_VER', '5.3.1.8'); +define('G5_GNUBOARD_VER', '5.3.1.9'); // 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음 define('_GNUBOARD_', true); diff --git a/g4_import_run.php b/g4_import_run.php index 259832777..6681df0e8 100644 --- a/g4_import_run.php +++ b/g4_import_run.php @@ -71,6 +71,7 @@ document.onkeydown = noRefresh ; ', if($config['cf_cert_use']) { if($config['cf_cert_ipin']) echo ''.PHP_EOL; - if($config['cf_cert_hp'] && $config['cf_cert_hp'] != 'lg') + if($config['cf_cert_hp']) echo ''.PHP_EOL; echo ''.PHP_EOL; @@ -106,7 +106,7 @@ add_stylesheet('',
  • - " maxlength="255" placeholder="홈페이지"> + " maxlength="255" placeholder="홈페이지">
  • @@ -272,19 +272,19 @@ add_stylesheet('', // 아이핀인증 - $("#win_ipin_cert").click(function() { + $("#win_ipin_cert").click(function(e) { if(!cert_confirm()) return false; var url = "/ipin1.php"; - certify_win_open('kcb-ipin', url); + certify_win_open('kcb-ipin', url, e); return; }); // 휴대폰인증 - $("#win_hp_cert").click(function() { + $("#win_hp_cert").click(function(e) { if(!cert_confirm()) return false; @@ -298,6 +298,10 @@ add_stylesheet('', $cert_url = G5_KCPCERT_URL.'/kcpcert_form.php'; $cert_type = 'kcp-hp'; break; + case 'lg': + $cert_url = G5_LGXPAY_URL.'/AuthOnlyReq.php'; + $cert_type = 'lg-hp'; + break; default: echo 'alert("기본환경설정에서 휴대폰 본인확인 설정을 해주십시오");'; echo 'return false;'; @@ -305,7 +309,7 @@ add_stylesheet('', } ?> - certify_win_open("", ""); + certify_win_open("", "", e); return; }); diff --git a/plugin/okname/ipin1.php b/plugin/okname/ipin1.php index 864995786..f448c216d 100644 --- a/plugin/okname/ipin1.php +++ b/plugin/okname/ipin1.php @@ -4,7 +4,9 @@ include_once('./_common.php'); // 금일 인증시도 회수 체크 certify_count_check($member['mb_id'], 'ipin'); -include_once('./ipin.config.php'); +// KISA 취약점 내용(KVE-2018-0291) hpcert1.php의 $cmd 함수에 대한 인자 값은 hpcert_config.php 파일에서 설정되나, 이를 다른 페이지에서 포함한 뒤 호출할 시 임의 값 설정 가능 +// 이에 include_once 를 include 로 수정함 +include('./ipin.config.php'); $option = "C";// Option diff --git a/theme/basic/mobile/skin/member/basic/register_form.skin.php b/theme/basic/mobile/skin/member/basic/register_form.skin.php index 3e11894c1..6f9137059 100644 --- a/theme/basic/mobile/skin/member/basic/register_form.skin.php +++ b/theme/basic/mobile/skin/member/basic/register_form.skin.php @@ -52,7 +52,7 @@ add_stylesheet('', if($config['cf_cert_use']) { if($config['cf_cert_ipin']) echo ''.PHP_EOL; - if($config['cf_cert_hp'] && $config['cf_cert_hp'] != 'lg') + if($config['cf_cert_hp']) echo ''.PHP_EOL; echo ''.PHP_EOL; @@ -106,7 +106,7 @@ add_stylesheet('',
  • - " maxlength="255" placeholder="홈페이지"> + " maxlength="255" placeholder="홈페이지">
  • @@ -272,19 +272,19 @@ add_stylesheet('', // 아이핀인증 - $("#win_ipin_cert").click(function() { + $("#win_ipin_cert").click(function(e) { if(!cert_confirm()) return false; var url = "/ipin1.php"; - certify_win_open('kcb-ipin', url); + certify_win_open('kcb-ipin', url, e); return; }); // 휴대폰인증 - $("#win_hp_cert").click(function() { + $("#win_hp_cert").click(function(e) { if(!cert_confirm()) return false; @@ -298,6 +298,10 @@ add_stylesheet('', $cert_url = G5_KCPCERT_URL.'/kcpcert_form.php'; $cert_type = 'kcp-hp'; break; + case 'lg': + $cert_url = G5_LGXPAY_URL.'/AuthOnlyReq.php'; + $cert_type = 'lg-hp'; + break; default: echo 'alert("기본환경설정에서 휴대폰 본인확인 설정을 해주십시오");'; echo 'return false;'; @@ -305,7 +309,7 @@ add_stylesheet('', } ?> - certify_win_open("", ""); + certify_win_open("", "", e); return; });