Show HN: Entropy Based Password Validation
github.com
github.com
The entropy depends on how the password is generated. If I choose ten words from my own dictionary then the entropy depends on the size of the dictionary. But if I re-rolled 15 times until I got words that I liked then one would have to decrease the entropy accordingly. But someone else couldn’t distinguish those two cases if they knew nothing about me (modulo common human psychology).
The point is that entropy depends on how the agent generated the password and has nothing to do with character sets or length in itself. So sure, this could be said to be a certain approach to approximating entropy in the general case, but I see no reason to put adjectives in front of “entropy-based password validation” which somehow suggest that it’s the number one, objective way to do it.
It doesn't make any difference to the attacker if I pick "bluecheese" out of a dictionary or as a result of successive random letter draws.
They don't have to brute force all 26^10 lowercase character sequences if they can instead look through 26^3 words in a dictionary. And optionally modifying those words to append "1!" to them, or capitalize the first character, or replace e with 3 or whatever doesn't take much.
The article's approach has no assumptions and provides an upper bound. Your approach makes several assumptions and gives a lower bound IFF those assumptions hold.
The upper bound is useful for the general case: no attacker will be worse.
You're trying to account for more sophisticated attackers, which is great! It is however not clear (without further motivation) whether your attacker model is realistic. That is: will their be an attacker who knows this much about your password generation approach, but does not know more?
If no realistic attacker would know this much, your approach gives an overapproximation (real bound is higher). If, otoh, there is an attacker who knows more (eg, seed of the PRNG, or first characters, etc.), it'll be an underapproximation (real bound will be lower).
So, the difference is that the result of the first approach can directly be interpreted, while the result of your approach needs context.
In the worst case, we assume that the attacker has done their home work and knows the algorithm by which the password was generated, but not the content of this particular password. So, knowing the algorithm, what can the attacker exploit that would help them discover the contents of this password in the shortest possible time?
I submit that the worst case analysis is really the only one we care about.
The worst case would probably be something like "attacker knows hash, passwd algorithm, full state of machine at passwd generation time incl. random seed and all characters of the password but one". It is clearly far worse than your case, though I find your case more relevant than this one.
[1] Although I guess there are caveats: what if your password _happened_ to be weak according to another generation method that you didn’t use but the attacker guessed?
However, it's so incredibly unlikely a high entropy generator would generate a dictionary word that you shouldn't even have to worry about it.
So the password 1010101010101011101101000000010111011011101001010001001101011011 is calculated as only having a length of "2" and a base of 10. So it would be about 6 bits according to this. But the generation method clearly is generating a binary string with length 64, for a total of 64 bits of entropy.
You say you're basing it -- or are inspired by -- the xkcd comic. But the xkcd comic gets this calculation more-or-less right. Entropy is not a property of the character set used to generate the password, it's a property of the rule-set used to generate the password. Look at the comic: the "Tr0ub4dor&3" password isn't 11 random characters chosen from a set of 72 possibilities, and "correct horse battery staple" isn't 28 characters chosen from lower alpha + space.
The difficulty in calculating password entropy is that it's unclear whether or not the rule set will be known to the attacker or not. So an attacker which attempts "arbitrary length lowercase characters" will have a much harder time with "correct horse battery staple" than one that knows "exactly four common english words in lowercase separated by spaces."
Or, put differently, if you know someone has a numeric four-character bank PIN and they submit 1979, do you think this was four randomly chosen digits or do you think the entropy is effectively reduced by an obvious ruleset used to generate it?
Because you rely on character set validation, except for your clever cheat to artificially reduce the entropy of repeated characters, you will nearly always overstate the entropy of the password.
A sort of very naive naive refinement of the problem is that you want an engine that, knowing a password, finds the feasible lowest entropy ruleset that could generate the password and is human reasonable. I include the qualifier "feasible" because via overfitting even random characters have a lowest entropy ruleset (e.g. if by chance the third character is capitalized and the 18th is not, we should not assume that the same rules applied again would generate this property) If you find this unsatisfying because the problem is open ended, I'd at least caution you that the entropy values as stated are at best an indication of how long it would take a brute-force character search to break the password, not how long it would take an even modestly informed adversary to do so.
Hope this guidance turns the cogs a little.
https://www.usenix.org/conference/usenixsecurity16/technical...
I think he overestimating the security of passphrases
For example, the odds of guessing the correct 6 words (in order) from a 2000-word dictionary is approx. 1/10^20 combinations . 1 trillion guesses/second for a year is 3x10^19 guesses, so it takes just three years to guess it, not 10,000 years.
As others have commented, this isn't sufficient though, and will over-estimate the complexity of worded passphrases or l33t-speak. Password crackers are wise to those generation techniques and will brute-force combinations of those with more direct generation methods instead of generating from the underlying character set at random.
Complexity rules backfire if the minimum is done to meet them, like capitalise the first letter, append a number 0 and exclamation mark. A tool like this could (and probably should) check for those special cases and discount them from entropy, assuming conservatively that it's a weak password, ie. "P4ssw0rd0!" ~= "p4ssw0rd" ~= "password" ~= 13 bits (a single English word at random).
I'd also add that while that's a cool graph, it's going to age poorly as FLOPs/Watt is still on an upward trend. I wrote a password generator* which takes into account GCloud/AWS GPU prices and wholesale energy costs, along with Hashcat metrics, to recommend the number of bits of entropy for passwords. Looking 20 years into the future you'd probably want something closer to 82 bits entropy than 76, based on my calculations.
And the fact that this gives 'password123' a whole 51 bits of entropy should be a sign that it's an oversimplification. In fact if it wasn't for the fact that repeated characters are eventually ignored it would at least be guaranteed to always overestimate the entropy, as it is now it just punishes the use of long passwords using a small set of characters (again going directly against the quoted xkcd comic).
62^32 = = 2.27e57
I always say: "If you can remember your password, someone can guess it"
If you're generating passwords for users from these statistical models, and forcing them to use the first paraphrase you give them, talking about "raw entropy" would make more sense. It's still subjective, in that someone who knows the full machine state at generation time would probably see a different entropy, but at least that information is relatively hard to access.
for example, by the p*log(p) measure
`1234567890abcdef` and `936a0ce28b1d74f5` both have log(16!) bits of entropy, yet one of them is much easier to guess than the other.
Is anyone aware of an overview/list of XKCD-inspired projects?