From c34b0407663a842760725041d3036dee0e79e291 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 14 May 2015 09:18:45 +0000 Subject: [PATCH] added CSRF protection --- lam/HISTORY | 1 + lam/lib/html.inc | 10 ++++-- lam/lib/modules.inc | 3 +- lam/lib/modules/inetOrgPerson.inc | 7 ++-- lam/lib/modules/ldapPublicKey.inc | 11 +++++-- lam/lib/security.inc | 53 ++++++++++++++++++++++++++++++- lam/lib/selfService.inc | 11 ++++++- lam/templates/lib/500_lam.js | 2 +- lam/templates/login.php | 1 + lam/templates/misc/ajax.php | 7 ++-- 10 files changed, 92 insertions(+), 14 deletions(-) diff --git a/lam/HISTORY b/lam/HISTORY index e7e0aff9..3fd01e18 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -1,4 +1,5 @@ June 215 + - Security: added CSRF protection - Zarafa users: allow to change display format of "Send As" diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 80ce6293..7ccd6f76 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -591,12 +591,16 @@ class htmlInputField extends htmlElement { '; } if ($this->checkPasswordStrength) { - $ajaxPath = "../templates/misc/ajax.php"; + $tokenSuffix = '?' . getSecurityTokenName() . '=' . getSecurityTokenValue(); + if (isSelfService()) { + $tokenSuffix .= '&selfservice=1'; + } + $ajaxPath = "../templates/misc/ajax.php" . $tokenSuffix; if (is_file("../../templates/misc/ajax.php")) { - $ajaxPath = "../../templates/misc/ajax.php"; + $ajaxPath = "../../templates/misc/ajax.php" . $tokenSuffix; } elseif (is_file("../../../templates/misc/ajax.php")) { - $ajaxPath = "../../../templates/misc/ajax.php"; + $ajaxPath = "../../../templates/misc/ajax.php" . $tokenSuffix; } echo '