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

Commit

Permalink
admin_check_xss_params 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Oct 8, 2018
1 parent 930a2a1 commit a305bc6
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions adm/admin.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,25 @@ function admin_referer_check($return=false)
}
}

function admin_check_xss_params($params){

if( ! $params ) return;

foreach( $params as $key=>$value ){

if ( empty($value) ) continue;

if( is_array($value) ){
admin_check_xss_params($params);
} else if ( preg_match('/<\s?[^\>]*\/?\s?>/i', $value) && preg_match('/script.*?\/script/ius', $value) ){
alert('요청 쿼리에 잘못된 스크립트문장이 있습니다.\\nXSS 공격일수도 있습니다.');
die();
}
}

return;
}

// 접근 권한 검사
if (!$member['mb_id'])
{
Expand Down Expand Up @@ -491,14 +510,7 @@ function admin_referer_check($return=false)

if ( isset($_REQUEST) && $_REQUEST ){
if( admin_referer_check(true) ){

foreach( $_REQUEST as $key=>$value ){
if( $value && preg_match('/<\s?[^\>]*\/?\s?>/i', $value) && preg_match('/script.*?\/script/ius', $value) ){
alert('요청 쿼리에 잘못된 스크립트문장이 있습니다.\\nXSS 공격일수도 있습니다.');
die();
}
}

admin_check_xss_params($_REQUEST);
}
}

Expand Down

0 comments on commit a305bc6

Please sign in to comment.