|
-
+
|
diff --git a/adm/board_form_update.php b/adm/board_form_update.php
index 2222baadb..497d1df01 100644
--- a/adm/board_form_update.php
+++ b/adm/board_form_update.php
@@ -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']}',
diff --git a/adm/config_form.php b/adm/config_form.php
index f08a9d94c..1193a7b7f 100644
--- a/adm/config_form.php
+++ b/adm/config_form.php
@@ -1419,6 +1419,10 @@ if($config['cf_cert_use']) {
}
echo module_exec_check($exe, 'okname');
+
+ if(is_dir(G5_OKNAME_PATH.'/log') && is_writable(G5_OKNAME_PATH.'/log') && function_exists('check_log_folder') ) {
+ check_log_folder(G5_OKNAME_PATH.'/log');
+ }
}
// kcp일 때
diff --git a/bbs/alert.php b/bbs/alert.php
index 1d74ad4b4..fbac90876 100644
--- a/bbs/alert.php
+++ b/bbs/alert.php
@@ -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) {
diff --git a/bbs/confirm.php b/bbs/confirm.php
index a80f5eab1..5e71c009a 100644
--- a/bbs/confirm.php
+++ b/bbs/confirm.php
@@ -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);
diff --git a/bbs/move_update.php b/bbs/move_update.php
index d956ff0d7..92a5e2d18 100644
--- a/bbs/move_update.php
+++ b/bbs/move_update.php
@@ -196,8 +196,10 @@ if ($sw == 'move')
{
for ($i=0; $i\'\"\\\'\\\"\%\=\(\)\/\^\*]/", '', $host);
- $result['url'] = $http.$host.$port.$user.$root;
+ $chroot = substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], dirname(__FILE__)));
+ $result['path'] = str_replace('\\', '/', $chroot.dirname(__FILE__));
+ $server_script_name = preg_replace('/\/+/', '/', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']));
+ $server_script_filename = preg_replace('/\/+/', '/', str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']));
+ $tilde_remove = preg_replace('/^\/\~[^\/]+(.*)$/', '$1', $server_script_name);
+ $document_root = str_replace($tilde_remove, '', $server_script_filename);
+ $pattern = '/' . preg_quote($document_root, '/') . '/i';
+ $root = preg_replace($pattern, '', $result['path']);
+ $port = ($_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
+ $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
+ $user = str_replace(preg_replace($pattern, '', $server_script_filename), '', $server_script_name);
+ $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
+ if(isset($_SERVER['HTTP_HOST']) && preg_match('/:[0-9]+$/', $host))
+ $host = preg_replace('/:[0-9]+$/', '', $host);
+ $host = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", '', $host);
+ $result['url'] = $http.$host.$port.$user.$root;
return $result;
}
diff --git a/config.php b/config.php
index 992e1fe0a..be5d40110 100644
--- a/config.php
+++ b/config.php
@@ -5,8 +5,8 @@
********************/
define('G5_VERSION', '그누보드5');
-define('G5_GNUBOARD_VER', '5.3.2.7');
-define('G5_YOUNGCART_VER', '5.3.2.7');
+define('G5_GNUBOARD_VER', '5.3.2.8');
+define('G5_YOUNGCART_VER', '5.3.2.8');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true);
diff --git a/lib/common.lib.php b/lib/common.lib.php
index 398d95704..a82bd6ea9 100644
--- a/lib/common.lib.php
+++ b/lib/common.lib.php
@@ -3503,7 +3503,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 ){
@@ -3514,6 +3514,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
@@ -3551,7 +3559,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;
}
}
diff --git a/plugin/htmlpurifier/extend.video.php b/plugin/htmlpurifier/extend.video.php
index 96cb5b846..24ef7c8de 100644
--- a/plugin/htmlpurifier/extend.video.php
+++ b/plugin/htmlpurifier/extend.video.php
@@ -24,6 +24,7 @@ if( !class_exists('HTMLPurifier_Filter_Iframevideo') ){
if (strstr($html, ' |