Merge branch 'master' of github.com:gnuboard/g5

This commit is contained in:
thisgun
2018-03-26 09:52:13 +09:00
5 changed files with 9 additions and 8 deletions

View File

@ -28,6 +28,7 @@ include_once(G5_PATH.'/head.sub.php');
// 파일만 가능합니다.
// 공백이 없어야 합니다.
$msg = isset($msg) ? strip_tags($msg) : '';
$msg2 = str_replace("\\n", "<br>", $msg);
$url = clean_xss_tags($url);
@ -36,7 +37,7 @@ if (!$url) $url = clean_xss_tags($_SERVER['HTTP_REFERER']);
$url = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", $url);
// url 체크
check_url_host($url);
check_url_host($url, $msg);
if($error) {
$header2 = "다음 항목에 오류가 있습니다.";
@ -46,7 +47,7 @@ if($error) {
?>
<script>
alert("<?php echo strip_tags($msg); ?>");
alert("<?php echo $msg; ?>");
//document.location.href = "<?php echo $url; ?>";
<?php if ($url) { ?>
document.location.replace("<?php echo str_replace('&amp;', '&', $url); ?>");

View File

@ -67,7 +67,7 @@ if ($auto_login) {
if ($url) {
// url 체크
check_url_host($url);
check_url_host($url, '', G5_URL, true);
$link = urldecode($url);
// 2003-06-14 추가 (다른 변수들을 넘겨주기 위함)

View File

@ -17,7 +17,7 @@ include_once('./_head.sub.php');
$url = clean_xss_tags($_GET['url']);
// url 체크
check_url_host($url);
check_url_host($url, '', G5_URL, true);
$url = get_text($url);

View File

@ -5,7 +5,7 @@
********************/
define('G5_VERSION', '그누보드5');
define('G5_GNUBOARD_VER', '5.2.9.8.3');
define('G5_GNUBOARD_VER', '5.2.9.8.4');
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define('_GNUBOARD_', true);

View File

@ -3008,7 +3008,7 @@ function check_password($pass, $hash)
}
// 동일한 host url 인지
function check_url_host($url, $msg='', $return_url=G5_URL)
function check_url_host($url, $msg='', $return_url=G5_URL, $is_redirect=false)
{
if(!$msg)
$msg = 'url에 타 도메인을 지정할 수 없습니다.';
@ -3018,7 +3018,7 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
$is_host_check = false;
// url을 urlencode 를 2번이상하면 parse_url 에서 scheme와 host 값을 가져올수 없는 취약점이 존재함
if ( !isset($p['host']) && urldecode($url) != $url ){
if ( $is_redirect && !isset($p['host']) && urldecode($url) != $url ){
$i = 0;
while($i <= 3){
$url = urldecode($url);
@ -3040,7 +3040,7 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
//php 5.6.29 이하 버전에서는 parse_url 버그가 존재함
//php 7.0.1 ~ 7.0.5 버전에서는 parse_url 버그가 존재함
if ( (isset($p['host']) && $p['host']) ) {
if ( $is_redirect && (isset($p['host']) && $p['host']) ) {
$bool_ch = false;
foreach( array('user','host') as $key) {
if ( isset( $p[ $key ] ) && strpbrk( $p[ $key ], ':/?#@' ) ) {