News for hackers. Stuff that matters.
Re:35-year-old vulnerability discovered in scp by Kovah on Tuesday January 15, 2019 @05:19AM (#18910096)
Could someone elaborate on how to find out the correct key of a host that was recently setup, like a new Digitalocean instance? Is there even a method?
Re:35-year-old vulnerability discovered in scp by detaro on Tuesday January 15, 2019 @05:26AM (#18910125)
You can provide a pregenerated key to the instance during setup, e.g. using cloud-init. Or supply it with a way to report its key once it is generated.

Or use out-of-band access, e.g. a host-provided console, to connect once and extract the key.

Re:35-year-old vulnerability discovered in scp by amelius on Tuesday January 15, 2019 @07:48AM (#18910759)
Ok, but shouldn't ssh require the user to type in the entire key then, rather than to type yes/no?
Re:35-year-old vulnerability discovered in scp by detaro on Tuesday January 15, 2019 @07:52AM (#18910781)
Why?/How does that relate to my answer? It'd make it harder to just accept a changed key instead of leaving the decision to the user, and would make use cases where the user doesn't want/need to authenticate the server harder (one can probably debate each scenario for that if the decision to not authenticate was "right"). Although I find it a bit weird there's not even an option to pass a host key to SSH instead of editing the KnownHosts file.
Re:35-year-old vulnerability discovered in scp by nothrabannosir on Tuesday January 15, 2019 @08:47AM (#18911066)
Yes, the SSH flow is completely broken and, therefore, in reality only really protects against passive snooping. I have never met a real human, in real life, who ever checked the host key on first connect.

For what it’s worth: The way to solve this is require the host key fingerprint as an argument to the ssh command, along with host and user. This would force people to look it up.

This is not a popular opinion, but I think it’s inescapable: SSH was not made for humans.

(This is purely a client issue, by the way. But at the end of the day: does that matter for anyone?)

(Edit: when this comes up people often mention key based auth. Unfortunately, that relies on nobody else having your public key. You can find mine anywhere, it used to be available through the GitHub api , even. It won’t let the attacker connect to the original server but they can definitely impersonate it. Perhaps get your key agent forwarded, and continue. Not great.)

Re:35-year-old vulnerability discovered in scp by aaronmdjones on Tuesday January 15, 2019 @12:42PM (#18913075)
No, the way to solve this is to use client public key authentication. Then a successful MITM will require the client's private key too.
Re:35-year-old vulnerability discovered in scp by nothrabannosir on Tuesday January 15, 2019 @01:29PM (#18913545)
No, it will only require the public key (which is public) to impersonate the server. It won’t be a MITM but it’s still bad; see e.g. the bug in this very article, or if (god forbid) you’ve set up agent forwarding. Or if you do e.g. a git pull from github on a fresh comp, it can serve you bad code.

Asymmetric key is not a solution to the problem of users blindly trusting hosts without checking the fingerprint. It’s a UI problem.

Every time I bring this up it gets shot down (e.g. now -3 votes), and every time I wait for someone to put forward an actual counter argument. Unfortunately, no luck.

SSH is broken and it needs fixing.

Re:35-year-old vulnerability discovered in scp by fwip on Tuesday January 15, 2019 @03:38PM (#18914891)
I'm not sure you know how public/private keys work.
Re:35-year-old vulnerability discovered in scp by nothrabannosir on Tuesday January 15, 2019 @04:57PM (#18915851)
This reply is tragicomically ironic :(

See it like this:

The bug is in the verification of the host, not the user. Eve can intercept a connection from Alice to Bob. It can "pretend" to be Bob, but it can't MITM (aka "proxy") because it won't be able to auth with Bob. However, auth depends on the server encrypting a message with Alice's public key, which everyone has ( https://github.com/torvalds.keys !), including Eve, so Alice will connect to Eve. Really this is nothing different from just connecting to a fresh host: you upload your public key to the remote ~/.ssh/authorized_keys somehow, and voila, right? How does your ssh client know that was the same server? The fingerprint. Did you check it? No.

Check out this article:

> The more well-discussed use of asymmetrical encryption with SSH comes from SSH key-based authentication. SSH key pairs can be used to authenticate a client to a server. The client creates a key pair and then uploads the public key to any remote server it wishes to access. This is placed in a file called authorized_keys within the ~/.ssh directory in the user account's home directory on the remote server.

> After the symmetrical encryption is established to secure communications between the server and client, the client must authenticate to be allowed access. The server can use the public key in this file to encrypt a challenge message to the client. If the client can prove that it was able to decrypt this message, it has demonstrated that it owns the associated private key. The server then can set up the environment for the client.

- https://www.digitalocean.com/community/tutorials/understandi...

As you can see, ssh public key auth authenticates the user, not the host. anyone could be that host.

Now: you as a human will quickly notice "where is my homedir? wait a second... this is not Bob—This is Eve!" the question is: quickly enough? If you were using scp: no, look at TFA. If you were connecting to github for the first time using git, perhaps using homebrew on a fresh machine: now you'll definitely never know. If you had set up your ssh key agent to forward keys to your "trusted" Bob host: serious trouble. There are loads of reasons why intercepting an SSH connection is a dramatic bug, even without being able to MITM it.

Or just try and turn it around: why do you think SSH prompts you to confirm the host key fingerprint, if it doesn't matter? For fun? They didn't add that as a joke.

Alas, few people understand this, as you so elegantly demonstrated :/

Re:35-year-old vulnerability discovered in scp by fwip on Tuesday January 15, 2019 @07:37PM (#18917220)
Your condescension is noted.

The host key fingerprint does matter. That's the host's public key. The host also has a private key. Without that private key, Bob can't pretend to be Eve.

You are correct that when connecting to Bob, if his public key doesn't match Eve's expected key, it will prompt the user to cancel the connection.

You argue: "It will only require the public key (which is public) to impersonate the server." The key piece here you are missing is that if Bob steals Eve's public key, he won't have a matching private key, and authentication will fail.

If you don't think the private keys are important, go edit them on your server, and see how SSH'ing in goes for you.

Re:35-year-old vulnerability discovered in scp by nothrabannosir on Tuesday January 15, 2019 @08:11PM (#18917405)
Eve is the bad guy, Bob is the intended party. Bob is not stealing keys, Eve is. Well, not "stealing", just obtaining public keys.

The attack is on Alice, who thinks she's connecting to Bob, but is actually connecting to Eve. This is on initial connect, and assuming Alice doesn't check the host fingerprint (which nobody does; that's the crux of my point).

This nomenclature is the convention when discussing cryptographic attacks: https://en.wikipedia.org/wiki/Alice_and_Bob

I'm going to stop discussing this in this thread, but feel free to contact me (info in profile). I promise to engage, in good faith, and if you do end up convincing me, I'll post an update here.

Best wishes.

Re:35-year-old vulnerability discovered in scp by fwip on Tuesday January 15, 2019 @09:34PM (#18917822)
Okay, swap Bob and Eve then.
Re:35-year-old vulnerability discovered in scp by Dylan16807 on Tuesday January 15, 2019 @11:16PM (#18918190)
Okay. "The attack is on Alice, who thinks she's connecting to Eve, but is actually connecting to Bob. Assuming Alice doesn't check the host fingerprint (which nobody does), the attack succeeds."

You're fundamentally misunderstanding the argument about which key is being copied. It's Alice's public key that's copied. The fake server generates its own public and private keys and nobody notices that it doesn't match the real server. The user won't be "prompted to cancel" when this is their first time connecting.

authorized_hosts, as typically used, prevents an imposter from showing up later. It does absolutely nothing to prevent an imposter that's there from the start.

Re:35-year-old vulnerability discovered in scp by jsiepkes on Tuesday January 15, 2019 @06:14AM (#18910321)
You can use SSHFP records in DNS. Clients like OpenSSH can be configured to retrieve and use those.
Re:35-year-old vulnerability discovered in scp by vthriller on Tuesday January 15, 2019 @06:19AM (#18910349)
Aaand we've returned to discussions about hacks designed to make DNS at least somewhat trustful.
Re:35-year-old vulnerability discovered in scp by eslaught on Tuesday January 15, 2019 @06:14AM (#18910324)
It gets printed to the console by default when you run cloud-init, and e.g. in AWS you can retrieve the console logs with an API call and grep for what you want.

I've got a script sitting around here somewhere which does this... Not necessarily in a state that's easy to reuse, of course.

Re:35-year-old vulnerability discovered in scp by __david__ on Tuesday January 15, 2019 @12:38PM (#18913043)
It doesn't work if your cloud init prints too much. AWS only holds a certain amount and the so the API call will truncate the output and lose the key (it shows you the tail and not the head of I remember correctly). Our organization has this problem (we run puppet in cloud init which spews like crazy).

I did notice recently that cloud init has an option to hot a web hook when it is complete and they have options in there to add the host key to the POST. But I wonder how to make a web hook that would be immune to spoofing…

Re:35-year-old vulnerability discovered in scp by tombrossman on Tuesday January 15, 2019 @09:00AM (#18911132)
Yes, it is probably in /etc/ssh/. What type of key depends on your distro and version, but here is a helpful explanation for Ubuntu: https://askubuntu.com/a/76388
Re:35-year-old vulnerability discovered in scp by tedunangst on Tuesday January 15, 2019 @05:26AM (#18910122)
Does your cloud dashboard not tell you? Last resort, login on console and look at it.