From 9ff06909124512fe34fc66d270f8574ba2c6d764 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 7 Nov 2011 09:41:41 +0100 Subject: [PATCH 1/3] Fix: entity filter --- htdocs/compta/deplacement/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index d6a602663be..7038761ab6d 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -65,6 +65,7 @@ llxHeader('',$langs->trans("ListOfFees"),$help_url); $totalnb=0; $sql = "SELECT count(d.rowid) as nb, sum(d.km) as km, d.type"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d"; +$sql.= " WHERE d.entity = ".$conf->entity; $sql.= " GROUP BY d.type"; $sql.= " ORDER BY d.type"; From 1ce6bd7c790438e234dd7112bfa3e363dfd8698d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 8 Nov 2011 14:59:01 +0100 Subject: [PATCH 2/3] Fix: bug #232 --- htdocs/lib/security.lib.php | 2 +- htdocs/main.inc.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 4212cc12529..0a8ceafa2a1 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -181,7 +181,7 @@ function dol_loginfunction($langs,$conf,$mysoc) } // Login - $login = (!empty($lastuser)?$lastuser:(GETPOST("username")?GETPOST("username"):$demologin)); + $login = (!empty($lastuser)?$lastuser:(GETPOST("username","alpha",2)?GETPOST("username","alpha",2):$demologin)); $password = $demopassword; // Show logo (search in order: small company logo, large company logo, theme logo, common logo) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e6796b41870..a60703cd3c3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -324,7 +324,7 @@ if (! defined('NOLOGIN')) } // Verification security graphic code - if (isset($_POST["username"]) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) + if (GETPOST("username","alpha",2) && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { require_once DOL_DOCUMENT_ROOT.'/includes/artichow/Artichow.cfg.php'; require_once ARTICHOW."/AntiSpam.class.php"; @@ -339,7 +339,7 @@ if (! defined('NOLOGIN')) $langs->load('main'); $langs->load('other'); - $user->trigger_mesg='ErrorBadValueForCode - login='.$_POST["username"]; + $user->trigger_mesg='ErrorBadValueForCode - login='.GETPOST("username","alpha",2); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode"); $test=false; @@ -365,7 +365,7 @@ if (! defined('NOLOGIN')) // If error, we will put error message in session under the name dol_loginmesg $goontestloop=false; if (isset($_SERVER["REMOTE_USER"]) && in_array('http',$authmode)) $goontestloop=true; - if (isset($_POST["username"]) || GETPOST('openid_mode','alpha',1)) $goontestloop=true; + if (GETPOST("username","alpha",2) || GETPOST('openid_mode','alpha',1)) $goontestloop=true; if ($test && $goontestloop) { @@ -378,7 +378,7 @@ if (! defined('NOLOGIN')) if ($result) { // Call function to check user/password - $usertotest=$_POST["username"]; + $usertotest=GETPOST("username","alpha",2); $passwordtotest=$_POST["password"]; $entitytotest=$_POST["entity"]; $function='check_user_password_'.$mode; @@ -411,7 +411,7 @@ if (! defined('NOLOGIN')) $langs->load('other'); // Bad password. No authmode has found a good password. - $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.$_POST["username"]; + $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); // Appel des triggers From 762f98ab4137749d0993612b4e3544a4207e78a1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 8 Nov 2011 17:17:21 +0100 Subject: [PATCH 3/3] Fix: [Bug #232] Multiple Cross-Site-Scripting vulnerabilities --- htdocs/lib/security.lib.php | 2 +- htdocs/main.inc.php | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 4212cc12529..0a8ceafa2a1 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -181,7 +181,7 @@ function dol_loginfunction($langs,$conf,$mysoc) } // Login - $login = (!empty($lastuser)?$lastuser:(GETPOST("username")?GETPOST("username"):$demologin)); + $login = (!empty($lastuser)?$lastuser:(GETPOST("username","alpha",2)?GETPOST("username","alpha",2):$demologin)); $password = $demopassword; // Show logo (search in order: small company logo, large company logo, theme logo, common logo) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e6796b41870..c6ee7bd423e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -76,6 +76,9 @@ function test_sql_and_script_inject($val,$get) $sql_inj += preg_match('/(\.\.%2f)+/i', $val); // For XSS Injection done by adding javascript with script $sql_inj += preg_match('/