Random passwords are not necessarily good passwords

July 17, 2007

I was recently writing a random password generator and in the process it occurred to me that there is an important difference between random passwords and good passwords, because we mean different things by those terms.

A truly random password is one that an attacker can't guess better than through random chance even if they know your password generation algorithm, so that on average they would have to try half of all of the possible passwords before successfully guessing yours.

(How many possible passwords there are is based on how many bits of information are in the password.)

However, a good password is a password that will not be found by an attacker that is trying common password patterns (or the password patterns that are feasible for them to brute-force). A truly randomly generated password necessarily has a chance to be a bad password, unless you took explicit steps to exclude the space of bad passwords from what your random process can generate (which reduces how many bits of randomness are in the password).

How likely is it that a randomly generated password will be a bad password? If you are using general enough categories, you can use the difference in the number of bits of information. For example, if our password generation alphabet is letters plus digits and we consider all-letter passwords to be too weak, then there's a four bit difference in the total bits and thus our truly random password generator has a one in sixteen chance of generating a bad password.

I suspect that the best way to get rid of bad passwords is not to try to tweak your random password generator to exclude them, because that may have hard to understand effects on how many bits of information its generated passwords really have. Instead I would check the generated password for badness and, if it is bad, generate another.


Comments on this page:

From 70.49.21.130 at 2007-07-18 08:09:04:

Have you looked at APG at all?

From 128.117.43.34 at 2007-07-18 15:39:28:

Good passwords are also memorable to the owner. In practice, randomly assigned passwords are not memorable, and are not better than mnemonic passwords. For more, see this paper:

The Memorability and Security of Passwords – Some Empirical Results
by Jianxin Yan, Alan Blackwell, Ross Anderson, Alasdair Grant
September 2000
http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-500.pdf

That said, even the "best" password will fall to a keystroke logger, such as installed by the storm worm, or a trojan ssh client. Those are increasingly common in practice.

By cks at 2007-07-19 18:53:34:

I don't expect people to remember these randomly generated passwords. In some contexts, these are just initial passwords and the user will be forced to change the password the first time they use it; in other contexts, I expect the user to let their web browser remember the password for them.

I hadn't heard of APG before now; thanks for the pointer, and I will have to play with it sometime. The main benefit of my current random password generator is that it is very simple.

Written on 17 July 2007.
« Why SSL and name-based virtual hosts don't get along
Why I like Python's large integer support »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Jul 17 23:23:40 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.