TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Passive SSH Key Compromise via Lattices [pdf]

98 pointsby Animuxover 1 year ago

9 comments

hannobover 1 year ago
To give some easier explanation: This is an attack against faulty RSA implementations. There is a common optimization in RSA signature implementations that splits up an expensive mathematical operation into two smaller operations. If one of these throws out a bad result then you can break the key.<p>Why does this happen? Multiple reasons. Implementations of big number math can and does contain bugs. (I used to hunt for those via fuzzing, which turned up an amazing number of them.) Hardware failures. Other bugs that corrupt numbers in memory.<p>The basic attack is well known. Florian Weimer has demonstrated this against TLS in the wild: <a href="https:&#x2F;&#x2F;www.redhat.com&#x2F;en&#x2F;blog&#x2F;factoring-rsa-keys-tls-perfect-forward-secrecy" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.redhat.com&#x2F;en&#x2F;blog&#x2F;factoring-rsa-keys-tls-perfec...</a><p>The new thing this paper adds is applying this attack to SSH.<p>There is a countermeasure against this attack, and this is to verify the signature before revealing it. It works. As the paper says, openssh uses openssl&#x27;s RSA implementation, and it has been doing that since forever (2001).<p>So in summary: Applying a well-known attack against RSA to its use in SSH. Only works if you have an RSA implementation that outputs results of flawed computations. Countermeasures exist, and RSA implementations should use them.
评论 #38162404 未加载
评论 #38164273 未加载
评论 #38166259 未加载
评论 #38174363 未加载
magicalhippoover 1 year ago
<i>RSA digital signatures can reveal a signer’s secret key if a computational or hardware fault occurs during signing with an unprotected implementation using the Chinese Remainder Theorem and a deterministic padding scheme like PKCS#1 v1.5.</i> <i>[...] In this context, a passive adversary can quietly monitor legitimate connections without risking detection until they observe a faulty signature that exposes the private key. The attacker can then actively and undetectably impersonate the compromised host to intercept sensitive data.</i><p>And they say crypto is hard, sheesh...<p>Seriously though, almost every time I hear about some new (to me) attack, I get amazed at the ingenuity of people.
评论 #38161600 未加载
评论 #38161456 未加载
peraover 1 year ago
&gt; <i>We also carry out a retrospective analysis of historical SSH scan data collected over the course of seven years, and find that these invalid signatures and vulnerable devices are surprisingly common over time.</i><p>&gt; <i>Our combined dataset of around 5.2 billion SSH records contained more than 590,000 invalid RSA signatures.</i><p>Am I reading this right? This is about 1 in 10_000, this is <i>way</i> more common that what I would have imagined
评论 #38161840 未加载
fguerrazover 1 year ago
So the vast majority of servers is not at risk because OpenSSH is not vulnerable to these attacks?
评论 #38163130 未加载
tptacekover 1 year ago
Headlines:<p>* In (rare) vulnerable targets, this allows you to recover the host&#x27;s key, and thus impersonate a host. You can&#x27;t compromise client credentials with this attack, since client credentials are exchanged after the (active) secure channel is established. If you can impersonate a host, as this attack would allow you to do, you could capture client password credentials, and you can drive a forwarded agent.<p>* OpenSSH --- really, SSH servers on any Unix host you&#x27;ve been using in the last 20 years --- isn&#x27;t vulnerable to this attack. The vulnerability is publishing a signature that is validly signed under RSA p and not under RSA q. Solution: just never do that; when you generate the signature, check it yourself before publishing. This is one of the better-known attacks on RSA, so this is a standard implementation countermeasure.<p>* The things that are vulnerable are crappy middleboxes from Zyxel, Mocana, apparently a rare subset of Cisco devices, and whatever &quot;SSH-2.0-SSHD&quot; is (the authors don&#x27;t know either).<p>* This is a Nadia Heninger paper, and Heninger is, like, the modern master of the Coppersmith RSA attack, which transforms an RSA problem into a series of polynomials and then transforms those into a linear algebra problem set in a lattice (roughly: a vector space with exclusively integer components; really, when we say &quot;lattice&quot; we mean &quot;some generated basis for that lattice&quot;). You then use the LLL algorithm to reduce the basis, which gives you small vectors that, when reframed back into polynomials or whatever, can tractably solved for their roots. Get the intuition? Yeah, I mean, me neither. Lattice attacks on PQ crypto have a simpler intuition! But the lattices bases here are just R^3 matrices, so, that&#x27;s pretty simple.<p>* You can get the intuition for the underlying vulnerability much more simply. From the paper: <i>Boneh, DeMillo, and Lipton noted that if an attacker had a correct signature s and an incorrect signature s_hat of this form then the attacker could compute gcd(N, s_hat − s) = p.</i> The complicated math comes from the fact that while we have the incorrect signature we&#x27;re hoping for, we don&#x27;t have the correct signature over the same message, or a fully known message.<p>* This attack is made possible by our old friend PKCSv1.5, this time in a signing setting. It works because a P1v1.5 RSA signature has regular format: 00 01 FF ... FF 00 aa .. aa hh .. hh, where aa are the (known) bits of the ASN.1 identifier of the hash, and hh are the (unknown) bits of the hash. Everything but the bit values of hh is known to the attacker.<p>* Amusing detail: the attack relies on a condition of the unknown bits being less than 1&#x2F;4 of the RSA message (modulus) size, so the attack actually gets harder for RSA-1024 with better hashes, and is impossible for RSA-1024 with SHA2-512, which blows that budget.<p>* Another thing that uses PKCSv1.5-RSA signatures is DNSSEC. You could scan the Internet collecting DNSSEC signatures hoping to find some that don&#x27;t validate (I think it&#x27;s RIPE that periodically does surveys looking for invalid DNSSEC records, and routinely finding them?), and because all RSA DNSSEC is in viable parameters for this attack I guess recover keys from it? Or you could just not use DNSSEC. I guess maybe this is particularly problematic for &quot;online-signers&quot;; most DNSSEC signatures are computed offline, so you can&#x27;t just repeatedly ask for new signatures waiting for a fault, but you could with an online signer.
评论 #38164123 未加载
评论 #38175776 未加载
dist-epochover 1 year ago
Can you use row-hammer to force the bit flips to speed up this attack?
tux3over 1 year ago
I wonder if I can use this against Intel SGX&#x2F;AMD SEV-SNP :)<p>These are hardware features where a private key is hardcoded in the chip and never supposed to be revealed. You can ask the chip to sign things for you. It has some anti-tampering measures, but it might be possible to induce faults without too much effort, if you apply heat, EM (&quot;cosmic rays&quot;), and play with voltage&#x2F;frequency a little
评论 #38162238 未加载
fergieover 1 year ago
Can anybody ELI5?
评论 #38161415 未加载
评论 #38161341 未加载
kragenover 1 year ago
i read the title and thought &#x27;that sounds like nadia heninger&#x27;<p>i wasn&#x27;t wrong