Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I'm creating a webapp, and part of my authentication method is password length.

Should I put one in place? (say, 50 characters?) Or should I just put a minimum length (Currently at 6).

Are there problems with not putting in a maximum length?

share|improve this question
1  
possible duplicate security.stackexchange.com/questions/144/… –  H.B. Aug 15 '11 at 18:45
    
H.B: It's similar, but I beg to differ - I think that this question is different enough because I'm asking it from a implementation aspect and not a users aspect. However, if it gets closed as a duplicate, so be it. :) –  jrg Aug 15 '11 at 18:59
1  
You should actually make it so your users have to use phrases instead of the typical password. –  Woot4Moo Aug 16 '11 at 22:31
3  
Attackers love it when websites place arbitrary restrictions on user passwords. It gives them the info they need to tune their attack parameters. –  todofixthis Sep 4 '12 at 21:30
    
Nothing makes me angrier then encountering a maximum password length. It is indicative of incorrect password storage, it is arbitrary, and encourages users to accept using passwords shorter then they are otherwise capable of using. If you must set an upper bound to make sure user's aren't sending you gigabyte long password strings, pick a limit of 1024 or 256 characters at the bare minimum... –  recursion.ninja Nov 8 at 22:21

3 Answers 3

up vote 26 down vote accepted

You should salt and hash the password instead of storing it in clear text. The hash function will result in a constant output size regardless of the length of the input string.

Using a minimum length and perhaps some other quality rules is a good idea because it helps a little against laziness.

If you are afraid of Denial of Service attacks, you could put a server side limit for ordinary input fields into place, for example 1000 bytes. It's unlikely that someone wants to use such a long password.

share|improve this answer

My recommendation: 1,024 bytes.

The limitation on password sizes is a limitation that existed for reasons of obsolete technical requirements. Modern password storage should rely on hashing which makes the password storage field a fixed size regardless of the password length. We don't want to see 1mb passwords as that would simply indicate somebody trying to cause a denial of service. I don't think I'll ever see a human use a 1,024 character (or longer) password. I think that's a small enough value to prevent any real DOS and a high enough value to never be reached in any reasonable circumstance.

share|improve this answer
12  
The venerable Apple 1 had only a very minimal ROM, just enough to type in hexadecimal code; so every time it was booted up, someone had to type what was the OS at that time, i.e. a 3 kB BASIC interpreter (so about 6000 characters). Steve Wozniak could do it in 20 minutes and knew it by heart. –  Thomas Pornin Aug 15 '11 at 19:15
6  
And if you believe that I've got some money I need help transferring out of the country. –  webbiedave Aug 15 '11 at 23:42
2  
@webbiedave Thomas is telling the truth - I've read the same thing in Steve Wozniak's book, iWoz. –  jrg Aug 16 '11 at 1:08
5  
He didn't need to change it monthly though. –  Joubarc Aug 17 '11 at 8:12
2  
@webbiedave sounds reasonable based on what the Apple-1 manual says –  Josh Nov 1 '11 at 2:16

It depends on the message digest function you use. For the majority (sha-256, even md5,sha1 ect...) it doesn't matter. However, if you are using bcrypt it does, bcrypt has a 55 char limit. So if you're salt is 27 bytes you can have a password of 28 bytes.

On a side note, CWE-521 does require that you have a max password length. However it doesn't state the max, and from a security prescriptive I don't see any reason why it could be 512kbyte or more.

share|improve this answer
    
hey, that's interesting? do you have a link for further reading on the BCrypt char limit? –  Jacco Sep 24 '12 at 7:22
    
...however as stated here you can simply hash the password and put that into bcrypt instead –  Tobias Kienzler Feb 13 '13 at 16:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.