478 points · by padraic7a · 11y ago · 180 comments
RC4 is terribly broken and should be disabled. But the practical attack on RC4 requires many repetitions of the same plaintext --- "many" in the millions. This is a real threat to HTTPS/TLS, but not as much to RC4. Even hypothetical improvements to Fluhrer/McGrew would still require lots of repetitions. Disable RC4, but if you're playing along at home, this probably isn't it.
No serious cryptographer seems to believe that the NIST curves are backdoored. Avoid them if you can; they suck for other reasons.
MD5 is survivable in the HMAC construction.
There is a lot of inconsistent thinking behind the advice given in the article:
- Hard-to-implement NIST curves suck, whereas GCM and Poly1305 are recommended.
- NIST apparently sucks, but NSA-designed SHA-2 is recommended.
- MACs need 256-bit tags, so UMAC and not-NSA-designed RIPEMD160 is apparently not fine, but GCM/Poly1305's 128-bit tags are recommended. On this note, 256-bit tags are pointless when the rest of the crypto infrastructure is sitting on 128-bit security.
- 3DES is not recommended because DES is 'broken', not realizing that this break is due to small key length of the original DES; 3DES is deemed to be quite secure (but slow).
- 64-bit block size is enforced, but for no good reason: SSH's 32-bit sequence number, along with counter mode, renders block size worries moot.
DES (and by extension 3DES) isn't, per se, "insecure" at 56-bits except that technology has progressed from the mid-1970s such that an exhaustive search of the keyspace (e.g. brute force) is now practical in reasonable time. DES is resistant to differential analysis and even more modern techniques that could seriously reduce DES security are theoretical exercises at best (like those requiring terabytes of known plain-text to derive a key, or those only applicable to reduced-round implementations).
Yes, I'm aware that to a cryptographer, "theoretical attack possible" == "OMFG insecure cipher", and that attitude is a good thing. If DES was an AES candidate we'd never pick it. But from a practical standpoint, baring implementation mistakes or operational missteps, no one using known 2015 tech and technique is cracking 3DES before the heat death of the universe (or at least before we're long turned to dust).
That said, can you provide a reference to a practical (that is, not the linear cryptanalysis stuff from Davies) attack which reduces 3DES to 80-bits of effective security? If it's there, I missed it, and would invalidate what I've said.
I've always wondered this about DJB - he preaches the gospel of ease-of-implementation with Curve25519 and Salsa/Chacha20, but then for a MAC he has... Poly1305. I guess speed trumps everything?
That said, I think it's better to avoid them anyway just to give another hit to NIST/NSA. Plus, ChaCha20 and BLAKE2 have much better performance in software than AES and SHA2/SHA3 anyway, so I would like to see those adopted as default options instead.
No, it was designed by Joan Daemen and Vincent Rijmen, two Belgian academics.
It seems, from reading [2], that the NIST curves went out of their way to claim "verifiably random" generation....using unexplained seeds. The page says it's conceivable that the NIST curves have weaknesses that "were introduced deliberately by NSA."
I don't understand the math so it's likely I'm totally misunderstanding. But reading those pages, they seem to hint that the NIST curves might have some intentional flaws, and that it's suspicious that they generated curves that are susceptible to known problems.
1: http://safecurves.cr.yp.to/rigid.html 2: http://safecurves.cr.yp.to/bada55.html
it's not exactly clear (to me) why anyone who runs a project that so many ppl depend on for security would stick to such old and crufty algos. since openssh and openbsd are intertwined, it does make me wonder if this is being done so that openssh can run on the latest vax, etc (omg! but it will take a week for it to generate the right sized keys!).
EDIT: openssh in 2nd paragraph changed from openbsd, a typo.
If using a stronger cypher is enough to slow you down chances are that you're CPU bound anyway and adding compression on top is actually going to make your transfer slower.
What are those reasons?
Client keys? How many people use github, but don't want to enter a password on every push and aren't hardcore about setting up agents (esp. on Windows)?
https://www.yubico.com/products/yubikey-hardware/yubikey-neo...
It's basically a smartcard in the form factor of a nano-USB-stick. You can generate a pair of public/private SSH keys, with the private key remaining forever on the token.
Then setup gpg-agent in ssh-agent emulation mode (it's three lines in a file) and voila! you have hardware-backed authentication.
I'll probably write a HOWTO soon, but until then have a look at this:
http://forum.yubico.com/viewtopic.php?f=26&t=1171
It's unnecessarily complicated as described in the top post, but read the comments below, too. The real setup is dead simple - just a few lines in gpg-agent.conf and one of the .*profile files.
Just create the key and then try to use it. An OS X password dialog window will pop up. Enter the key password and check the box to save it. Done.
I encourage everyone to use encrypted keys on all platforms. You can set up the regular ssh-agent in git bash, and Atlassian's Source Tree can also use encrypted keys.
Ciphers none
MACs noneWhich makes me wonder: Is there anywhere a comprehensive comparison with tables that show which SSH clients (and servers) support which algorithms for key exchange, HMAC, etc.? That would help determining whom one is going to shut out by disabling which protocol, and thus help in making an informed decision on that.
Of course, to be really useful, such a table would also need to take into account which version of each listed software added support for which protocol -- as it is, the OpenSSH shipped in e.g. Mac OS X 10.8 (5.9p1) does not support curve25519-sha256@libssh.org which the OP recommends...
Sources: http://www.libssh2.org/ http://api.libssh.org/stable/ https://support.ssh.com/manuals/server-admin/44/Ciphers_and_... http://www.lysator.liu.se/~nisse/lsh/lsh.html
Git repository: https://github.com/fingolfin/ssh-comparison
Improvements are highly welcome; not just adding more clients, but also on refactoring the code, improving the UI (I suck at HTML), adding features... The TODO already lists some ideas.
Hardening SSH makes a lot of sense and this article provoked a lot of thought. But there's too much political rant and leaps of faith for my taste. I'd like to hear some hardening guidance with more fact, less vitriol.
This is the problem with trying to fight the NSA or some other over-inflated bogeyman. If you focus on weird edge cases you lose sight of practical security. I'd be more worried about opening myself to tor than some theorized attack on ssh ciphers.
Unfortunately, it seems network security has become fairly political, and if you don't make jabs at the NSA, while of course ignoring other state actors, then you won't be put on HN and reddit, which always welcomes politicized information at the cost of accuracy. I hope this hysteria is temporary and cooler heads will prevail and the Alex Jones listening crowd will stop holding the microphone.
Most of the attacks launched on Tor aren't in the "remote takeover of the tor server via memory corruption" category, they have (in recent history) mostly been in the form of:
* Attack firefox.exe in Tor Browser Bundle
* Control a lot of nodes, do something networky to discover the user's actual IP/location
What is the threat you anticipate will result from "opening yourself to Tor"?The internet?
However, it definitely increases the attack surface.
It reminds me of people who use things like ssh password lockouts. Why aren't you using keys or firewalling off to only IPs that need to connect. Or tacking on SSL here and there instead of using a proper VPN.
Security should lean towards simplicity and best practices, not towards a kitchen sink approach that might just make things worse for you via complexity and surface raising.
[0] http://www.daemonology.net/blog/2012-08-30-protecting-sshd-u...
This isn't a protocol weakness. Reading over the SSH RFCs, the server is allowed to specify which algorithms it supports, so this could easily be a OpenSSH configuration option.
We're told to discount 1024 bit exchanges because of "unknown attacks". If they're unknown, why are we determining that 2048 bits is safe? How do we know the attacks aren't specifically against some other aspect?
The guide talks about creating a newer stronger host key, but doesn't provide any information about preventing initial MITM there: ensuring you get the right host key on first connection is a major issue, and somebody trying to "make NSA analysts sad" ought to be explaining methods for ensuring that happens securely via host key CAs or similar tools.
Likewise, the suggestion for "Preventing key theft" is "ven with forward secrecy the secret keys must be kept secret. The NSA has a database of stolen keys - you do not want your key there.". No insight is provided on how to actually accomplish that.
This is certainly a way to turn off weaker ciphers and exchanges, but passing it off as a way to "make NSA analysts sad" is hyperbolic and runs the risk of people believing the hype.
Costs don't scale linearly. No math projection puts 2048 bit keys in reach. The thing that breaks 2048 bit RSA may well put RSA completely out of action, a reason to prefer alternatives to RSA over 4096-bit keys.
We are aware of the infrastructure to break 1024-bit discrete logs, and it's feasible; current projections put 2048 bit key safely out of reach for the time being, so we'll disable 1024 and leave 2048 enabled.
My concern there is with the talk of 'unknown attacks' and then providing suggestions based on that statement.
I'd wonder if a "CaaS" startup (Cracking as a service) would be feasible. Using amazon spot instances, it would require only as much funding as to serve the first ten users - and requiring each user to send the money to an escrow, e.g. a notary (in Germany, it's possible to deposit an amount at a notary, which gives the customer the assurance that without the private key, the company gets their money and the company has the assurance that the customer doesn't walk away with the keys and leaves the company with a 5-figure AWS bill).
So 1024 is run too fast to gather intel based on timing, but an imaginary 8192 bit key would run slowly enough to leak one random bit of key per session via timing analysis, as a physics-style thought experiment.
Not trying to claim out that longer keys are weaker in reality, but am trying to make the point that being impervious to timing analysis attacks might be kinda important. Or another way to phrase it is there's more ways to break a key than pure math or torture.
https://github.com/stribika/stribika.github.io
:P
You can encrypt the server key and only decrypt it into a loopback mount when you want to start sshd or accept a connection (I don't remember offhand if sshd reads it only once or at each connection), then unmount it. You get the same functionality as typing in your keystore password when you start apache or netscape or whatever web server (because you encrypt your https private keys too, right?). An untested poc:
# making the image
mkdir TMPFS
mount -t tmpfs -o size=4m tmpfs TMPFS
cd TMPFS
dd if=/dev/zero of=servkeys.img bs=1m count=2
mkfs.ext2 -F -m 0 -t ext2 servkeys.img
mkdir MOUNT
mount -t ext2 -o loop servkeys.img MOUNT
cp /etc/ssh/sshd_config MOUNT/
ssh-keygen -t rsa -b 4096 -f MOUNT/ssh_host_key
umount MOUNT
gpg -se servkeys.img
mv servkeys.img.gpg ..
cd ..
umount TMPFS
# running sshd
mount -t tmpfs -o size=4m tmpfs TMPFS
cd TMPFS
gpg -d ../servkeys.img.gpg > servkeys.img
mkdir MOUNT
mount -t ext2 -o loop servkeys.img MOUNT
sshd -f MOUNT/sshd_config -h MOUNT/ssh_host_key
umount MOUNT
cd ..
umount TMPFSBut it's even easier and faster to grab a key from RAM. Could just use a debugger or a handy tool like aeskeyfinder or...
https://github.com/mmozeiko/aes-finder
(or another handy tool like heartbleed ;))
HostKey /etc/ssh/ssh_host_rsa_key
You can also force this on the client-side in ~/.ssh/config: HostKeyAlgorithms ssh-rsa
See man pages for defaults.This project also hosts secure ciphersuite configurations for postfix, nginx, apache, GPG, etc.
CBC requires unpredictable IVs. CTR works with an integer starting at 0, so long as you never repeat.
The author's motive for not eliminating CTR was stated as compatibility. If you ask me, just use chacha20-poly1305 if you can. If you can't, there are probably more important problems for you to deal with (i.e. upgrading your legacy systems).
When you are reusing symmetric keys, both CBC and CTR require unique IV (as do all reasonable block cipher modes).
Contrast to: CBC requires unpredictable IVs.
and CTR works with an integer starting at 0, so long as you never repeat.
http://dictionary.reference.com/browse/unique?s=t&path=/http://dictionary.reference.com/browse/unpredictable?s=t&pat...
At no point did my statement make an error that was addressed by your reply.
That's as far as i can tell anyway. I'm not sure what to do when it comes to authentication however. I'm assuming that your supposed to be editing /etc/ssh_config/ however i don't know if i'm supposed to remote the '#' from any lines i'm editing? I also dont appear to have any files that i can find called ssh_host_rsa_key nor is there a 'HostKey' line in the ssh_config file.
Any help would be most appreciated!
Unable to negotiate a key exchange method
If I understand correctly the response from ssh -v -v, github.com only supports the following Kex protocols:ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
Edit: By trial and error, I find that this works for github.com:
KexAlgorithms diffie-hellman-group1-sha1
Here's the complete change log: https://github.com/stribika/stribika.github.io/commits/maste...
How does that work? The algo exchange is authenticated too.
You could possibly force a weaker DH kex I think, but there's no way to force e.g., rc4 with hmac-md5. Disabling group1 is a pretty big interop hit, though.
Use Homebrew [1] to install 6.6p1 with its bug fixes and enhancements:
brew install openssh --with-brewed-openssl --with-keychain-support
[1]http://brew.shReference: How to Update OpenSSH on Mac OS X at http://www.dctrwatson.com/2013/07/how-to-update-openssh-on-m...
FWIW, this is what I have in my config file on Mac.
Ciphers aes256-ctr,aes128-ctr
MACs hmac-sha2-512,hmac-sha2-256,hmac-sha1This will take a while so continue while it’s running."
First line has taken 6 hours on an ec2 t1.micro.
> Unfortunately, you can’t encrypt your server key and it must be always available, or else sshd won’t start. The only thing protecting it is OS access controls.
That should be solvable with systemd and fuse - create an encrypting filesystem with a fixed key obtained from an USB pendrive, which is then ejected (so it would need a reboot to be enumerated again), and have the filesystem limit open() calls to the key file. It should not need more than one read call when openssh starts.
If one wants to make it impossible for a "offline thief" (e.g. one that does not have permanent root-access to a compromised server) to make a man-in-the-middle using the server's key, one would have to store the ssh-server's key in a secure USB token. Ideally this token will count the number of ssh-signing and key-exchange operations so that an attacker remotely accessing the USB token might also be detectable.
The question is, is is possible to use the keys without having them in RAM any more?
To be fair, If it gets to the point where they are executing arbitrary code in the openssh process, your key is already compromised.
SELinux would help with most other causes of key leaks, however.
> The question is, is is possible to use the keys without having them in RAM any more?
In my (albeit limited) experience, no. Even if only because context switching would push the key out of the CPU registers and into RAM if it occurred at the wrong time.
Because if the fact would be known, the adversary will immediately cease to use this method of encryption, rendering the advantage of breaking the cipher void.
Everything I've heard so far points to the crypto being OK. That, so far, no special NSA crypto-defeating capabilities have come out. (Hence the NSA doodle with the smiley face on the links where Google removed TLS.)
Of course the NSA might have magic powers, but nothing in the last few years suggests that possibility any more than we'd have thought before.
They want everything.
Even if you're not a target you're of interest -- either as a vector to a target.(someone you know, regardless how many "hops") some thing you have (information, or equipment/infrastructure as a proxy or platform for attack)
Think of this example: you've ssh access coincidentally to a VPS on the same metal that coincidentally runs another VPS that belongs to a guy, who as a favour runs a totally separate server that hosts a "bad dude"(tm). Everybody in that chain and everybody connected to every one involved with the hardware are direct targets, all of their work colleagues are for the same reason.
Now extend that up and down every technological stack and industry and you'll see how capricious the notion is.
And if you're not a US citizen, you've no rights so who gives a shit? If you happen to be a US citizen, you've still no rights because the people targetting you will just be members of another Five Eyes organisation.
Oh, and even if this were like a possible scenario, why not just open random accounts until they strike gold? Or infiltrate the datacenter with a mind reading quad copter drone and plug a usb drive into your machine? I mean honestly, there's a 1000x easier ways to do this. The NSA isn't after your shit. Get over yourself and quit drinking the koolaid.
Given these are disclosures from their internal presentations, it's their koolaid that we're discussing.
The NSA's stated goal: Collect it all.
http://www.theguardian.com/commentisfree/2013/jul/15/crux-ns...
Or, there's the simpler explanation, like you're really fkin irrelevant in the grand scheme of things. Chances are, if they want your shit, they could just stop you for a traffic stop, incarcerate you, waterboard the shit out of you until you cried and gave up your 4096 bit RSA key so they could read your private journal about your sad paranoid life.
These fkin ERMMGH NSA TAKIN YER SHIT articles are really stupid.
Is this a valid reason to harden security of your machines? Yes, it is.
Maybe this person forgot about Heartbleed? Or that Debian bug that was around for years? Or Shellshock, dating back to 1989?
Stop pretending and assuming that just because software is open source that it is automatically reviewed.
Open source doesn't magically prevent bugs. But it does ensure that when a bug is found, you'll hear about it and get a well-vetted fix pretty quickly.