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

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.

Hijacking SSL

SSL has been in centerstage of researches as well as attacks for quite long time. Last year in a conference in Germany researchers showed how to generate duplicate certificates exploiting MD5 hashing to break SSL. Later in Black Hat, Maxie showed how to exploit a field in SSL certificates to sign an own forged certificate to present it to the client. The main feature of this attack was that the client will never get any warning dialog box by the browser and subsequently the hacker doing an MITM can see the conversation between the client and server. The client will even get a PADLOCK sign to be assured that all things are going via encryption, but in reality it's not. Maxie released a tool SSLStrip to carry out these attacks. The tool has been used by many researchers around the world to carry out the attacks. They all used Unix machines as many open source utilities makes it easier to run the tool on it. My attempt was to run the tool on a Windows machine. It has been never easy t...

jtool - an alternative to otool

jtool comes with a capability of running on Linux environment. Some ipa scanning tools are created to run on Linux environment where mac environment is not available. In such cases tools such as otool and class-dump-z will not work. So jtool can be an alternative to otool. For more information on jtool please refer to http://www.newosxbook.com/tools/jtool.html . It lists down various commands which have same output as otool or a equivalent. There are several commands mentioned in link. But for our customized requirements and basis checks I have listed down the below ones after running on many binaries. The outputs are similar or equivalent to otool and class-dump-z: Commands for checking PIE flag (ASLR) in jTool jtool -d -v -arch | grep stack ·           Automatic Reference Counting (ARC) protection: jtool -d -v -arch | grep _objc_release ·           To check if the devic...