Blog

Password Security From A Developer’s Perspective

One of my biggest pet peeves has to do with password security – and why some websites still don’t take password security seriously. In this article I will go over some of the common limitations and bad decisions I’ve seen, and why there is no reason for any website to have them in place:

No Special Characters

Virtually all security experts agree the best way to make a secure password is by using a mixture of alphanumeric characters (A-Z and 0-1) in addition to special characters ( !@%$)&^ ). So why is it so many websites still disallow special characters? It is simply mind boggling.

For starters, if you are properly developing your application, special characters should not matter for data that is going through a hash algorithm (you do hash your passwords, right?) The algorithms only care about bits and bytes – as far as they are concerned an A is no different than a % other than the bit values they represent.

Length Limits

One of the financial sites I use on a regular basis limits passwords to 10 characters. While yes, a 10 character password is a lot better than 90% of the passwords used on a daily basis by most people, it is still insecure. But that is an argument for another day.

My point is, why have such a low limit? I do agree a limit is needed (after all, you don’t need people sending a megabyte of data every time they log in), but the limit can be fairly high. Theoretically a hashed password will always be the same size in the database – whether the original text was “abc” or “123456789012345678901234567890″ – it doesn’t matter. So please, stop it with the annoyingly low limits.

Not Hashing The Passwords

This is just plain stupid. There is no reason in the entire universe to ever store plain-text passwords in your database.

– Once Again –

There is no reason in the entire universe to ever store plain-text passwords in your database.

Get it? It sickens me how many services out there still literally email your password, in plain text, when you use their “forgot my password” function. Just stop it. Please hash the password and if they forget it, have a verification test set up, and if they pass it let them make a new password.

Otherwise you’re just asking for a script-kiddie to cause trouble.

Oh, and do use password salts.

Change Password Fields

One of the best security measures you can put in place is requiring the user to enter their password to change their login name (email/username/whatever) or to change their password. The reason being – what if someone intercepts a cookie?

Without requiring a password they can steal the account very easily. By requiring a password it makes it much more difficult. And that leads me onto my next point…

Cookies

And last but not least is cookies. No – not the edible delicious treats – but those little bits of text that let you store session data.

A login cookie should never have your password (even hashed) in it. When a user logs in an id should be generated – unique to this session – which will be used to identify the user. That id will then be stored in the database and in the cookie and will only be valid for as long as the cookie is valid. Heck, you can even do a mixture of a user id and the session id.

Either way if the cookie gets intercepted a malicious user will still be able to get in – but at least this way their password is safe.

Comments
  1. MacBros
    May 7, 2011 at 8:59 pm

    All I heard was something about Cookies! I like cookies, they’re yummie!

    But after reading this I realized what you were ranting about.

    I don’t like long passwords because I’m stupid. I can’t remember long passwords.

    The only web site I have used !@#% characters is Hostmonster’s CPanel. I’ve never had any other website allow me to use those characters.

    You would think they would because they’re not very unique and say a phrase right?

    Good rant.. err. I mean post!

  2. Jeremy Steele
    May 7, 2011 at 9:49 pm

    Haha, yep it’s a rant. I’m recovering from a two week long flu thing so I’m grumpy :P

    I gave up keeping track of passwords – I just use 1password to store everything. Keepass is good too. At one point I was up to around 150 logins (email accounts, site logins, test sites for clients, etc). I tried coming up with a system to remember them all but my head nearly exploded.

    Then again, at least I use 1password with a 10+ character long password to encrypt the password file – then I have the file on a 256-bit encrypted drive with another 15 character long password. Heh, It’d probably take about a million years to crack that even with 1000 of todays computers.

    I guess I’m just super paranoid :D

Leave a Reply

Please enter your name and email. Your email address will be kept private.