views:

347

answers:

9

A hypothetical situation: you've implemented a password handling system, and it doesn't impose any limitations at all on what characters can be used. You want to set up some rules that are a reasonable compromise between two things -

  1. Allow the user as much freedom as possible.
  2. Allow for the possibility that you may change how you handle passwords in the future - you don't want to rule out reasonable implementations because your users' existing passwords would become invalid.

What rules would you impose? Are there other factors that might affect you choice?

A: 

I'd keep anything you can make with one key (and optionally shift) on your keyboard, except tab. What kind of schemes would necessitate a more restrictive option?

Peter
People who use a different keyboard from me would necessitate a *less* restrictive option. What's special about the keyboard I happen to have in front of me when I'm writing the code? Some people can get a euro-symbol or an e-acute in one keypress+shift, others can't.
Steve Jessop
+8  A: 

Do not impose no restrictions whatsoever, ever. And it seems to me that you're planning on storing password, not hash. Do not do that either. Rather, store salt and hashed combination of password and said salt.

However, you can require your users to have a reasonably strong password by imposing restriction on length (say, not less than 6 characters) and on characters which comprise the password (say, it should contain lower- and uppercase alphabetic characters, one or two digits and several non-alphabetic characters such as ^ or #).

Anton Gogolev
Whatever you do though, PLEASE don't restrict max char length; i generate huge passwords via Keepass and it annoys me when i have to downgrade the generation algorithm i use for that.
RCIX
I'm not sure why this answer keeps getting voted up - it doesn't answer the question! The question was not "What restrictions would you impose?" it was "What characters would you make invalid". The answers that suggest few or no restrictions seem like more reasonable answers to that. (And, no, I would not store passwords as plain text).
@issy: The very first sentence answers your question perfectly fine. An the fact that you're not going to store passwords as plain text is not immediately obvious since you're asking about some obscure "password handling schema changes". What can possibly go wrong when all you're storing is password hash?
Anton Gogolev
A: 

Have the users type passwords that contain at least a number and a non-alphanumeric character, and be more than six characters long. Anyway, I think that whatever the limitations, in the event that you change the way you validate passwords, you should notify users in reasonable time to update theirs.

luvieere
+1  A: 

Any non-control character should be fine. I should think that the developers of super-duper password systems in the future would allow "unusual" ASCII characters like punctuation and other marks, but control characters have a habit of being unwieldy to enter in text mode shells and even GUI dialogs that expect Tab and Enter/Return to be free for their own purposes.

Coxy
+2  A: 

A blank space (based on the logic it may be trimmed accidentally before being hashed)

Chris S
A: 

The rules I would suggest enforcing:

  1. Length - no less than 8 characters - but no more than 20
  2. Ease of breaking - the pass should not contain the user's first name, last name or user name, nor (if possible to check) any word that appears in the English dictionary.
  3. Content - There are 4 types of characters on the keyboard: uppercase, lowercase, numbers and punctuation marks. A good password should include representatives from at least 3 groups, and no more that 2-3 characters of the same group in a row.
Traveling Tech Guy
Please stop spreading these absolute rules. These rules don't even make sense for a bank -- I prefer a long passphrase which I can remember, rather than what I would be forced to choose with your rules of "abcDEF32_!" or similar.
Kevin Peterson
Min 8 char limit will cause users to write the password down instead of remembering it. Very bad idea. Same thing with forcing X numbers and Y special characters. 4 or 5 letters minimum is imo more reasonable.Upper limit of 20 is also too low, i sometimes use a whole sentance as password because it's easier to remember than 8 random characters of different types.
Erik
I use keepass and hate it when i cant' generate a nice long password to use.
RCIX
While I agree with the general notion of hating those constricting rules, and even though I'm using a password manager myself, you have to remember that 99% of the users out there are not tech savvy. They don't use keepass. They tend to have passwords like "david1" or "123456" (I refer you to this article: http://blog.jimmyr.com/Password_analysis_of_databases_that_were_hacked_28_2009.php). So if you want your organization's systems to be easily hacked from the outside, by all means - have no rules.
Traveling Tech Guy
+3  A: 

Best is no restrictions whatsoever, unless you can really justify them.

If you are a bank, email provider, or if the user can order something without supplying a credit card, then forcing users to use a strong password makes sense. Otherwise, you're just making it hard for no reason.

As to what you should store, I'd say 1024 characters of unicode with control characters prohibited is about all that's justified. If the user can't type it, they should have picked a different password. All you're storing is a hash, so you can always cut it down to whatever size you want.

Kevin Peterson
I use keepass which has an option for using "high ANSI characters like the following: `•iôhQná"«-óÓSGÉH©®Eqj‰Ë=«ÒquW6†>\‰Jò-§`.
RCIX
I don't know of RCIX's comment is intended to contradict what Kevin says, but those aren't control characters and would not be prohibited by the suggested rules. They just aren't 7-bit ASCII.
Steve Jessop
Not the answer I was expecting, but apparently it's the most reasonable one. A lot of systems out there do impose restrictions, and I assumed they had a good reason. If so, nobody here seems to know what they are, so I'll change my assumption! Some other answers here are more about restrictions that should be imposed, rather than characters that should be allowed.
*"If the user can't type it, they should have picked a different password."* Well, unusual characters not being transmitted correctly isn't always the user's fault... although admittedly unicode is rather well supported.
Ilari Kajaste
+1  A: 

No limit on the password. If they can type it from their keyboard, regardless of what regional keyboard they use. You may want to impose a minimum length, options like at least one number and one special character, but no max limit.

Regarding your second question. The way I would implement it is via making seperate fields as you improve password strength. For example, right now you would have two fields that relate to the password: salt, password_md5. Lets say later on you want to use sha256. Create a new field called password_sha256. When the user logs in you first check password_sha256. If that field is empty then check password_md5. If that matches you now have the plain text password the user entered. You can then generate the sha256 password (I'd also reset the salt for good measure) and store the new value. I would then blank out the value in password_md5 so no one could reverse that to get the password.

Personally I'd just go with the best hash your language can do and use that. The important things are enforcing a good minimum password policy--it doesn't matter how secure the hash is when the password is "1234"--and to seed the hash with some random character to avoid dictionary attacks.

vrillusions
A: 

In our organization, if the user is supplying the password we allow them to use anything they want.

When users are first enrolled in the system a password is generated for them. Since this password is usually mailed to them, we avoid using certain characters that could be confused particularly when using certain fonts. For example, the letter O and the number 0 (zero) are not used. The same for L, I and 1 (one), S and 5, Z and 2 and others.

Before we made this change we had a lot of calls to our help desk because the characters we confusing and they couldn't log in.

Loki Stormbringer