Live data from Hacker News

A sane SSH(1) key management example

try.popho.be

51–60 of 69 posts

Re: A sane SSH(1) key management example

#51
post #50

Earlier quoted context omitted.

Your description is very confusing, either I don't understand your explanation or you misunderstood. ForwardAgent is a decision for your client, so an attacker's change to some intermediate can't cause your client to set ForwardAgent. Lots of modern SSH users do not have ForwardAgent, at all, it's just not necessary for them, so an intermediate server doesn't have the opportunity to do anything with it. I also don't…

What I described there is a current, practical way to bypass subsequent presence checks in my particular security key (Google Titan NFC) which I tried out too. What you're talking about is that some hardware implementations might be lax about user presence checks which is true, but doesn't affect any particular user (e.g. me) if they know that their key doesn't allow logging in without it. > so we can't know whether…

No, it's not about a "vulnerability".

The FIDO Authenticator gets a request saying here's some parameters to sign, and most of it is much too high level for some cheap electronics to grasp (some of it is already just a SHA256 anyway, most of the rest can be just treated as bits with no particular meaning) but a handful of bitflags mean something to the authenticator. The authenticator must understand them, comply if able, and, if able and complying, set appropriate flags in the signed message.

The two we most care about today for end users are UP and UV. UP "User Present" means I checked there's a user present, e.g. I flashed an LED and somebody tapped the button. UV "User Verified" means I checked my owner is present, e.g. I have a fingerprint reader and the fingerprint matched.

Remember the main purpose people buy these things for is WebAuthn (the successor to U2F on web sites). For WebAuthn setting UP is always mandatory, your browser will, on every single request, set the UP flag, it always wants UP. It might set UV in some cases, but there aren't non-test public sites using this feature although it does exist in WebAuthn, it's obviously intended for the case where WebAuthn is both factors, e.g. something you have (the FIDO authenticator) and something you are (fingerprint to activate it)

Now, OpenSSH uses the same FIDO authenticators, but while Google is happy you are using the Google Titan NFC for this that's not why they made it. OpenSSH chooses not to set UP by default. A remote server (I think) can tell the SSH client hey, I need UP, get me UP or else you can't log in. But without that UP is not set in the signature request.

Most cheap authenticators today just ignore the UP flag in the request because it's easier to just assume it's always there since WebAuthn will always set UP. So even though OpenSSH actually says "No worries, I don't care if the user is present" these FIDO authenticators happen to require UP anyway, typically in the form of a touch sensor or hardware button. Since they're requiring UP I think they set the bitflag accordingly, if it was absent when required in WebAuthn you'd notice because nothing works

[The WebAuthn spec. calls out verifying this flag is present as one of the steps to validate a signed response]

You can definitely imagine a vendor focused on SSH ease-of-use would offer FIDO authenticators that care whether UP was requested and if it's not requested they don't need the extra press. For the vast majority of SSH users these products are more convenient, and if there's some case where they need UP the SSH protocol already can request that when you ask for it, so you should already be doing that if you want it, not relying on your device happening to do presence detection anyway.

I do not have a crystal ball. So that's why I can't tell if the present situation (they tend to do UP anyway because it was easier) is also what the future looks like.

Re: A sane SSH(1) key management example

#52
post #50

Earlier quoted context omitted.

What I described there is a current, practical way to bypass subsequent presence checks in my particular security key (Google Titan NFC) which I tried out too. What you're talking about is that some hardware implementations might be lax about user presence checks which is true, but doesn't affect any particular user (e.g. me) if they know that their key doesn't allow logging in without it. > so we can't know whether…

No, it's not about a "vulnerability". The FIDO Authenticator gets a request saying here's some parameters to sign, and most of it is much too high level for some cheap electronics to grasp (some of it is already just a SHA256 anyway, most of the rest can be just treated as bits with no particular meaning) but a handful of bitflags mean something to the authenticator. The authenticator must understand them, comply if…

I don't know how do you imagine a typical 'SSH user' looks like, but no company is out there racing to disrupt that particular field. There won't be a security key provider that cares enough to follow WebAuthn spec, but then decides to be lax about SSH usage for user convenience.

EDIT: looked into it a bit more and it appears that truth is somewhere in the middle. I didn't test it, but it's possible that as long as every chain link is fine with it you can opt-out out of user presence check.

https://wiki.archlinux.org/title/SSH_keys#FIDO/U2F

https://man.archlinux.org/man/sshd.8#no-touch-required

You need to have a SSH server that agrees to it, SSH key that is specifically made for this use case and maybe a security key that allows it to proceed. Probably worth testing if I find the time for it.

Re: A sane SSH(1) key management example

#53
post #49

Earlier quoted context omitted.

> It won't send all the keys to the server if you organize this way (which doesn't really matter anyway, since they are PUBLIC KEYS). Having a public key doesn't teach an observer your private key, and so they can't impersonate you, but it does allow the observer to distinguish you from others. If you would like to prevent observers from correlating identity this way (most famously if you use a public key for GitHub…

> to distinguish you from others Yeah, that's a good point. The less information that is leaked, the better. > have overridden that to "Yes" previously and then forgotten. Another good point. I have this at the start of my macOS config: Host * IdentitiesOnly Yes UseKeychain Yes Edit: Uh oh, I think I misunderstood something! I'm still seeing nonexisting identify files being tried: % ssh -v whoami.filippo.io OpenSSH_8…

That’s because you have your SSH client config having to try them all.

Re: A sane SSH(1) key management example

#54
post #3

> How would you look at someone using a single key for their car, house, safe, work place, and so on? This is a terrible analogy, and I don't see any other justification for this setup. An SSH "key" is also referred to as an "identity". Contrary to a car key, it is not tied to the car, but to the client's identity. It is more like a badge than a brass key. A car key has the limitation that your lock can only accept o…

It's a great analogy, for many people. The distinction between treating SSH keys more like keys, or more like a badge, is heavily milieu dependent.

[deleted]

Re: A sane SSH(1) key management example

#55
post #52

Earlier quoted context omitted.

No, it's not about a "vulnerability". The FIDO Authenticator gets a request saying here's some parameters to sign, and most of it is much too high level for some cheap electronics to grasp (some of it is already just a SHA256 anyway, most of the rest can be just treated as bits with no particular meaning) but a handful of bitflags mean something to the authenticator. The authenticator must understand them, comply if…

I don't know how do you imagine a typical 'SSH user' looks like, but no company is out there racing to disrupt that particular field. There won't be a security key provider that cares enough to follow WebAuthn spec, but then decides to be lax about SSH usage for user convenience. EDIT: looked into it a bit more and it appears that truth is somewhere in the middle. I didn't test it, but it's possible that as long as e…

I was about to react to the version before the edit, but fortunately the edit was there when I hit reply, so, yes, exactly the thing you've found out.

Re: A sane SSH(1) key management example

#56

> It’s common knowledge that you shouldn’t put all your eggs in the same basket, but most of the time on IRC or on reddit (or the Internet at large, really), I see people using one single ssh key for all uses. How would you look at someone using a single key for their car, house, safe, work place, and so on? a bit envious tbh. I would be so annoyed if we would get a key fob for every door at work instead of one key f…

Yeah, I would entirely love it if I could use the same key for everything I have that takes a key. That'd be great. As it is I just don't bother with keys for, like, back doors to my house and such. They're in a drawer somewhere and never get used. I just can't enter those doors from outside, if they're locked. One key (well, I mean, I'd want copies of it) for everything would be excellent. Terrible analogy because I…

You know, there are master key systems that do exactly this: you can have a master key that opens everything and special keys for just one of the locks. There are even grandmaster systems with some locks opening subsets of locks. I'm personally a huge fan of a certain Finnish manufacturer but there are many others. You can't usually put one of those compatible cylinders into you car, usually, and there are other limitations, but, still, even just for doors and lockers it's a great thing to have. Also, usually, those expensive cylinders are reprogrammable in case of a compromise and there are other security features (keys being impossible to copy is the one I like most).

Re: A sane SSH(1) key management example

#58
post #49

Earlier quoted context omitted.

> to distinguish you from others Yeah, that's a good point. The less information that is leaked, the better. > have overridden that to "Yes" previously and then forgotten. Another good point. I have this at the start of my macOS config: Host * IdentitiesOnly Yes UseKeychain Yes Edit: Uh oh, I think I misunderstood something! I'm still seeing nonexisting identify files being tried: % ssh -v whoami.filippo.io OpenSSH_8…

That’s because you have your SSH client config having to try them all.

But I have IdentityOnly: Yes for all hosts. Shouldn't that prevent it?

Re: A sane SSH(1) key management example

#59
post #26

Earlier quoted context omitted.

> invalidate old ones This one is non-trivial in SSH land (unless you go with a CA approach, of course). Lots of authorized_keys files strewn about everywhere...

If you distribute a key revocation list to your servers, it will override anything in anyone's authorized_keys file (on that server of course). Even with a CA approach (unless the expirations are sufficiently short) you will need to do something like this.

Yes, but if you're distributing revocation lists you might as well distribute new authorized_keys files?

Or wait, maybe I'm misremembering... does sshd support querying remote revocation lists? If so, point conceded. You still have to have to worry about the scenario of DoS or similar preventing it from fetching new lists. (I don't trust revocation beyond as being a QoI thing.)

I do favor the CA approach with e.g. 24hr expiry just because it's 'fail safely by default'. Of course one should ideally use much more frequent renewal, but OpenSSH has its limits wrt. that. (Kerberos seems saner in terms of results, just not in practice because it is/was so obnoxious to set up.)

Re: A sane SSH(1) key management example

#60
post #58

Earlier quoted context omitted.

That’s because you have your SSH client config having to try them all.

But I have IdentityOnly: Yes for all hosts. Shouldn't that prevent it?

It appears that it's not so much attempting alternative identities as it's trying (potentially nonexistent) keys for different ciphers.
Post reply on HN