그누보드 다중 취약점 (17-0295, 334, 355) 수정

This commit is contained in:
thisgun
2017-09-28 20:23:28 +09:00
parent 5970f2a577
commit 0f4ec77ac0
6 changed files with 93 additions and 42 deletions

View File

@ -382,15 +382,24 @@ function admin_referer_check($return=false)
}
$p = @parse_url($referer);
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
$msg = '';
if($host != $p['host']) {
$msg = '올바른 방법으로 이용해 주십시오.';
}
if($return)
if( $p['path'] && ! preg_match( '/\/'.preg_quote(G5_ADMIN_DIR).'\//i', $p['path'] ) ){
$msg = '올바른 방법으로 이용해 주십시오';
}
if( $msg ){
if($return) {
return $msg;
else
} else {
alert($msg, G5_URL);
}
}
}

View File

@ -21,7 +21,7 @@ if ($file = $_POST['bo_include_head']) {
$purl = parse_url($file);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로 php, html 파일이 아닙니다.');
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
$_POST['bo_include_head'] = $file;
}
@ -30,16 +30,16 @@ if ($file = $_POST['bo_include_tail']) {
$purl = parse_url($file);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로 php, html 파일이 아닙니다.');
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
$_POST['bo_include_tail'] = $file;
}
if(!is_include_path_check($_POST['bo_include_head'])) {
if(!is_include_path_check($_POST['bo_include_head'], 1)) {
alert('/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.');
}
if(!is_include_path_check($_POST['bo_include_tail'])) {
if(!is_include_path_check($_POST['bo_include_tail'], 1)) {
alert('/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.');
}

View File

@ -20,6 +20,22 @@ if ($co_timg_del) @unlink(G5_DATA_PATH."/content/{$co_id}_t");
$error_msg = '';
if( $co_include_head ){
$purl = parse_url($co_include_head);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $co_include_tail ){
$purl = parse_url($co_include_tail);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $co_include_head && ! is_include_path_check($co_include_head) ){
$co_include_head = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.';

View File

@ -10,12 +10,28 @@ check_admin_token();
$error_msg = '';
if( $qa_include_head && ! is_include_path_check($qa_include_head) ){
if( $qa_include_head ){
$purl = parse_url($qa_include_head);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('상단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $qa_include_tail ){
$purl = parse_url($qa_include_tail);
$file = $purl['path'];
if (!preg_match("/\.(php|htm['l']?)$/i", $file)) {
alert('하단 파일 경로의 확장자는 php, html 만 허용합니다.');
}
}
if( $qa_include_head && ! is_include_path_check($qa_include_head, 1) ){
$qa_include_head = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.';
}
if( $qa_include_tail && ! is_include_path_check($qa_include_tail) ){
if( $qa_include_tail && ! is_include_path_check($qa_include_tail, 1) ){
$qa_include_tail = '';
$error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.';
}