Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Change password fails on old password check #106

Open
haffmans opened this issue Apr 27, 2018 · 1 comment
Open

[API] Change password fails on old password check #106

haffmans opened this issue Apr 27, 2018 · 1 comment

Comments

@haffmans
Copy link

The Change Password API ('/userapi/password') doesn't properly validate the old password. It calls the PasswordHasher.Hash directly (which generates a hash with a new salt), rather than PasswordHasher.Verify.

See RegistrationController.cs line 380:

var old_password_hash = PasswordHasher.Hash(model.old_password);

if (old_password_hash.data!=da.Users.GetAuthenticationSettings(user.user_id).data)
...

I assume this should instead be similar to the AuthLoginController's method of validating the password:

var authSettings = db.Users.GetAuthenticationSettings(user.user_id);
var isPasswordCorrect = PasswordHasher.Verify(model.old_password, new PasswordHash
{
    data = authSettings.data,
    scheme = authSettings.scheme_class
});
if (!isPasswordCorrect)
...
@riperiperi
Copy link
Owner

Good catch, this one was added by Sim for his http://beta.freeso.org web interface, so I never really had much reason to test it out. Should be fixed next commit, though I think this stuff needs an extra pass anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants