diff options
author | Derky <derky@phpbb.com> | 2019-04-26 12:08:37 +0200 |
---|---|---|
committer | Derky <derky@phpbb.com> | 2019-04-26 12:11:52 +0200 |
commit | b8368980162392bf9f97496ecec18abe2bd34fad (patch) | |
tree | ac2c5ba156d76c26df7336c21c3ab22cb976ff35 /phpBB/includes | |
parent | 507efee633fee769e7e2af4a2b298c951193f800 (diff) | |
download | forums-b8368980162392bf9f97496ecec18abe2bd34fad.tar forums-b8368980162392bf9f97496ecec18abe2bd34fad.tar.gz forums-b8368980162392bf9f97496ecec18abe2bd34fad.tar.bz2 forums-b8368980162392bf9f97496ecec18abe2bd34fad.tar.xz forums-b8368980162392bf9f97496ecec18abe2bd34fad.zip |
[ticket/security/228] Add form token to login box
SECURITY-228
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e2ea7ad232..6df2ebaba7 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2268,6 +2268,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()) @@ -2343,8 +2344,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 @@ -2495,6 +2507,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( |