490 points · by benjojo12 · 11y ago · 177 comments
As the article says, GitHub could be being proactive rather than reactive here. They don't "have" to, but they could.
> Thanks to our new servers, known bad keys[2] from Debian and Ubuntu are now blacklisted. We estimate that about 1000 keys in our database were impacted by this. If you get authentication errors using keys that worked a day ago, please double-check that they are not on our blacklist. If they are, you should ensure your software is updated and generate new keys. We’ve got a guide to help you out with this.
[1] https://github.com/blog/500-state-of-the-hub-rackspace-day-0
[2] https://github.com/blog/63-ssh-keys-generated-on-debian-ubun...
The answers were yes and no. It's the same for most systems right now. You can put a weak Debian key in authorised keys, but you won't be able to login anyway.
If you want to check how many bits your key is, use
ssh-keygen -l -f ~/.ssh/your_key.pub
(It wasn't mine, while it is an older key, mine is larger than 768 thankfully)
Edit: look at timdorr's example for a better visual.
ssh-keygen -l -f ~/.ssh/id_rsa.pub
You'll get an output like so: ⚡~ $ ssh-keygen -l -f ~/.ssh/id_rsa.pub
2048 f6:2d:94:54:c0:96:18:64:24:fb:c2:ad:ed:6a:1d:68 timdorr@Pixelicious.local (RSA) for file in $(ls ~/.ssh/*.pub); do ssh-keygen -lf $file; done find ~/.ssh -name '*.pub' | xargs ssh-keygen -lf
Here's a simple bash function to check all your GitHub keys: function check_github_keys {
username=$1
i=0
curl -sw "\n" "https://github.com/${username}.keys" | while IFS="\n" read -r line ; do
tmp=`mktemp -t githubkey`;
echo "$line" > $tmp
res=$(ssh-keygen -lf $tmp)
rm $tmp
((i=i+1))
echo "${username}.keys:${i} ${res/ $tmp/}"
done
}
Invoke as: check_github_keys <username>
I'm sure there's a better way to write that one though! ssh-add -l
to list all your registered keys. 4096 63:f2:23:00:c9:0d:07:3b:6d:ad:4d:a9:98:32:f5:25 ***@*** (RSA)
Am I good?is this something we should be upgrading (like to 4096) in the near future?
- 180x per doubling bit size would be - 512 doubled twice, would mean 3 days * 180 * 180 = 97,200 days
I think you're safe.
Is there outdated ssh keygen software out there that still generates sub-768 keys?
It was a key generated and used as a test (years ago). It has never been used to access my Github account. Also, my account is pretty bare as it is.
To be safe, though, I have now removed the key.
IIRC PuTTYGen had a bug in it for a very long time that you would ask for a 1024 key, and it would subtract a bit off it. You can see the same with 2047 keys in the data that I will be publishing on the next post.
Or perhaps someone has a system that generates keys automatically, and it was poorly configured.
Even then, generating such key with OpenSSH was not something one could do by accident.
Public Keys are supposed to be public. It's OK not to know that, but blaming Github for doing crypto right is not really clever...
If you don't want your public key to be traced back to you, generate a new pair just for github.
So github is doing crypto right by unnecessarily exposing data that is _only_ relevant to a) the user and b) his personal access to his repos?
By this logic, why not make crypto even better and add something like github.com/user.address, github.com/user.mail or github.com/user.phone?
public keys are essentially opaque tokens that do nothing more than ensuring that a counterpart of a connection is whoever you think is associated with the public key. The key itself does not convey that information. It conveys no information at all beyond its cryptographic properties.
Turning a key into anything else (e.g. through re-use, publishing it elsewhere in association with other data) is not an intrinsic property of the key.
On the other hand personal data such as an address cannot be easily replaced like a key, immediately ties it to a person and does not provide any cryptographic properties at all.
TL;DR: pubkey is not private data, user.address is not crypto
From a healthy paranoid point of view: you don't share your public key unless you have to. Sure, there are no known attacks on strong RSA keys today, but that doesn't mean there will never be. Why take that risk with, literally, thousands of keys and people's security? It's rude at the very least.
Of course, you should never use your Github keys for anything else, but that's beside the point entirely.
As for the comments: key comments are useful but often contain information that can identify a person (e-mail address, username@machine etc). Publishing that would have been even worse.
I would say it encourages scrutiny. The assumption of public keys is that they are public, if any part of your security architecture relies on a public key being private then it would seem flawed, flaws that should be exposed.
And if them being public induces extra paranoia, such as using separate keys only for github then all the better.
Sunlight is the best disinfectant.
If your security model relies on public keys not being publicly known, then your security model can't reasonably be expected to work or be honored by GitHub.
Considering a public key as a "shared secret", as you're claiming it is, moves beyond "healthy paranoid" and into just "paranoid".
It's equivalent to uploading someones PGP key to a keyserver without his or her permission.
Makes me want to do a parody webpage explaining how to setup PGP by just copy/pasting one
In my uneducated opinion, that seems like a really good way to judge whether something qualifies as worthy of a bug bounty etc.
> <snip> and then a few more minutes to transform those back into a SSH key that I could log into systems with.
Hardly 'kudos' for them; the API to list public keys is listed by GitHub as 'accessible by anyone' in the documentation, it would be difficult to construe what they did as 'unauthorized' because of that.
https://developer.github.com/v3/users/keys/#list-public-keys...
https://bitbucket.org/site/master/issue/4222/no-support-for-...
I can't remember where half of mine have been saved. I should really revoke everything and start again, as I use it for accessing my VPS too.
How do you revoke all keys on Ubuntu and OS X?
For a revoking mechanism to be possible you would need a trusted third party (like a certificate authority) to verify the keys for each and every connection you make.
Does this mean GitHub finally supports Ed25519?
Defense in depth recommends having multiple layers of security, such that a breach of a single layer doesn't constitute a full breach. There's no requirement (and in fact I'd argue there's no solid recommendation) for including obscurity as one or more of the layers.
If I didn't have my public key on GitHub, it's unlikely that even that could fall into an attacker's hands. Not that I would rely on that assumption, but it would reduce my attack surface.
Now, of course the user can take some responsibility for not upgrading their key in 10 years, etc.
I don't see why it's, like, some moral obligation to invite factoring attacks just because of the name of the key and knee-jerk hatred for "obscurity."
Put another way, it makes sense to avoid pure obscurity when adding it takes extra work. In this case, GitHub is going out of their way to add theoretical weakness, but apparently we must do it, because security bible!
Edit: to be fair, there is the difference that GitHub has already added it and probably didn't have to write C code to do it. So maybe this feature should be requested for things like, say, cPanel, and users' $HOME/.ssh/authorized_keys should be world-readable by default. Still, maybe it's worth doing in OpenSSH so everyone can get the huge benefits of this currently only enjoyed by GitHub's users.
1. Duty of care - should never have accepted keys provably weak.
2. Poorly communicated that username.keys was available, thus many users may have thought their keys weren't at risk.
3. No countermeasures from crawlers mass collecting keys. (Not they they should even need to do this - they should just have done #1 in the first place!)
This isn't a game man, GitHub hosts a ton of the world's open source code and they're supposed to be experts in cryptography and security. Russian mobsters, NATO spooks, bitcoin drug cartels, and even high school script kiddies are all constantly trying shit and it impacts us all not just the people with weak keys. If python core gets backdoored I get backdoored, no matter how careful I am with the software I install.
1. Picking a small key is all on the user. It's like choosing the single letter 'a' as a password. If you want to do so why not?
2. The key you give to github is a "public" key. It is made to be public so this should be irrelevant.
3. There is 'almost' no known countermeasures against mass crawls of public keys. Look at the recent attacks: https://blog.hboeck.de/archives/872-About-the-supposed-facto...
What they could do: check against databases of public keys to see if your key is weakened by such attacks.
This is one of the reasons why should use different key pairs for different purposes.
What theory? I'm unaware of a current working theory that could be used to derive a private key from a public key of sufficient complexity.
In response to your #1:
Picking a password is all on the user too. But magically GitHub is competent enough to stop users from picking the password "ilovecake". Most users of GitHub are not security professionals. Just like most people opening a bank account are not bank vault security professionals.
Original:
They are downvoting me because they love / work at GitHub or don't understand how critical software security is. If you think about the physical life equivalent here (say a bank leaving keys out in the open for safe deposit boxes) there is no way to rationalize it. But all of a sudden it's our favorite social coding startup we can't actually call them out on a huge security fuck up. If this were Microsoft we'd be laughing.
That is definitely a good thing, but github wouldn't be responsible if they didn't do that and people chose weak passwords.
> If you think about the physical life equivalent here (say a bank leaving keys out in the open for safe deposit boxes) there is no way to rationalize it
No, it would be like a bank not actively looking for deposit box keys that customers may have dropped.
btw, I 100% think github should protect users from weak keys, I'm just disagreeing that they could somehow be sued for it