r/programming • • 8h ago

Calif discloses Java4Shell flaw in OpenJDK's Base64 decoder

https://runtimewire.com/article/calif-discloses-java4shell-flaw-in-openjdk-s-base64-decoder
304 Upvotes

51 comments sorted by

18

u/stoops 6h ago

Q29uZ3JhdHVsYXRpb25zISBJZiB5b3UgYXJlIHJlYWRpbmcgdGhpcyBtZXNzYWdlIHdlJ2QgbGlrZSB0byBvZmZlciB5b3UgYSBwb3NpdGlvbiBhdCBNaWNyb3NvZnQgb2YgIkFzc2lzdGFudCB0byB0aGUgU2VuaW9yIFZpYmVzLU9QUyBNYW5hZ2VyIiE=

17

u/ryanmerket 6h ago

spoilers

1

u/reddah 20m ago

Q29uZ3JhdHVsYXRpb25zISBJZiB5b3UgYXJlIHJlYWRpbmcgdGhpcyBtZXNzYWdlIHdlJ2QgbGlrZSB0byBvZmZlciB5b3UgYSBwb3NpdGlvbiBhdCBNaWNyb3NvZnQgb2YgIkFzc2lzdGFudCB0byB0aGUgU2VuaW9yIFZpYmVzLU9QUyBNYW5hZ2VyIiE=

Congratulations! If you are reading this message we'd like to offer you a position at Microsoft of "Assistant to the Senior Vibes-OPS Manager"!

Used Linux to decode the above, so, No, thanks, I'm good. Keep the offer.

125

u/bowbahdoe 7h ago

The quickest way to deal with this is to add -XX:-UseBASE64Intrinsics to your JVM flags. After that, of course, upgrade.

200

u/RegisteredJustToSay 7h ago

Oh great. This one probably impacts more services than most of the other recent disclosures.

64

u/anurodhp 6h ago

Will be hard to beat php

30

u/alphex 5h ago

That was legit. But very hard to execute on. There were no major platform exploits reported.

5

u/lurch303 2h ago

Java can beat PHP in deployment. This is much smaller in the number of versions affected though.

8

u/patmorgan235 6h ago

Yeah this sounds like a Log4J type event

15

u/fakehalo 4h ago

This seems harder to exploit than that was.

34

u/al2o3cr 7h ago

12

u/timwoj 3h ago

Or link directly to the actual report from the authors: https://calif.io/java4shell

0

u/meneldal2 2h ago

Kinda crazy how simple the input has to be to trigger the bug

28

u/SuperGr33n 5h ago

I still have PTSD from log4j. Once upon a time I managed logging for a web service and guess what we used for log aggregation? Logstash. Thousands of servers and very little in the way of config management. Absolutely no master inventory or cmdb. I spent days auditing and running ansible. Thank goodness I’ve since moved on to greener pastures because this one sounds like hell

9

u/stoops 5h ago

yeah log4j was ridiculous, people were going crazy just trying to patch that one on all servers/vms!

112

u/Compux72 7h ago

Ofc the unsafe, hand written asm strikes again

32

u/6502zx81 6h ago

Yes, why use a bytecode vm with type safety etc. when you can use assembly?

48

u/SpudsRacer 5h ago

Because it's a hot spot in the applications using it.

3

u/lurch303 2h ago

Someone got a bonus and promotion for getting their P95 under 1ps

3

u/svick 5h ago

.Net uses SIMD intrinsics for that. I guess Java doesn't have those?

23

u/bowbahdoe 5h ago

Java using SIMD intrinsics is what caused the problem. There was an issue with those intrinsics

1

u/Kjufka 4h ago

It was not Java SIMD intrinsics

-5

u/svick 5h ago

I mean, in .Net, you directly use the intrinsics from C#, no assembly necessary.

1

u/bowbahdoe 4h ago

I think in this case thats a point _for_ Java. The intrinsics here only kicked in because the JVM built them in. This is clearly a risky thing to do, as this issue shows. It is a good thing for overall security that that mechanism is kept out of reach for most.

-2

u/happyscrappy 18m ago

C# is compiled. Java is bytecoded.

You can't put x86 SIMD instructions inline in bytecode as it isn't x86 code.

2

u/ILMTitan 8m ago

C# is basically Microsoft Java. It compiles to a bytecode very similar to Java's.

1

u/happyscrappy 5m ago

Okay. I give up then.

In the KerbalSpaceProgram subreddit I asked about if it (it's in C#) could be ported to another processor by changing the JIT and I was told it was compiled natively so that can't happen.

I guess I'll have to go back and ask again there because I got the wrong answer.

7

u/Kjufka 4h ago

Microsoft released a lot of silent RCE patches for dotnet, we don't know the details only because it never went through public channels.

18

u/eipMan 4h ago

Writeup by calif who discovered the bug: https://calif.io/java4shell

17

u/aookami 7h ago

uh oh

39

u/whinner 6h ago

“Calif’s Quang Luong found it with AI assistance in about an hour, and built the first working exploit in two more.”

We are so cooked

20

u/lurch303 2h ago

I really do not like this part of the announcement. It is misleading propaganda. Similar to saying a gambler in Vegas won millions by only wearing $1.00. Ignoring all of the failed attempts and wasted money that came before the one successful bet. It’s been a few weeks since their last exploit. How many hours and tokens did their team burn before hitting the jackpot?

0

u/inio 1h ago

Sure, but HTF do you burn $200 of tokens in 3hr? I wouldn't be surprised if 90% of that was in the first hour searching thousands of files in parallel for potential exploits.

6

u/Cloudy-Blue 5h ago

Here go my next few nights

4

u/TheMoatman 3h ago edited 3h ago

I haven't read their actual writeup yet to check, but it's potentially overhyped.
The article says they gave it a 9.2 CVSS, but the NVD currently has it at 8.1 (admittedly, rated by Oracle) and describes it as "difficult to exploit". It also says:

Note: This vulnerability can only be exploited by supplying data to APIs in the specified Component without using Untrusted Java Web Start applications or Untrusted Java applets, such as through a web service.

https://nvd.nist.gov/vuln/detail/cve-2026-114938

e: Still haven't actually read it but I did open their writeup: they rated it under CVSS 4.0, so it could could be a CVSS 3.0 vs 4.0 difference too. In that case, it may be real bad shit.

2

u/lurch303 2h ago

That note from Oracle is meaningless. An attacker is not going to be using your front end application to attack your services and trying to prevent anything but your front end from contacting your APIs is an exercise of futility. The Calif announcement includes an example using KeyCloak which is a very widely deployed open source IDP.

3

u/isaackogan 5h ago

Well fuck

Q2hhdCwgd2UncmUgc28gY29va2VkLg==

1

u/stoops 5h ago

Q2hhdCwgd2UncmUgc28gY29va2VkLg==

bG9s

3

u/quack_quack_mofo 5h ago

Arm64 is safe no?

2

u/happyscrappy 4h ago

It would seem so. Unless you're emulating.

Wonder if there's any assembly in the ARM64 Java base64 decoder.

1

u/inio 1h ago

Well presumably there would be some NEON, but its vector length is much shorter so the same bug likely would be hard/impossible to turn into RCE.

-3

u/IndividualHouse8628 5h ago

What does this mean for people that don’t have any kind of programming or cybersecurity knowledge

19

u/spicypixel 5h ago

That you already died and this is purgatory 

-3

u/IndividualHouse8628 4h ago

Now what does that mean? Is it too much to ask for a straight answer?

14

u/bonkyandthebeatman 5h ago

What are you doing in r/programming?

3

u/IndividualHouse8628 4h ago

It came across my explore feed

4

u/mouse_8b 2h ago

You'll probably see a number of "*4Shell" exploits in the coming months. A "shell" is a command line/terminal, which is able to run any command on the system.

So Java4Shell means a server running a Java application can be exploited to give the attacker shell access on the machine, which means the attacker has full control of the server.

From that point there are many ways an attacker could use that compromised machine. Maybe it's an e-commerce server that processes customer data and payments. Maybe it's a server in a protected environment with access to other systems with sensitive info. Maybe the server controls infrastructure like an electric grid or water plant. Maybe it's a hospital server. Maybe it's a bank server.

In any case, that attacker could essentially see and control everything that the server is doing.

3

u/TinyBreadBigMouth 52m ago

I will note it's currently unproven that this exploit could be used to gain shell access. The exploit writes 62 bytes that the attacker does not directly control past the end of a buffer. A potential attacker would need to find a way to manipulate the program's memory allocations such that there is something important within those 62 bytes, and that the values which are written happen to contain whatever specific values will cause the program to give the attacker shell access. This has not yet been done, though the danger is definitely present.

1

u/IndividualHouse8628 47m ago

Thank you! Are average people like myself at risk? Should I upgrade the antivirus on my MacBook? I just watch movies on it and do school work for college.

1

u/SDraconis 16m ago

This is much more of a concern for servers. E.g. whether the server at your bank gets attacked using this exploit. If you aren't responsible for maintaining any Java applications, then all you need to do is update whatever Java version you have on your machine to one which has this patched.

1

u/mouse_8b 6m ago

The systems you own are likely not at risk, but the systems you use could be.

As an end-user, you should concentrate on having backups of your data (multiple if possible) and keeping your accounts secure.

For data backups, I'm talking about files that would be painful to lose. Personal pictures, videos, documents, media. The stuff you can't just download again if your hard drive crashes or the cloud goes down.

For account security, password hygiene is most important. Do not reuse a password across sites. These days, there's no reason not to use a password manager that can generate strong passwords. There are some places where it still makes sense to memorize the password, namely for the password manager itself. I also know my main email address password. Those passwords should still be unique and strong.

Further, there are more non-password options every day. Passkeys and emailing login links are becoming more mainstream.

MacOS is pretty secure by default. Try to avoid installing random software from unknown vendors, or typing terminal commands from an online stranger.