'Java4Shell' Flaw Exposes OpenJDK to RCE via Base64 (calif.io) 28
Longtime Slashdot reader HnT writes: Security researchers at Calif have disclosed Java4Shell (CVE-2026-114938), a critical 9.2-rated memory-corruption bug in OpenJDK's AVX-512 Base64 decoder. By sending a malformed string ending in a stray = character, attackers can trigger an out-of-bounds heap write to leak sensitive memory or achieve pre-auth remote code execution on major platforms like Jira, Jenkins, and Keycloak. Although Calif says the vulnerability is difficult to exploit, Oracle released a critical patch update Tuesday, and CISA urged organizations to update immediately. OpenJDK's security advisory can be found here.
The Calif researchers warned that vulnerable systems could remain exposed for five to 10 years, given how slowly some organizations patch their infrastructure.
The Calif researchers warned that vulnerable systems could remain exposed for five to 10 years, given how slowly some organizations patch their infrastructure.
"memory-safe" (Score:3, Interesting)
Oops! Memory-safe except when you have handwritten SIMD code to accelerate base64 decoding.
Well, glad it's getting fixed anyhow.
Re: (Score:2)
I was going to say the same thing, but you beat me to it.
Certainly beclowns one of the biggest arguments for Java.
Re: (Score:2)
And if you are running older x86_64 cpu's that lack some of the newer AVX512 instructions (ex avx512vbmi) your are supposedly safe.
Re:"memory-safe" (Score:5, Insightful)
Certainly beclowns one of the biggest arguments for Java.
The argument is not complete immunity from memory-safety issues, but a far reduced scope in which they are relevant and in which the developer needs to take care of them.
There is no mainstream language that is 100% memory safe. All of them have at least some unsafe internals. The "memory safety guarantee" of the safe parts relies on the correctness of the unsafe internals they use.
As example, from The Rustonomicon [rust-lang.org]:
Much of the Rust standard library also uses Unsafe Rust internally. These implementations have generally been rigorously manually checked, so the Safe Rust interfaces built on top of these implementations can be assumed to be safe.
That assumption holds only as long as those Unsafe Rust internal uses are actually bug-free, which is not a 100% guarantee as bugs can slip through even the most rigorous checks. After all, even the OpenJDK's AVX-512 Base64 decoder was very likely "rigorously manually checked"...
What is true is that minimizing the unsafe parts reduces the attack surface and allows for more focused checks on those parts. This is still a very valid argument for Java compared to e.g. C/C++.
Re: (Score:1)
From Oracle: [oracle.com]
"The single biggest difference between Java and C or C++ is that Java's memory model eliminates the possibility of overwriting memory and corrupting data."
This was the early argument for Java, and they didn't hedge it like "well actually it's a far reduced scope." But also in the early days, there weren't clever optimizations for niche cases like base64 decode.
To give Java the benefit of the doubt and save face, one might say that it's an aspirational goal, not a bulletproof guarantee; or that t
Re: (Score:3)
From Oracle: [oracle.com] "The single biggest difference between Java and C or C++ is that Java's memory model eliminates the possibility of overwriting memory and corrupting data."
This was the early argument for Java, and they didn't hedge it like "well actually it's a far reduced scope."
That statement is under the assumption that the language itself is implemented correctly. This is not different from the Rustonomicon, which makes the same assumption about Rust.
This is from the first chapter of the Rustonomicon [rust-lang.org]:
Safe Rust is the true Rust programming language. If all you do is write Safe Rust, you will never have to worry about type-safety or memory-safety. You will never endure a dangling pointer, a use-after-free, or any other kind of Undefined Behavior (a.k.a. UB).
That is presented pretty clearly as "bulletproof guarantee", but it is actually only true under the assumption that Rust itself is implemented correctly.
Re: (Score:3)
The argument is not complete immunity from memory-safety issues, but a far reduced scope in which they are relevant and in which the developer needs to take care of them.
If they had written the base64 decoder in Java, it would not have this vulnerability. But no, they decided to optimized it by not using Java, so they got a serious bug. Why was it so important to write the decoder in another language? Isn't Java with JIT fast enough?
Re: (Score:3)
Why was it so important to write the decoder in another language? Isn't Java with JIT fast enough?
That's the kind of special case implementations you want as fast as possible. I doubt any mainstream language that takes performance seriously does it completely without unsafe internals either.
Re: (Score:1)
Re: (Score:3)
As an exercise, I reimplemented that base64 in pure Java, using the recent Vector API (and improving it a bit too to get fully on par, so it wouldn't work as is). It matches native speeds within a few %.
The Vector API is still technically in incubation though, so base Java modules cannot depend on it.
Furthermore, you are not really avoiding unsafe code completely, only moving the problem. The Vector API itself is implemented by HotSpot intrinsics in C++, which means its use is safe only as long as the underlying C++ implementation is bug-free.
Re: (Score:1)
Re: "memory-safe" (Score:2)
Absolutely not. Java guarantees that you can't write memory unsafe code in it. However, yes there can be problems within the implementation of the Java itself on any libraries that it uses if they're written with memory unsafe languages.
Re: (Score:2)
> Certainly beclowns one of the biggest arguments for Java
No, it just makes clowns of the OpenJDK teams. There's no good reason to write Base64 implementations in assembler. The idea that native Java isn't fast enough to process Base64 in the kinds of volumes Base64 is used in is completely absurd. What the fuck were they thinking? And if they are going to implement this why wasn't it subject to rigorous review and testing?
I'm not impressed with the Java back-end these days. I found changing the garbage
Re: (Score:1)
Re: (Score:2)
My wisdom is that the normal use case for base64 is once in a blue moon. You don't weaken the security of your code because you want to hand optimize some code that the average code base will use maybe once or twice for every web call. Nobody's writing a loop to go through 100,000 base64 strings.
This is what comes of people who don't use profilers or don't understand how their code works enough to realize where the bottle necks are.
Re: (Score:1)
This is what comes of people who don't use profilers or don't understand how their code works enough to realize where the bottle necks are.
I don't think that's true of the authors, though.
And optimizing it wasn't a bad idea. The pure java version was already optimizable, and using AVX is a good, supposedly easy way to speed it up. Decoding a token is only a fraction of a web request processing time, but it does matter for bigger payloads too (mime...)
Re: "memory-safe" (Score:2)
looks around (Score:2)
All I see is old hardware running Java 8.
The future's so bright I gotta wear shades.
TXkgdGhvdWdodHMgb24gdGhpcyB0b3BpYzo= (Score:3)
T0ggRlVDSyE=
Re: TXkgdGhvdWdodHMgb24gdGhpcyB0b3BpYzo= (Score:1)
You don't say :)
What is Java? (Score:2)
Is that like a fancy new compiler for Rust or Go? Never heard of it. /s
Re: (Score:1)
Java was a precursor to Go.
The short answer is that Java was a language that built complexity with a chain of inheritance from Object, and reduced complexity with interfaces.
A longer answer follows.
Jar files and the mythical JavaOS
Java was used to build programs for an imaginary JavaOS, that was never really completed (sort of like Gnu/Hurd).
Instead of building executable programs, you used Java to build Jar files. A Jar file was like a compiled library, that was to be installed in the JavaOS.
It was envi
Re: (Score:3)
Yes but the real question is what is "/s" and what does it mean when someone puts "/s" at the end of the post?
Iâ(TM)ve got an Arm CPU (Score:3)
You insensitive clod
Can't wait... (Score:3)
Re: Can't wait... (Score:2)
Speech4Shell will allow you to gain the root shell on a cloud server simply by talking with ChatGPT.