Skip to main content

Secure Forgot Password Implemantion

I got a message from Mae Bualat about secure implementation of forgot password mechanism. Although, his way also sounded secure to me, I suggested him more alternatives. It's always arguable the approaches, but these are my personal arguments as per my limited knowledge.
Following is the communication between us:
Hi Mr. Nilesh Kumar,

I've come across your blog while looking for some references on the web for a secured password recovery scheme. I suppose, as a security specialist, you may have inputs to help me work on it.

Am looking for a secure password recovery implementation. The process that I am looking into is this: user will need to supply email address used on account registration then birthday, then user will need to supply new password, then the system will send a verification link to his registered email to finalize and confirm the process.But aside from this, am still currently looking for some ways to securely implement this process.

Any idea will be highly appreciated.

Thanks,
mae

I wrote:
Hi Mae,
Your implementation in the first glance looks reasonably secure to me, but again it depends on various scenarios as how rigorously you implement it, ie, no. of security questions and how personal they are as date of birth is not so personal now a days. Instead you may use mother's maiden name.
So, leaving the type of security questions you implement on you, I would suggest the following Do's and Don'ts. It's my personal assumption and may and may not be the best solution:

1. Don't rely on an email mechanism to send temporary password/ cleartext (actual ) password/ or any other sensitive instructions to the user's registered email. It may seem secure but there's always a risk of sniffing the passwords/ other sensitive instructions on how to reset the password over the unencrypted internet.
2. Don't display user's password on the webpage after answering some secret questions. The risk here is the page may be cached on the computer and anybody with little computer knowledge may have access to it. And this also implied that that the application is not storing the password in hashed form in the database, that is again a weak implementation.
3. Don't use password hints as to be displayed on the webpage, which is again guessable.

Now this should be reasonably secure mechanism:
1. Use a multistage password set mechanism where in you may ask username, registered email and some other information such as DOB, ZIP, customer no. etc.More are the questions, the more secure it is. Once all validated correctly, go to next stage, otherwise display generic message "Invalid Data".
2. Next stage, ask at least 3 personal security questions (like mother's maiden name, name of your first vacation place etc) already preset while user was registered. If correct go to next stage.
3. At this stage, finally, present user with new password reset form. Enforce all password complexity guidelines. One more thing you can dot to more it more secure is, as soon as the user is done with providing correct personal security answer as stage 2, immediately send a long random token to his registered e-mail. And then do require him to supply that long random token on this final new password reset page. This will act as 2-factor authentication.

Apart from that, all by-default security best practices you should follow, such as storing user's answers in salted hash in the DB, Don't use using HTTP method, Invalidate old password ONLY when user is done with setting new password successfully, Send an email informing user that password has been changed, Lock out the account for a certain period and then unlock it etc.

So in short, Don't use email to send sensitive information, use email for a out-of-band authentication purpose. This way, it might be reasonably secure implementation.

Regards,
Nilesh

Comments

Popular posts from this blog

Using an AirPcap device in Windows with Wireshark

Capturing wireless traffic in a Windows environment is unfortunately not as easy as a setting change. As with most Windows-based software, drivers in Windows are often not open source and do not allow for configuration change into monitor mode. With this in mind, we must use a specialized piece of hardware known as an AirPcap device. Once you have obtained an AirPcap device you will be required to install the software on the accompanying CD to your analysis computer. The configurable options include: • Interface - Select the device you are using for your capture here. Some advanced analysis scenarios may require you to use more than one AirPcap device to sniff simultaneously on multiple channels. • Blink LED - Clicking this button will make the LED lights on the AirPcap device blink. This is primarily used to identify the specific adapter you are using if you are using multiple AirPcap devices. • Channel - In this field, you select the channel you want AirPcap to listen on. Extension C...

Anti CSRF header

Recently I came across an application which was preventing crsf attacks using a unique non-traditional approach. In traditional approach the csrf is thwarted by embedding unique random tokens, called nonce, in each sensitive page. But this application, which was making ajax calls and used jQuery, was creating a header to identify the valid and invalid requests altogether. The idea is to generate a custom header, x-session-token in this case, with every request which is considered sensitive and includes any sort of transaction. For example: xhr.setRequestHeader('x-session-token', csrf_token)   At the server level, server checks for this header if found request is fulfilled, otherwise rejected. We need to use xhr calls for making use of this technique, not useful in regular POST and GET requests. Since, I was not aware of this kind of countermeasures, probably, since most of the applications I did were using standard requests. So, I searched a bit and found even Go...

Some one watching where you visited!

Yes... Mozilla has been susceptible to browser-history stealing java script code. Today, Giorgio posted some cool information about the exploit. Mozilla is already working on this. This bug has been reported. Actually they have set up a web site to show the proof-of-concept. Visit www.statrpanic.com in FF,Safari or Netscape and it will tell you which websites have you been already ! But I am not sure it will work in IE or not because my IE is not responding to the website. Clearing history of visited website makes you safe to this attack. I mean this is one way..may be there are other ways to exploit this. But I have found this effective. Try it yourself in FF and then in IE and see the results.