Skip to content

Commit

Permalink
[SS-2016-011] ChangePasswordForm does not check $member->canLogin bef…
Browse files Browse the repository at this point in the history
…ore login

This could be used as a way to circumvent login restrictions by using the change password feature to log users in that are unable to login for reasons other than too many password attempts
  • Loading branch information
dhensby authored and Damian Mooyman committed Aug 15, 2016
1 parent f85dea2 commit 6d41db7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions security/ChangePasswordForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,19 @@ public function doChangePassword(array $data) {
else if($data['NewPassword1'] == $data['NewPassword2']) {
$isValid = $member->changePassword($data['NewPassword1']);
if($isValid->valid()) {
$member->logIn();

// TODO Add confirmation message to login redirect
Session::clear('AutoLoginHash');

// Clear locked out status
$member->LockedOutUntil = null;
$member->FailedLoginCount = null;
$member->write();


if ($member->canLogIn()->valid()) {
$member->logIn();
}

// TODO Add confirmation message to login redirect
Session::clear('AutoLoginHash');

if (!empty($_REQUEST['BackURL'])
// absolute redirection URLs may cause spoofing
&& Director::is_site_url($_REQUEST['BackURL'])
Expand Down

0 comments on commit 6d41db7

Please sign in to comment.