Live data from Hacker News

SSH gets protection against side-channel attacks

undeadly.org

151–160 of 166 posts

Re: SSH gets protection against side-channel attacks

#151

Could password managers like 1Password (AgileBits Inc.) employ similar techniques? They seem to make very little effort in this regards. E.g. on 1Password, https://discussions.agilebits.com/discussion/101551/article-... .

This kind of mitigation really only makes sense on shared machines (such as servers). On a desktop OS, if an attacker is in a position to read memory from other processes, it's pretty much game over already. Browsers implement Spectre/Meltdown mitigation on desktop OSes because without that, JS could read secrets from other JS contexts executing in the same process. One of the mitigations is in fact to just segregate…

> On a desktop OS, if an attacker is in a position to read memory from other processes, it's pretty much game over already.

Not really. Password managers have access information to your other accounts in the cloud. Your desktop may not have your most valuable data.

Re: SSH gets protection against side-channel attacks

#152
post #21

Earlier quoted context omitted.

Could you point me to the relevant source code? Am highly interested to take a look at it during the weekend.

Closed source, write up would be here: https://info.varnish-software.com/blog/introducing-varnish-t...

No offense, I am genuinely curious, why would anyone use any closed source software for anything related to security after the Snowden revelations?

Re: SSH gets protection against side-channel attacks

#153
post #74
post #67

Earlier quoted context omitted.

I've tried implementing a couple of (toy) password managers over the years and dealing with private keys is genuinely complicated. Even something as trivial as making sure that the memory gets zeroed correctly when you discard the key is trickier than it seems. Compilers these days are very good at detecting "dummy" memsets to memory that's never read afterwards and optimize them away. You have to use some dirty tric…

> Compilers these days are very good at detecting "dummy" memsets to memory that's never read afterwards and optimize them away. You have to use some dirty tricks to get the compiler to do what you want (copious amounts of volatile helps). Or you can use explicit_bzero(), which is designed for that use case.

explicit_bzero or SecureZeroMemory are all insecure against those new sidechannel attacks we are talking about here. Only memset_s is.

You really need a mfence (full memory barrier), not just a compiler barrier, maybe even a clflush.

Re: SSH gets protection against side-channel attacks

#154
post #122
post #21

Earlier quoted context omitted.

Closed source, write up would be here: https://info.varnish-software.com/blog/introducing-varnish-t...

> Closed source Ah, so we'll just have to trust you that it's doing anything at all, then.

We have no problem sharing our codebase with customers, especially if there are concerns like this. Shoot me a msg if you are genuinely interested in anything you have read.

Re: SSH gets protection against side-channel attacks

#155
post #90

Earlier quoted context omitted.

by explicitly clearing it when an operation is finished. example: https://github.com/andy-goryachev/PasswordSafe/blob/master/s... byte[] key = generateKey(); try { // sensitive operation } finally { Crypto.zero(key); } once the operation finishes, the memory is cleared (and possibly subject to gc) the problem is that some java classes, for instance BigInteger, are not designed for cryptographic operations - it's unde…

In that code, after generateKey, during the sensitive operation, the system might need to do a garbage collection, at which point this array might have been copied to a different location in memory before your call to zero. You have to also "pin" (afaik this is the usual terminology for this) that array to a fixed location (which would then have to be a feature of that runtime and garbage collector) after allocating…

Java also has no mfence or clflush support, so crypto.zero would never be secure. It might overwrite the key in the store buffer only, but not on the heap immediately, so prone to sidechannel attacks.

Re: SSH gets protection against side-channel attacks

#156
I've looked at it. There's still a spectre window of opportunity to get the shielded private host keys.

sshkey_shield_private => explicit_bzero() openbsd-compat/freezero.c

https://github.com/openssh/openssh-portable/commit/4f7a56d5e...

It's only using the insecure freezero, which is using the insecure explicit_bzero. A simple compiler barrier only, no memory barrier. so it's unsafe against the advertised spectre/meltdown sidechannel attacks, the secrets are still in the caches.

Re: SSH gets protection against side-channel attacks

#158

RAM encryption for sensitive data is overlooked in so many applications, even "highly secure" applications like veracrypt [0] only recently started adding it. In my opinion server-applications of all sorts should encrypt their private keys by default; this makes cold-boot attacks and other memory-escape attacks so much harder, since now two totally unrelated memory chunks have to be combined in order to retrieve the…

libsodium has the sodium_mshield()/sodium_munshield(). For libhydrogen, storing a large prekey can be a problem, so it may only be implemented on some platforms.

Re: SSH gets protection against side-channel attacks

#159
post #151

Earlier quoted context omitted.

This kind of mitigation really only makes sense on shared machines (such as servers). On a desktop OS, if an attacker is in a position to read memory from other processes, it's pretty much game over already. Browsers implement Spectre/Meltdown mitigation on desktop OSes because without that, JS could read secrets from other JS contexts executing in the same process. One of the mitigations is in fact to just segregate…

> On a desktop OS, if an attacker is in a position to read memory from other processes, it's pretty much game over already. Not really. Password managers have access information to your other accounts in the cloud. Your desktop may not have your most valuable data.

[deleted]

Re: SSH gets protection against side-channel attacks

#160

Earlier quoted context omitted.

Would you elaborate please?

The compiler will see that your operation does nothing and simply not do it.

What I mean was: do you know this to be the case for JVM 8 later? This is an interesting subject. Was there a study or a paper you can refer me to?
Post reply on HN