Skip to content

Commit a8a4b35

Browse files
authored
Merge pull request hestiacp#2135 from jaapmarcus/fix/reset-roundcube-password
CSRF check was to strict and didn't bypass the check...
2 parents e858a55 + 8d44965 commit a8a4b35

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

web/inc/prevent_csrf.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
$check_csrf = true;
44

5-
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/inc/mail-wrapper.php ') {
5+
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/inc/mail-wrapper.php' || $_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia//web/inc/mail-wrapper.php') {
66
$check_csrf=false;
77
} // execute only from CLI
8-
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/reset/mail/index.php ') {
8+
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/reset/mail/index.php' || $_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web//reset/mail/index.php') {
99
$check_csrf=false;
1010
} // Localhost only
11-
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/api/index.php') {
11+
if ($_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web/api/index.php' || $_SERVER['SCRIPT_FILENAME'] == '/usr/local/hestia/web//api/index.php') {
1212
$check_csrf=false;
1313
} // Own check
1414
if (substr($_SERVER['SCRIPT_FILENAME'], 0, 22)=='/usr/local/hestia/bin/') {
@@ -20,6 +20,7 @@ function checkStrictness($level)
2020
if ($level >= $_SESSION['POLICY_CSRF_STRICTNESS']) {
2121
return true;
2222
} else {
23+
http_response_code(400);
2324
echo "<h1>Potential use CSRF detected</h1>\n".
2425
"<p>Please disable any plugins/add-ons inside your browser or contact your system administrator. If you are the system administrator you can run v-change-sys-config-value 'POLICY_CSRF_STRICTNESS' '0' as root to disable this check.<p>".
2526
"<p>If you folowed a bookmark or an static link <a href='/'>please click here</a>";

0 commit comments

Comments
 (0)