From e8f9436f31c99f2b1bad2b820caf72f7c7d3c939 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Thu, 21 May 2015 05:24:50 -0400 Subject: [PATCH] - fixed csrf protection --- interface/lib/classes/db_mysql.inc.php | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php index 6609ec9..7331463 100644 --- a/interface/lib/classes/db_mysql.inc.php +++ b/interface/lib/classes/db_mysql.inc.php @@ -132,13 +132,19 @@ if($ids_config['sql_scan_enabled'] == 'yes') { + // Remove whitespace + $string = trim($string); + if(substr($string,-1) == ';') $string = substr($string,0,-1); + + // Save original string $string_orig = $string; //echo $string; - $chars = array(';', '#', '/*', '*/', '--', ' UNION ', '\\\'', '\\"'); + $chars = array(';', '#', '/*', '*/', '--', '\\\'', '\\"'); $string = str_replace('\\\\', '', $string); - $string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\]?)\\2/is', '$1', $string); + $string = preg_replace('/(^|[^\\\])([\'"])\\2/is', '$1', $string); + $string = preg_replace('/(^|[^\\\])([\'"])(.*?[^\\\])\\2/is', '$1', $string); $ok = true; if(substr_count($string, "`") % 2 != 0 || substr_count($string, "'") % 2 != 0 || substr_count($string, '"') % 2 != 0) { -- Gitblit v1.9.1