Show HN: Correct Horse Battery Staple password generator
correcthorse.pw
correcthorse.pw
What it does well on:
The source code is open source licensed. Passwords are generated in the client, not on the server. The generator is random. The generator is cryptographically secure. The generator is unbiased. Mobile devices are supported. There are no JavaScript trackers loaded on the page. The site is not calling out to external resources without SRI.
Unfortunately, by only choosing 4 random words, the security margin of the passphrase is 52 bits (13 bits per word). This is practical for a hobbyist password cracker to exhaust in an offline attack. The security would be better if 6 random words were chosen instead.
Audit: https://docs.google.com/spreadsheets/d/1ucaqJ4U3X3nNEbAAa06i...
The default was chosen as 4 words due to usability concerns with longer passwords or more obscure words, but it is adjustable. The strength meter is yellow at 4 words to indicate the less-than-optimal entropy, but I felt it was better than turning a new user off by making it too hard to remember. But that's a decision I plan on revisiting.
If you are security conscious, you can save a more secure default for yourself (in local storage, nothing is ever transmitted to a server).
I would recommend the default be 6 words, and let people choose down to 4, but not lower. At last that way, users know what a "secure default" looks like. Granted, it breaks the four-word "correct horse battery staple" XKCD format, but Randall was in some error with that comic anyway.
That should meet pretty much any password requirement, be virtually impossible to guess or brute force, and you won't have trouble remembering it (because you don't have to!).
Lol I wish. Almost all of the important sites I use, like various bills and loans, use terrible password schemes. One even, until recently, enforced an 8 character limit! I think they raised it to 16 iirc. Oy.
Hell, even the company I work for frequently fails my password generator settings. The arbitrary character requirements of my ~20 character password would sometimes not be satisfied when I was creating accounts in our dev system/etc. Which is annoying as hell, but I can't convince management, because our users (older) tend to use some of the worst passwords out there.. so I can understand where it's coming from.
Security & UX is hard.
All it takes is the one time, for whatever reason, that you have to type in a string of a few dozen random characters by hand on a phone keyboard or something because you're on a new device, or cut and paste is disabled, or whatever, and you'll understand why long random passwords should be reserved for web servers and so on and never used with consumer web applications like a hotel reservation program, or rental car app, or similar.
It doesn't have to be all or nothing and is probably better if it isn't.
Eg the scheme doesn't do its job well if you don't know the word, so the dictionary can be reduced by that much
Random numbers picked by humans are notoriously biased. I'm guessing it's even worse when you ask them to come up with random words.
But randomness are not enough, it's possible the first generated version correlate with your preference and that situation does not really matter why are you stopped generating new password.
Predictability of this scheme very good, because the strict rules. All implementation using common english words. For words smaller length, easy spelling, less ambiguity are preferred. Mixing nouns verbs and adjectives are more meaningful, order also adds more meaning. Word count very limited. Preference on the separator character also very rigid. Personal preference more known, because hidding your preference on all english words very hard and mostly unconscious.
No, it's the -maximum- that I reduced entropy by. If I choose randomly from 4 possible passwords, I've shaved off --no entropy--.
If I choose with a strongly predictable preference (say, everyone knows I'll pick the password that's first alphabetically) I've shaved nearly 2 bits off the probable search space: you probably only need to look in the first 1/4th of the search space.
Choosing with some subtle, individual preferences is something inbetween.
No, your example has nothing to do with preference, your method (picking out of 4) just less random than picking from one (the first).
Preference is, when certain passwords more likely to be picked than others or at those passwords less likely to be stepped over to generating a new one. Wtih strong preference you regenerate until you got that preferred password, for example you prefer short words and the attacker know that, at first trying combinations with short words has better chance to cracking the password.
Infinitely re-rolling until you get the exact phrase "correct horse battery staple" obviously has a severe entropy penalty, and this is not a reasonable course of action.
Sorry for over explaning, but I feel it necessary.
Sticking with your example and making more formal. Name it pick function and let its three modes, random, deterministic and preference. In the random mode, the probability of picking one from the inputs are equal to picking to any other. In the deterministic mode, with the same inputs the function always picking the same and the probability of others are zero, but if the inputs change or any input, it could change the picked one. In the preference mode the function not just picking one, but making a sorted list of the inputs. In the preference mode, changing one input not changing the others sorting. In this mode using pick function on several inputs you got some information about the inputs overall probability distribution aka entropy (more precisely entropy is the measure of that).
The important from this, determinism not imply preference, but not random also. Cryptographic hash functions doing the extreme version of this determinism, the output is well "distributed", but not random. (PS: Sometime that characteristic called pseudorandomness, that is how PRNGs works with random seed)
Deterministic pick applied to random pick just less random than random pick alone on the same set, because random pick has the maximum of the entropy and adding some deterministic part just reducing that. But most people not picking with a well distributed deterministic function in their mind, more likely they pick with preference, which is I think much worse. So, that why I call it the bare minimum.
Recently, I decided to package it up with a nice domain name and publish it in hopes that it would be useful to others.
Even if the site knew for certain that you had used one of the passwords, they would have no idea where you used the password, and they wouldn't know your username or other credentials.
They might not even have any way of accessing the system you're putting the password into.
I'm sure a lot of people will use these sorts of sites to generate a whole bunch of passwords, and not even use any of them.
I agree, the risk is minimal. Nevertheless.. security, heh.
Payload decoders and password generators are some of the biggest honeypots out there. Combining this with an attack taking advantage of hidden form autofill, you could gain quite a bit of information to go along with that password.
If I were to recommend novices to use it-- I'd tell them to use a password manager locally, and something like that to generate a secure password to get into their own machine locally / get into their password manager-- which mitigates most of the risk if it turns rogue.
A passphrase, as opposed to a password, has spaces between each word.
If you added those it would be easier to read, especially for mobile, if you used a multiline textarea, because the generated content isn’t fully readable at a glance. (Or don’t use a form input field at all — just put the passphrase in a div so the word breaks flow normally.)
Currently I use and recommend https://preshing.com/20110811/xkcd-password-generator/
I think your site works well on selling itself if you assume the audience is coming from HN. From what I have observed, your site does not market itself well to a typical corporate IT dept who are not all programmers.
I think if we want to promote wider adoption of this good password technique, we'll need a different approach.
This is not a criticism-- You've done a job I admire. I think I might fork it and make another version that is approachable to a wider audience. Thank you!
At some point 1Password dropped that, replacing it something similar to "correct horse battery staple". It's words (3-10) separated by hyphen, space, period, comma, or underscore. E.g., "plasma.haggis.arrange.stultify".
shuf -n 4 /usr/share/dict/words
The main objection I have to sites like this is that they encourage people to use a random untrusted site to generate a password for, say, their bank account.
shuf --random-source=/dev/urandom -n 4 /usr/share/dict/words
[1] https://www.gnu.org/software/coreutils/manual/html_node/Rand...
[2] https://github.com/coreutils/coreutils/blob/v8.5/gl/lib/rand...
[3] https://github.com/coreutils/coreutils/blob/v8.32/gl/lib/ran...
Edit: As ThA0x2 points out in a reply, the latest version of shuf uses /dev/urandom to generate a default nonce, which vastly improves upon older versions. As long as your version of coreutils is at least 8.6 or later and your OS has /dev/urandom, the default should be fine. If you don't have /dev/urandom, even the latest version of shuf (version 8.32, as of June 15, 2020) will still default to an insecure nonce.
In any case, I expect it's much harder than a random "free password gen!" website saving results on the sly (... which is meant to be mild criticism of your framing, but not your recommendation :-p).
I definitely wouldn't try this on a freshly booted Raspberry Pi, for example.
https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/ran...
It's going to be as practical to attack as anything that uses /dev/urandom.
That said, I suspect most people are indeed on a platform with a sufficiently recent version of shuf.
(And a sufficiently old version may lack the random-source option.)
I'd say almost everyone reading these comments is on a platform that does not suffer from this issue.
https://github.com/coreutils/coreutils/blob/v8.31/gl/lib/ran...
Your "--random-source=/dev/urandom" line is superfluous. My original line is as secure as yours.
The master branch of coreutils is using getrandom(2). It will continue to draw entropy from the urandom source by default.
RHEL 6 is from 2009, and it's end of life is this November.
Both of those OS are not from 2013 or later. They may have minor versions that were released later, but minor versions typically don't make significant changes to core packages.
RHEL 7 (2014) and Ubuntu 13.04 both have coreutils 8.20 or newer.
My comments are not contradictory to your point about 2013. They are only meant to make people aware that there are supported OS versions in use that have this issue.
Essentially, come November, there will not be a generally supported Linux OS that will have this issue.
ELS versions receive critical security fixes and urgent bug fixes until the end of their support. They are used right up to end of support, or even beyond in some cases.
RHEL 5 ELS will be supported thru November 30, 2020 and RHEL 6 ELS will be supported thru June 30, 2024.
This implies there will be RHEL 5 ELS users for at least 5 more months and there will be RHEL 6 ELS users for at least 4 more years.
So, for at least four more years, it appears there will be users who should use the --random-source option with shuf if they want to be cryptographically secure.
The argument is that if you're on a currently supported, non-EOL Linux OS, you will not have this issue after November (since at that point in time, the RHEL 6 will be past end of life).
>ELS versions receive critical security fixes and urgent bug fixes until the end of their support. They are used right up to end of support, or even beyond in some cases, although that is certainly not recommended.
ELS versions are considered past EOL, and past Maintenance Support I & II. They will not be supported for new installs, will be out of compliance for PCI DSS, HIPPA, almost all third party vendor software, will not be certified on new hardware, etc. They are past their ten year lifecycle.
https://endoflife.software/operating-systems/linux/red-hat-e... https://access.redhat.com/support/policy/updates/errata/#Ext...
Of course the few people on RHEL 6 will have to use the additional --random-source option, but the amount of people that this affects is in the single percentage point, or less.
Nothing is stopping someone from spinning up RHEL 5 three years from now and running my original command.
My original statements and points stand true. You were originally wrong to think that shuf is cryptographically insecure. It's been cryptographically secure for quite a while now.
Limiting to only non-EOL and to only future timelines after November are your own chosen statement limitations, not mine.
My statement that the shuf default is insecure for certain versions is correct and I have provided specific examples. There may be other examples, but I only need one to establish truth.
End of life dates have no bearing on my statement. You seem to be trying to change my statement into something else so you can say it is incorrect.
You can narrow your own statements to only include versions and future timelines that you think are important, which is fine, but it doesn't help those who will still be using the affected versions for years to come. The ELS versions exist for a reason, which should be clear from the fact that Red Hat is a for-profit entity. There is a significant number of projects in areas such as industrial control, defense, and finance, that place a high value on stability and they want that extra timeline that extends far beyond end of life.
My statement was a Linux OS after 2013ish, which means RHEL 7 and Ubuntu 13.02. RHEL 6/5 are not from 2013 or later.
>My statement that the shuf default is insecure for certain versions is correct and I have provided specific examples. There may be other examples, but I only need one to establish truth.
There are certain default versions of the kernel, bash, etc. that are insecure for certain versions of Linux OS releases. Your statement is meaningless. You can go back in time and find an insecure version of a piece of software, that's almost always true, you established effectively nothing. Whether or not anyone is using that version is what's meaningful.
You might as well be warning people not to visit https://correcthorse.pw/ on the default Firefox that ships with RHEL 5 because it had insecure defaults.
>End of life dates have no bearing on my statement. You seem to be trying to change my statement into something else so you can say it is incorrect.
It does, as I stated and proved above. Everything you've said is pretty much incorrect, which is the problem.
>You can narrow your own statements to only include versions and future timelines that you think are important, which is fine, but it doesn't help those who will still be using the affected versions for years to come.
Effectively no one is going to use the impacted versions for years to come. I doubt there are any users reading this comment thread who use RHEL 6 for password generation.
>The ELS versions exist for a reason, which should be clear from the fact that Red Hat is a for-profit entity.
They exist for the same reason Windows will sell you support for Windows XP, even though that product is also EOL. Are you going to warn the .x% of users that are using Windows XP to not even connect to the Internet?
>There is a significant number of projects in areas such as industrial control, defense, and finance, that place a high value on stability and they want that extra timeline that extends far beyond end of life.
Finance definitely places a high value on being on supported versions. As a matter of fact, it's against PCI DSS to be on EOL products. They have entire audit and compliance teams to ensure they're not on EOL products.
Sure. The fact that more than 1% of Windows PCs still run XP suggests that additional warning is merited.
Please don't connect to the internet with Windows XP. It's not safe. Extended support ended in 2014.
no thanks.
62^12 = 1e21
10 000^5 = 1e20
The problem is you not using a word generator and instead relying in your invention, most of the people will use top 5000 words (5000^5 = 1e18), imagine you can even lock one of the words (a color maybe?).So this way of thinking might be good if you know what you are doing and use uppers and lowers and symbols, if not, it is actually a bad advice.
$ shuf --random-source=/dev/urandom -n6 /usr/share/dict/cracklib-small | paste -sd-
circulant-conjured-reigning-buzzed-awaiting-typifiesKeePassXC has a passphrase generator, although it doesn't use the Diceware list as far as I know. https://keepassxc.org/images/screenshots/linux/screen_006.pn...
EDIT: Love the simplicity of https://correcthorse.pw/, good work!
80% of my passwords are just line noise, because they live in a keepass database. 20% (workstation account logins, etc) are diceware.
It doesn't take long to type a wholly-memorized sentence.