Spredehagl
Auto Dansk English

Password ponderings

Long passwords are more secure than short ones, but if they are too long people write them down, so find the happy medium.
Bad advice

Give passwords as short an expiration as the users will accept. The more frequently they are changed, the better. That is really the only defense against password leaks.
Bad advice

If the password does not contain both uppercase and lowercase letters, and special characters, it is too easy to guess.
Bad advice

Passwords are like underwear.

I looked at password security for more than ten years, and I blinded myself staring at that type of advice.

How long should they be, those passwords? Can we base the number on research instead of imitating what others do? Et cetera, et cetera.

It is easy to get caught up in the logic around those advices. The problem isnt that they are wrong. They arent really. They are just no longer important. Their relevance has eroded away.

Heres the thing: We humans have a limited bandwidth when we prove our identity.

Because we want our authentication to be both fast and repeatable, it is limited how much data we can generate. You could say the codomain is relatively small, if you see human authentication as a function from user to authentication data. It is small enough for a computer to fairly easily break a human password by using brute force with some optimizations.

"Breaking the password" might be pure greek to some readers. What does it really mean?

Normally systems will not save your password as it is. They dont have to, to check it later on. What they do instead, is to either 1: encrypt the password before saving it, or to 2: calculate a hash value of it, and then save that. That way, if the system is compromised, bad actors are not able to directly read your password in their memory. But in spite of that, it can nonetheless be possible to figure out the password, from the saved data, and that is to break the password.

Hashing is the more secure option of the two, so let us focus on that. How does it work?

When you enter your password, it is checked by hashing it and comparing it to its saved hash. If those two values are not the same, the wrong password was entered. For hashing like this a cryptographically strong hash function is used. That is just a fancy name for a one-way function.

The problem is that the codomain is small enough to make it feasible, with the computing power that is within reach of most people, to basically test out all possible passwords, and that way "invert" the one-way function.

There is a nice trick to avoid this kind of inverting. Use a computationally heavy hash function. A simple hash function like a modern SHA, is lightingly fast to compute. But if your hash function is this SHA iterated 100,000 times, then the computing power required is noticeable, and brute-forcing becomes non-trivial.

Unfortunately it also affects yourself, so this is only used in setups where it is the users own device that do the hashing. It is only used for password-protected documents as far as I know.

There are more tricks, and they are less compelling. You can pull one bad trick after another out of your hat, but it is a loosing battle. The scale of the task plus the computing power available equals a defacto inverse function for password hashes.

The basic problem is the small set of data that we can generate, as mentioned above. When I realized that, I saw what should have been clear all along.

Passwords are shared secrets.

Encryption and hashing do not fundamentally change this.

The best security comes from sharing the passwords with as few as possible. Of course, as everyone know, with as few people as possible. But also, what every security architect should take note of, with as few machines as possible.

Password pain diagram.

Ideally the only machine that should see your pass­word should be the one you use for entering it.

Minimize password spread.

Use this axiom as your guideline when you design or purchase solutions. Then you will avoid a lot of attack vectors.

Note by the way, that solutions designed this way inherently solve many of the issues that the classical password advices are about. If you nevertheless set up enforcements in line with the classical password advices, it actually can hurt the security. Because you get the disadvantages without getting the advantages.