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.

Psychic Signatures in Java

309 pointsby 19870213about 3 years ago

16 comments

tptacekabout 3 years ago
This is probably the cryptography bug of the year. It&#x27;s easy to exploit and bypasses signature verification on anything using ECDSA in Java, including SAML and JWT (if you&#x27;re using ECDSA in either).<p>The bug is simple: like a lot of number-theoretic asymmetric cryptography, the core of ECDSA is algebra on large numbers modulo some prime. Algebra in this setting works for the most part like the algebra you learned in 9th grade; in particular, zero times any algebraic expression is zero. An ECDSA signature is a pair of large numbers (r, s) (r is the x-coordinate of a randomly selected curve point based on the infamous ECDSA nonce; s is the signature proof that combines x, the hash of the message, and the secret key). The bug is that Java 15+ ECDSA accepts (0, 0).<p>For the same bug in a simpler setting, just consider finite field Diffie Hellman, where we agree on a generator G and a prime P, Alice&#x27;s secret key is `a mod P` and her public key is `G^a mod P`; I do the same with B. Our shared secret is `A^b mod P` or `B^a mod P`. If Alice (or a MITM) sends 0 (or 0 mod P) in place of A, then they know what the result is regardless of anything else: it&#x27;s zero. The same bug recurs in SRP (which is sort of a flavor of DH) and protocols like it (but much worse, because Alice is proving that she knows a key and has an incentive to send zero).<p>The math in ECDSA is more convoluted but not much more; the kernel of ECDSA signature verification is extracting the `r` embedded into `s` and comparing it to the presented `r`; if `r` and `s` are both zero, that comparison will always pass.<p>It is much easier to mess up asymmetric cryptography than it is to mess up most conventional symmetric cryptography, which is a reason to avoid asymmetric cryptography when you don&#x27;t absolutely need it. This is a devastating bug that probably affects a lot of different stuff. Thoughts and prayers to the Java ecosystem!
评论 #31094705 未加载
评论 #31101716 未加载
评论 #31101484 未加载
评论 #31097450 未加载
tialaramexabout 3 years ago
This is the sort of dumb mistake that ought to get caught by unit testing. A junior, assigned the task of testing this feature, ought to see that in the cryptographic signature design these values are checked as not zero, try setting them to zero, and... watch it burn to the ground.<p>Except that, of course, people don&#x27;t actually do unit testing, they&#x27;re too busy.<p>Somebody is probably going to mention fuzz testing. But, if you&#x27;re &quot;too busy&quot; to even write the unit tests for the software you&#x27;re about to replace, you aren&#x27;t going to fuzz test it are you?
评论 #31101290 未加载
评论 #31097939 未加载
评论 #31119218 未加载
ptxabout 3 years ago
Apparently you have to get a new CPU to fix this Java vulnerability, or alternatively a new PSU.<p>(That is to say: a <i>Critical Patch Update</i> or a <i>Patch Set Update</i>. Did they really have to overload these TLAs?)
RandomBKabout 3 years ago
Does anyone know why this was only given a CVSS score of 7.5? Based on the description this sounds way worse, but Oracle only gave it a CVSS Confidentiality Score of &quot;None&quot;, which doesn&#x27;t sound right. Is there some mitigating factor that hasn&#x27;t been discussed?<p>In terms of OpenJDK 17 (latest LTS), the issue is patched in 17.0.3, which was release ~12h ago. Note that official OpenJDK docker images are still on 17.0.2 as of time of writing.
评论 #31097334 未加载
bertmanabout 3 years ago
The fix for OpenJDK (authored on Jan. 4th 22):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;openjdk&#x2F;jdk&#x2F;blob&#x2F;e2f8ce9c3ff4518e070960bafa70ba780746aa5c&#x2F;src&#x2F;jdk.crypto.ec&#x2F;share&#x2F;classes&#x2F;sun&#x2F;security&#x2F;ec&#x2F;ECDSAOperations.java#L225" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;openjdk&#x2F;jdk&#x2F;blob&#x2F;e2f8ce9c3ff4518e070960ba...</a>
评论 #31098015 未加载
评论 #31103854 未加载
评论 #31106850 未加载
vlowrianabout 3 years ago
What puzzles me most is that two days after the announcement of the vulnerability and the release of the patched Oracle JDK, there is still no patched version of OpenJDK for most distributions.<p>We&#x27;re running some production services on OpenJDK and CentOS and until now there are only two options to be safe: shutdown the services or change the crypto provider to BouncyCastle or something else.<p>The official OpenJDK project lists the planned release date of 17.0.3 as April 19th, still the latest available GA release is 17.0.2 (<a href="https:&#x2F;&#x2F;wiki.openjdk.java.net&#x2F;display&#x2F;JDKUpdates&#x2F;JDK+17u" rel="nofollow">https:&#x2F;&#x2F;wiki.openjdk.java.net&#x2F;display&#x2F;JDKUpdates&#x2F;JDK+17u</a>).<p>Adoptium have a large banner on their website and until now there is not a single patched release of OpenJDK available from them (<a href="https:&#x2F;&#x2F;github.com&#x2F;adoptium&#x2F;adoptium&#x2F;issues&#x2F;140" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adoptium&#x2F;adoptium&#x2F;issues&#x2F;140</a>).<p>There are no patched packages for CentOS, Debian or openSUSE.<p>The only available version of OpenJDK 17.0.3 I&#x27;ve seen until now seems to be the Archlinux package (<a href="https:&#x2F;&#x2F;archlinux.org&#x2F;packages&#x2F;extra&#x2F;x86_64&#x2F;jdk17-openjdk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;archlinux.org&#x2F;packages&#x2F;extra&#x2F;x86_64&#x2F;jdk17-openjdk&#x2F;</a>). They obviously have their own build.<p>How can it be that this is not more of an issue? I honestly don&#x27;t get how the release process of something as widely used as OpenJDK can take more than 2 days to provide binary packages for something already fixed in the code.<p>This shouldn&#x27;t be much more effort than letting the CI do its job.<p>Edit: Typo.
评论 #31108301 未加载
评论 #31113926 未加载
评论 #31112060 未加载
LaputanMachineabout 3 years ago
&gt;Just a basic cryptographic risk management principle that cryptography people get mad at me for saying (because it’s true) is: don’t use asymmetric cryptography unless you absolutely need it.<p>Is there any truth to this? Doesn&#x27;t basically all Internet traffic rely on the security of (correctly implemented) asymmetric cryptography?
评论 #31101447 未加载
评论 #31101658 未加载
评论 #31101234 未加载
评论 #31101330 未加载
评论 #31105823 未加载
评论 #31101840 未加载
dynamite-readyabout 3 years ago
Wonder if someone can add a little more info to the title of this story. It&#x27;s would probably draw more clicks if the title wasn&#x27;t so cryptic. This is essentially a Java dev infosec post.
评论 #31107305 未加载
danmurabout 3 years ago
It&#x27;s crazy that the check for this was right there in the original code and was obviously missed when porting to Java. Great example of why unit tests are part of the code (and were missing in both in this case).
stolsvikabout 3 years ago
The title of the blogpost is now updated to &quot;CVE-2022-21449: Psychic Signatures in Java&quot; - maybe this HN post could too?
评论 #31109891 未加载
ccbccccbbcccbbabout 3 years ago
Q: Which type of cryptography is implied to be unsafe in the following sentence?:<p>&quot;Immediately ditch RSA in favor of EC, for it is too hard to implement safely!&quot;
评论 #31102719 未加载
MrDresdenabout 3 years ago
Computerphile has released a very approachable explanation of the flaw[1], along with some basic background on ECDSA as well.<p>[1]: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=502iGDxuiRk" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=502iGDxuiRk</a>
lobsteyabout 3 years ago
I doubt how many companies are actually using java15+. Many still sticks to 8 or 11
plucabout 3 years ago
Not a good few months for Java
lobsteyabout 3 years ago
Not that a lot of companies are using the Java 15+. People generally stick to 8 or 11.
评论 #31103047 未加载
cesarbabout 3 years ago
And once again, you&#x27;d be saved if you stayed on an older release. This is the third time this has happened recently in the Java world: the Spring4Shell vulnerability only applies to Java 9 and later (that vulnerability depends on the existence of a method introduced by Java 9, since all older methods were properly blacklisted by Spring), and the Log4Shell vulnerability only applies to log4j 2.x (so if you stayed with log4j 1.x, and didn&#x27;t explicitly configure it to use a vulnerable appender, you were safe). What&#x27;s going on with Java?
评论 #31098117 未加载
评论 #31097945 未加载
评论 #31097567 未加载
评论 #31098516 未加载