union이 포함된 쿼리 사용할 수 있도록 수정

This commit is contained in:
chicpro
2015-03-23 09:00:46 +09:00
parent 2717346e9d
commit 3ee5fa6d86

View File

@ -1448,7 +1448,8 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR)
// Blind SQL Injection 취약점 해결
$sql = trim($sql);
// union의 사용을 허락하지 않습니다.
$sql = preg_replace("#^select.*from.*union.*#i", "select 1", $sql);
//$sql = preg_replace("#^select.*from.*union.*#i", "select 1", $sql);
$sql = preg_replace("#^select.*from.*[\s\(]+union[\s\)]+.*#i ", "select 1", $sql);
// `information_schema` DB로의 접근을 허락하지 않습니다.
$sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql);