머지 중 충돌 수정
This commit is contained in:
commit
64812ca5ed
28 files changed
+206
-105
No files matched your search
+23
-1
@@ -3027,6 +3027,22 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
|
||||
$p = @parse_url($url);
|
||||
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
|
||||
$is_host_check = false;
|
||||
|
||||
// url을 urlencode 를 2번이상하면 parse_url 에서 scheme와 host 값을 가져올수 없는 취약점이 존재함
|
||||
if ( !isset($p['host']) && urldecode($url) != $url ){
|
||||
$i = 0;
|
||||
while($i <= 3){
|
||||
$url = urldecode($url);
|
||||
if( urldecode($url) == $url ) break;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if( urldecode($url) == $url ){
|
||||
$p = @parse_url($url);
|
||||
} else {
|
||||
$is_host_check = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(stripos($url, 'http:') !== false) {
|
||||
if(!isset($p['scheme']) || !$p['scheme'] || !isset($p['host']) || !$p['host'])
|
||||
@@ -3034,7 +3050,8 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
|
||||
}
|
||||
|
||||
//php 5.6.29 이하 버전에서는 parse_url 버그가 존재함
|
||||
if ( (isset($p['host']) && $p['host']) && version_compare(PHP_VERSION, '5.6.29') < 0) {
|
||||
//php 7.0.1 ~ 7.0.5 버전에서는 parse_url 버그가 존재함
|
||||
if ( (isset($p['host']) && $p['host']) ) {
|
||||
$bool_ch = false;
|
||||
foreach( array('user','host') as $key) {
|
||||
if ( isset( $p[ $key ] ) && strpbrk( $p[ $key ], ':/?#@' ) ) {
|
||||
@@ -3412,6 +3429,11 @@ function is_include_path_check($path='', $is_input='')
|
||||
{
|
||||
if( $path ){
|
||||
if ($is_input){
|
||||
|
||||
if( strpos($path, 'php://') !== false || strpos($path, 'zlib://') !== false || strpos($path, 'bzip2://') !== false || strpos($path, 'zip://') !== false ){
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// whether $path is unix or not
|
||||
$unipath = strlen($path)==0 || $path{0}!='/';
|
||||
|
||||
Reference in new issue
Block a user