Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
타도메인 리다이렉트 체크 오류 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Mar 26, 2018
1 parent ed36ed1 commit b08a43d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bbs/login_check.php
Expand Up @@ -67,7 +67,7 @@

if ($url) {
// url 체크
check_url_host($url);
check_url_host($url, '', G5_URL, true);

$link = urldecode($url);
// 2003-06-14 추가 (다른 변수들을 넘겨주기 위함)
Expand Down
2 changes: 1 addition & 1 deletion bbs/member_confirm.php
Expand Up @@ -17,7 +17,7 @@
$url = clean_xss_tags($_GET['url']);

// url 체크
check_url_host($url);
check_url_host($url, '', G5_URL, true);

$url = get_text($url);

Expand Down
6 changes: 3 additions & 3 deletions lib/common.lib.php
Expand Up @@ -3023,7 +3023,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에 타 도메인을 지정할 수 없습니다.';
Expand All @@ -3033,7 +3033,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);
Expand All @@ -3055,7 +3055,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 ], ':/?#@' ) ) {
Expand Down

0 comments on commit b08a43d

Please sign in to comment.