aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-04-27 13:26:36 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-04-27 13:26:36 +0200
commitf75dd1628cd3add8f69128ff63e0c1cd296cd2a3 (patch)
treeb2b017a47ea5720b04f925ba8464864888f3e889 /phpBB/includes/functions.php
parentf3c4587d47af6aa3e39368653b542f97ed3428c6 (diff)
parentb8368980162392bf9f97496ecec18abe2bd34fad (diff)
downloadforums-f75dd1628cd3add8f69128ff63e0c1cd296cd2a3.tar
forums-f75dd1628cd3add8f69128ff63e0c1cd296cd2a3.tar.gz
forums-f75dd1628cd3add8f69128ff63e0c1cd296cd2a3.tar.bz2
forums-f75dd1628cd3add8f69128ff63e0c1cd296cd2a3.tar.xz
forums-f75dd1628cd3add8f69128ff63e0c1cd296cd2a3.zip
Merge pull request #48 from phpbb/ticket/security/228
[ticket/security/228] Add form token to login box
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 24f251601f..1d1c9f6f4f 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2288,6 +2288,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
global $request, $phpbb_container, $phpbb_dispatcher, $phpbb_log;
$err = '';
+ $form_name = 'login';
// Make sure user->setup() has been called
if (!$user->is_setup())
@@ -2363,8 +2364,19 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
trigger_error('NO_AUTH_ADMIN_USER_DIFFER');
}
- // If authentication is successful we redirect user to previous page
- $result = $auth->login($username, $password, $autologin, $viewonline, $admin);
+ // Check form key
+ if ($password && !check_form_key($form_name))
+ {
+ $result = array(
+ 'status' => false,
+ 'error_msg' => 'FORM_INVALID',
+ );
+ }
+ else
+ {
+ // If authentication is successful we redirect user to previous page
+ $result = $auth->login($username, $password, $autologin, $viewonline, $admin);
+ }
// If admin authentication and login, we will log if it was a success or not...
// We also break the operation on the first non-success login - it could be argued that the user already knows
@@ -2515,6 +2527,9 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
));
}
+ // Add form token for login box
+ add_form_key($form_name, '_LOGIN');
+
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$login_box_template_data = array(