r/programming • u/ScottContini • Apr 20 '22
Java ECDSA Signature Trivial Security Bypass (upgrade now if you are vulnerable)
https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/8
u/josephblade Apr 20 '22
Here's me on java 11 laughing :)
I'll wait for java 17 (LTS) to be mature enough before updating. Maybe another few years before most issues have been found.
Anyone following so closely on oracles push-push-push release scheme is going to have trouble. If you look at their free updates, it is until the next version comes out (which again will only have half a year of free updates). It's basically a scheme to get you to buy their paid support package (since free support is 6 months on a java version). The only option you have with the oracle jdk is to update.
This puts you at risk of new untested features coming in just because you need a patch for an existing feature. Not all features are visible or are in new libraries. You'll be building on quicksand.
long term support is what you generally need if you run anything as a business. Stability and continuity.
11
u/mine49er Apr 20 '22
Update: the official announcement from Oracle also lists older versions of Java, including 7 and 8 [and 11]. Although I’m not aware of the bug impacting those older implementations they did fix a similar bug in the (non-EC) DSA implementation at the same time, so it’s possible older versions are also impacted. There are also other security vulnerabilities reported in the same CPU, so (as always) it is worth upgrading even if you are running an older Java version.
https://www.oracle.com/security-alerts/cpuapr2022.html#AppendixJAVA
1
u/josephblade Apr 20 '22
:) yeah that's a fair point. As the maintenance release comes out (again from the LTS version) our devops will be rolling it out I would assume.
1
u/sigzero Apr 20 '22
This specific bug hit in Java 15. There are other bugs in the advisory as well.
2
u/bik1230 Apr 20 '22
Alternatively, use the newest Java to get the latest features, but use third party libraries developed by people who know what they're doing, instead of the built in stuff.
1
u/Uristqwerty Apr 20 '22
Every bug starts life as a side effect of a feature (some indirectly, such as a bug in a bugfix to an exploit mitigation born from a well-intended feature). The value of LTS releases is so rarely acknowledged.
-25
Apr 20 '22
lol java is quickly becoming the worst of php and javascript combined.
How anyone can continue to use that horrendous legacy language full of security vulnerabilities is beyond me.
3
u/ScottContini Apr 21 '22
As one who does application security for a living, I can confirm that the number of vulnerabilities in Java is a lot more than I see in .Net and other languages. It's both the Java language and Java open source libraries with the same problems: features over security, insecure defaults, lack of documentation about security, and generally a lack of security review of new features.
In the old days, it was Microsoft that was the laughing stock of the security world. Not any more. Microsoft takes security very seriously and .Net is a great example of that. They have secure defaults, excellent documentation, and excellent examples telling people how to do things the right way. The world of Java is so much different: here is a feature, figure it out yourself how to do it securely. While the present bug is not like that -- it was an inherent mistake in the ECDSA implementation that any halfway knowledgeable cryptographer would have spotted, most of the other problems we see with Java are as I describe above.
3
u/yawkat Apr 21 '22
I won't draw general conclusions, but agree at least for cryptography. The java crypto apis are amazingly hard to use, have no secure-by-default high-level apis, and make no effort to stop users from making mistakes. The documentation ecosystem is also bad, and most of the code you'll find on stackoverflow or other example sites is probably deficient in one way or another. It's a sad state of affairs.
2
u/ScottContini Apr 21 '22
The java crypto apis are amazingly hard to use, have no secure-by-default high-level apis, and make no effort to stop users from making mistakes. The documentation ecosystem is also bad, and most of the code you'll find on stackoverflow or other example sites is probably deficient in one way or another.
Yep, I've said that similarly many times, but people get sensitive when you say Java is not secure. Examples:
(1) Top 10 Developer Crypto Mistakes: "Many of the problems are due to complex crypto APIs that are insecure by default and have have poor documentation. Java is the biggest offender here, but it does not stand alone. Perhaps Java should learn from its archenemy, .Net, on how to build a crypto API that is easier to use and less prone to security problems."
(2) If you copied any of these popular StackOverflow encryption code snippets, then you coded it wrong: several examples of what can go wrong in Java because of its complexity.
(3) No, Java is not a Secure Programming Language -- this got voted down to all hell because of the sensitivity around Java security, but to quote my complaint about Java crypto: "Sensitive data exposure, and my issue here is specifically about cryptography. As a former cryptographic researcher, I hold this one dear to my heart. Where to start here? Well, let’s look at the warning in bold at the end of the JCA introduction (see screenshot below). Yep, Java is not here to help you, go get your PhD in crypto and you’re on your own (and don’t copy the insecure examples they have in their documentation!).... The Java developer crypto problem is well documented in academia as well, including in mobile applications."
16
u/zynasis Apr 20 '22
Dodged a bullet still being stuck on Java 8