r/java • • Apr 20 '22

Java 15 introduced a cryptographic vulnerability

https://neilmadden.blog/2022/04/19/psychic-signatures-in-java/
202 Upvotes

30 comments sorted by

56

u/Areshian Apr 20 '22

That is a pretty serious one. It is good that 8 and 11 are not affected

17

u/CheesecakeDK Apr 20 '22

The article has been updated to say that they might be affected as well.

17

u/_INTER_ Apr 20 '22

The advisory notes affected versions:

Oracle Java SE: 7u331, 8u321, 11.0.14, 17.0.2, 18; Oracle GraalVM Enterprise Edition: 20.3.5, 21.3.1, 22.0.0.2

Curiously there is no mention of Java 15 and 16. Probably because they are not supported anymore.

11

u/Areshian Apr 20 '22

I don't know why Oracle has put the advisory with those versions, but the OpenJDK advisory clearly states this is a 15 and higher vulnerability (and the patch is present in only those versions):

https://openjdk.java.net/groups/vulnerability/advisories/2022-04-19

5

u/krzyk Apr 20 '22

Openjdk updated the list. So all recent versions since JDK 7.

2

u/Areshian Apr 20 '22

There are two vulnerabilities rated 7.5 (the other one is the update of Apache Santuario). For the ECDSA, I still see the OpenJDK advisory listing only 15+

0

u/pmarschall Apr 20 '22 edited Apr 21 '22

My understanding: OpenJDK isn't vulnerable but Oracle JDK is. Oracle JDK 11 forked from OpenJDK 11 when the maintenance went to the community, when JDK 12 was released. Likely Oracle back ported JDK-8237218.

** edit ** turns out I'm wrong

1

u/Areshian Apr 20 '22

Although Oracle source for 11 is private, their entries in the JBS database are not. If they had backported it we most likely should see a backport entry for 11.0.10-oracle (or the specific version), which we do not:

https://bugs.openjdk.java.net/browse/JDK-8237218

It’s not a 100% guarantee, but it makes it way less likely to be the case

1

u/pmarschall Apr 21 '22

I took one for the team and tested with Oracle 11.0.14+8-LTS-263 and it seems unaffected.

1

u/Areshian Apr 21 '22

I think Oracle is shooting themselves in the foot here. Sure, it doesn't sound great when you need to tell customers that they would've been safe if they didn't move to a newer version of Java, but still, a lot of people are going to freak out thinking they are affected

2

u/Areshian Apr 20 '22

They mention Oracle listed other versions in the advisory, although they are not aware of those versions being affected. I'm starting to believe the advisory might be doing more harm than good

1

u/Areshian Apr 22 '22

Oracle has updated the CVE entry: https://nvd.nist.gov/vuln/detail/CVE-2022-21449

Now it says: Supported versions that are affected are Oracle Java SE: 17.0.2 and 18; Oracle GraalVM Enterprise Edition: 21.3.1 and 22.0.0.2

So that seals the deal

13

u/veraxAlea Apr 20 '22

Looking at the example and reading Oracle's advisory for the CVE that says:

"This vulnerability applies to Java deployments, typically in clients running sandboxed Java Web Start applications or sandboxed Java applets, that load and run untrusted code (e.g., code that comes from the internet) and rely on the Java sandbox for security. This vulnerability can also be exploited by using APIs in the specified Component, e.g., through a web service which supplies data to the APIs."

Can someone explain how this affects me if I'm not using ForgeRock products, Java Web Start or applets.

Either Oracle is veeery lenient with their risk assesment, giving this a 7.5, or ForgeRock is overstating the severity of the issue.

0

u/[deleted] Apr 20 '22

[deleted]

9

u/veraxAlea Apr 20 '22

Yes, but whether or not I'm using ECDSA is fairly opaque. What if I'm connecting to a host over SSL/TLS? Isn't it up to the other host to determine the algorithm used to sign their certificate? Can anyone sign anything as "*.google.com" as long as I verify it with Java? That's a 10. Is this only applicable if the attacker can also plant arbitrary (untrusted) code on my machine? Thats not a 10 and 7.5 seem less absurd.

So I guess my question is "why is Oracle talking about JWS and applets?". That makes it sound like an attack is only possible if you run untrusted code.

2

u/Areshian Apr 20 '22

Even if you're connecting to a server that doesn't use ECDSA, this vulnerability can be used to achieve a MITM attack. Even if the "*.google.com" certificate were to be signed using RSA, I can present you with a forgery that uses ECDSA, and you will believe it is valid (I just need to find a CA that uses ECDSA signatures, as it is their signature the one I'll forge, plenty of those)

0

u/[deleted] Apr 20 '22

[deleted]

3

u/Areshian Apr 20 '22

As long as you have a CA that provides ECDSA signatures, you can exploit this for any domain. I don't care how the real certificate google uses looks like, I can forge one, signed by one of those ECDSA CAs, and use that one for the MITM attack.

1

u/veraxAlea Apr 21 '22

Wouldn't it then be considered to be a change in scope (in the risk matrix's column "Scope")?

If what you and others are saying is true, then I would say that Oracle are actively misleading in their advisory.

0

u/[deleted] Apr 21 '22

[deleted]

1

u/veraxAlea Apr 21 '22

This is great information, thanks!

I'm now more interested in how this vulnerability can be exploited without messing with the DNS-server of the component that you're attacking (the PoC needs access to the client's hosts file - or presumably the DNS server). This vulnerability is slightly less severe if you need to also gain access to the client's hosts file or DNS server/records to be able to exploit it (at least if you're trying to exploit it via TLS - JWT/SAML is still very much exploitable but there you're probably in control over the algos used).

4

u/[deleted] Apr 20 '22

Is there a patch for OpenJDK 17 or only the oracle JDK?

8

u/cogman10 Apr 20 '22

Here's the commit fixing it in master

https://github.com/openjdk/jdk/commit/e2f8ce9c3ff4518e070960bafa70ba780746aa5c

I'd verify it'd been backported 17 by the provider of your JDK, whoever that might be. You are looking for a JDK version > 17.0.3

1

u/[deleted] Apr 20 '22

Where would I find that? The OpenJDK website only has 17.0.2. will that go to the official website or will a third party org provide it?

5

u/cogman10 Apr 20 '22

It's going to be whoever is building your jdk that will give you that info.

So if you are pulling from jdk.java.net, you are SOL. They only do 6 month support and no LTS.

Likely very few builders will have this fix since it was merged and announced yesterday (Adoptium, for example, hasn't been built since Jan so they don't have it ATM).

4

u/Areshian Apr 20 '22

First, Oracle has changed their license, so 17.0.3 can be downloaded.

Second, multiple vendors get access to this patches ahead of time. Not Adoptium, because they just build the public repos, but companies that work on backporting these fixes to the different updates projects do. That is why you already have downloads for Zulu or Corretto with these fixes, and although I don’t see the public builds from Red Hat, they do get access to these fixes too

3

u/krzyk Apr 20 '22

It is already there, together with 18.0.1

2

u/__helix__ Apr 20 '22

The new version of Java 17 and all the other LTS versions should be showing up this week or next. Oracle released their updates yesterday. Watching for RHEL, Amazon, and Adoptium to drop.

1

u/[deleted] Apr 20 '22

How about for folks who aren't paying Oracle for support?

2

u/krzyk Apr 20 '22

You don't need support for Oracle JDK.

You can also get OpenJDK, they posted updated versions.

2

u/mikeblas Apr 20 '22

Where are r and s in that sample code? I guess they're part of that 64 byte all zeroes key ... which must then be some structure and not just 64 opaque bytes? Where can I learn the structure?

1

u/chabala Apr 21 '22 edited Apr 21 '22

I like how the suggested workarounds from Nov 2021 until yesterday were:

  • use JDK 8 or 11

  • use BouncyCastle

Right up my alley.

1

u/_AManHasNoName_ Apr 21 '22

And we just went through the log4J vulnerability fixes. :(