| ▲ | jchw 4 days ago |
| I mean, we do TOFU for SSH server keys* and nobody really seems to bat an eye at that. Today if you want "insecure but encrypted" on the web the main way to go is self-signed which is both more annoying and less secure than TOFU for the same kind of use case. Admittedly, this is a little less concerning of an issue thanks to ACME providers. (But still annoying, especially for local development and intranet.) *I mistakenly wrote "certificate" here initially. Sorry. |
|
| ▲ | tptacek 4 days ago | parent | next [-] |
| SSH TOFU is also deeply problematic, which is why cattle fleet operators tend to use certificates and not piecewise SSH keys. |
| |
| ▲ | jchw 4 days ago | parent [-] | | I've made some critical mistakes in my argument here. I am definitely not referring to using SSH TOFU in a fleet. I'm talking about using SSH TOFU with long-lived machines, like your own personal computers, or individual long-running servers. Undoubtedly it is not best practice to lean on TOFU for good reason, but there are simply some lower stakes situations where engaging the CA system is a bit overkill. These are systems with few nodes (maybe just one) that have few users (maybe just one.) I have some services that I deploy that really only warrant a single node as HA is not a concern and they can easily run off a single box (modern cheap VPSes really don't sweat handling ~10-100 RPS of traffic.) For those, I pre-generate SSH server keys before deployment. I can easily verify the fingerprint in the excessively rare occasion it isn't already trusted. I am not a security expert, but I think this is sufficient at small scales. To be clear, there are a lot of obvious security problems with this: - It relies on me actually checking the fingerprint. - SSH keys are valid and trusted indefinitely, so it has to be rotated manually. - The bootstrap process inevitably involves the key being transmitted over the wire, which isn't as good as never having the key go over the wire, like you could do with CSRs. This is clearly not good enough for a service that needs high assurance against attackers, but I honestly think it's largely fine for a small to medium web server that serves some small community. Spinning up a CA setup for that feels like overkill. As for what I personally would do instead for a fleet of servers, personally I think I wouldn't use SSH at all. In professional environments it's been a long time since I've administered something that wasn't "cloud" and in most of those cloud environments SSH was simply not enabled or used, or if it was we were using an external authorization system that handled ephemeral keys itself. That said, here I'm just suggesting that I think there is a gap between insecure HTTP and secure HTTPS that is currently filled by self-signed certificates. I'm not suggesting we should replace HTTPS usage today with TOFU, but I am suggesting I see the value in a middle road between HTTP and HTTPS where you get encryption without a strong proof of what you're connecting to. In practice this is sometimes the best you can really get anyway: consider the somewhat common use case of a home router configuration page. I personally see the value in still encrypting this connection even if there is no way to actually ensure it is secure. Same for some other small scale local networking and intranet use cases. | | |
| ▲ | tptacek 4 days ago | parent [-] | | I don't understand any of this. If you want TOFU for TLS, just use self-signed certificates. That makes sense for your own internal stuff. For good reason, the browser vendors aren't going to let you do it for public resources, but that doesn't matter for your use case. | | |
| ▲ | jchw 4 days ago | parent [-] | | Self-signed certificates have a terrible UX and worse security; browsers won't remember the trusted certificate so you'd have to verify it each time if you wanted to verify it. In practice, this means that it's way easier to just use unencrypted HTTP, which is strictly worse in every way. I think that is suboptimal. | | |
| ▲ | tptacek 4 days ago | parent [-] | | Just add the self-signed certificate. It's literally a TOFU system. | | |
| ▲ | jchw 4 days ago | parent | next [-] | | But again, you then get (much) worse UX than plaintext HTTP, it won't even remember the certificate. The thing that makes TOFU work is that you at least only have to verify the certificate once. If you use a self-signed certificate, you have to allow it every session. A self-signed certificate has the benefit of being treated as a secure origin, but that's it. Sometimes you don't even care about that and just want the encryption. That's pretty much where this argument all comes from. | | |
| ▲ | tptacek 4 days ago | parent [-] | | Yes, it will. | | |
| ▲ | jchw 3 days ago | parent [-] | | I checked and you seem to be correct, at least for Firefox and Chromium. I tried using: https://self-signed.badssl.com/ and when I clicked "Accept the risk and continue", the certificate was added to Certificate Manager. I closed the browser, re-opened it, and it did not prompt again. I did the same thing in Chromium and it also worked, though I'm not sure if Chromium's are permanent or if they have a lifespan of any kind. I am absolutely 100% certain that it did not always work that way. I remember a time when Firefox had an option to permanently add an exception, but it was not the default. Either way, apologies for the misunderstanding. I genuinely did not realize that it worked this way, and it runs contrary to my previous experience dealing with self-signed certificates. To be honest, this mostly resolves the issues I've had with self-signed certificates for use cases where getting a valid certificate might be a pain. (I have instead been using ACME with DNS challenge for some cases, but I don't like broadcasting all of my internal domains to the CT log nor do I really want to manage a CA. In some cases it might be nice to not have a valid internet domain at all. So, this might just be a better alternative in some cases...) | | |
| ▲ | tptacek 3 days ago | parent [-] | | Every pentester that has ever used Burp (or, for the newcomers, mitmproxy) has solved this problem for themselves. My feeling is that this is not a new thing. |
|
|
| |
| ▲ | PhilipRoman 3 days ago | parent | prev [-] | | Not a TLS expert, but last time I checked, the support for limiting what domains a certificate is allowed to sign was questionable. I wouldn't want my router to be able to MITM any https connection just to be able to connect to it's web interface securely. |
|
|
|
|
|
|
| ▲ | arccy 4 days ago | parent | prev | next [-] |
| ssh server certificates should not be TOFU, the point of SSH certs is so you can trust the signing key. TOFU on ssh server keys... it's still bad, but less people are interested in intercepting ssh vs tls. |
| |
| ▲ | tptacek 4 days ago | parent | next [-] | | Intercepting and exploiting first-contact SSH sessions is a security conference sport. People definitely do it. | |
| ▲ | jchw 4 days ago | parent | prev [-] | | I just typed the wrong thing, fullstop. I meant to say server keys; fixed now. Also, I agree that TOFU in its own is certainly worse than having robust verification via the CA system. OTOH, SSH-style TOFU has some advantages over the CA system, too, at least without additional measures like HSTS and certificate pinning. If you are administering machines that you yourself set up, there is little reason to bother with anything more than TOFU because you'll cache the key shortly after the machine is set up and then get warned if a MITM is attempted. That, IMO, is the exact sort of argument in favor of having an "insecure but encrypted" sort of option for the web; small scale cases where you can just verify the key manually if you need to. |
|
|
| ▲ | pabs3 4 days ago | parent | prev | next [-] |
| You don't have to TOFU SSH server keys, there is a DNSSEC option, or you can transfer the keys via a secure path, or you can sign the keys with a CA. |
|
| ▲ | gruez 4 days ago | parent | prev | next [-] |
| >I mean, we do TOFU for SSH server certificates and nobody really seems to bat an eye at that. Mostly because ssh isn't something most people (eg. your aunt) uses, and unlike with https certificates, you're not connecting to a bunch of random servers on a regular basis. |
| |
| ▲ | jchw 4 days ago | parent [-] | | I'm not arguing for replacing existing uses of HTTPS here, just cases where you would today use self-signed certificates or plaintext. |
|
|
| ▲ | hedora 4 days ago | parent | prev [-] |
| TOFU is not less secure than using a certificate authority. Both defend against attackers the other cannot. In particular, the number of machines, companies and government agencies you have to trust in order to use a CA is much higher. |
| |
| ▲ | tptacek 4 days ago | parent [-] | | TOFU is less secure than using a trust anchor. | | |
| ▲ | hedora 4 days ago | parent [-] | | That’s only true if you operate the trust anchor (possible) and it’s not an attack vector (impossible). For example, TOFU where “first use” is a loopback ethernet cable between the two machines is stronger than a trust anchor. Alternatively, you could manually verify + pin certs after first use. | | |
| ▲ | tptacek 4 days ago | parent [-] | | There are a couple of these concepts --- TOFU (key continuity) is one, PAKEs are another, pinning a third --- that sort of float around and captivate people because they seem easy to reason about, but are (with the exception of Magic Wormhole) not all that useful in the real world. It'd be interesting to flesh out the complete list of them. The thing to think in comparing SSH to TLS is how frequent counterparty introductions are. New counterparties in SSH are relatively rare. Key continuity still needlessly exposes you to an grave attack in SSH, but really all cryptographic protocol attacks are rare compared to the simpler, more effective stuff like phishing, so it doesn't matter. New counterparties in TLS happen all the time; continuity doesn't make any sense there. | | |
| ▲ | hedora 3 days ago | parent [-] | | There are ~ 200 entries in my password manager. Maybe 25 are important. Pinning their certs would meaningfully reduce the transport layer attack surface for those accounts. | | |
| ▲ | tptacek 3 days ago | parent [-] | | Yes, these ideas bubble around because they all seem reasonable on their face. I was a major fan of pinning! |
|
|
|
|
|