I'm confused about how to implement password reset functionality. I'm testing a Web application with two roles - administrator and normal user. Only administrators can use the password reset functionality (not has MFLAC).
This function find a user and load a view with basic data, for example "TEST_USER" with e-mail "[email protected]". The fields doesdo not have the "readonly" attribute, so they can be modified by the administrator. When the user clicks the button "Reset" the application sends an email to "TEST_USER" with a URL (https://host.com/resetPassword.aspx?token=TOKEN).
The link loads a page with two fields, "new password" and "verify new password". Here I succesfullysuccessfully changed the password and completed the process.
If an attacker changechanges the value in the field "e-mail" and enterenters "[email protected]" then the applicacionapplication will send the link to the attacker, thereby letting the attacker change the password. Is imporntantIt is important to mention that this function is suceptiblesusceptible to CSRF because it does not hashave a token.
So I think that this is a vulnerability because an attacker or administrator can change the e-mail and reset the password for any user without them knowing about it. Using CSRF an attacker can send a malicious URL that resets the password to an administrator.
So I think that this is not a correct way to implement this functionality because I have heard that a good practice is sending only a token to the email address.
I think that the correct way to do this would be:
- Assure that the e-mail address belongs to the user whoswhose password is being reset.
- You should send only one token instead of an URL.
- In the page
ResetPassword.aspxpaste the token. - Verify the user with security questions.
- Let the user fill in "new password" and "verify new password"
Is this a vulnerability? Is this the correct way to implement this funcionalityfunctionality?