Java4Shell heap overflow affects OpenJDK on x86-64 AVX-512 systems
A heap overflow in OpenJDK's hardware-accelerated Base64 decoder allows for remote code execution on specific x86-64 architectures using AVX-512 instructions.
Summary
A critical vulnerability, dubbed Java4Shell (CVE-2026-114938), has been identified in the OpenJDK runtime. The flaw resides in the hardware-accelerated Base64 decoder used by the HotSpot JIT compiler when executing hand-tuned machine code on specific CPU architectures.
The vulnerability specifically affects x86-64 processors supporting AVX-512 VBMI instructions, such as Intel Ice Lake or newer, and AMD Zen 4 or newer. Because the bug exists within the Java runtime itself rather than a third-party library, standard dependency scanners will not detect it, requiring a full replacement of the runtime environment or container images.
Technical breakdown of Java4Shell
- Vulnerability Mechanism: A heap overflow occurs when the decoder processes a malformed Base64 tail with '=' padding, causing an integer underflow in the calculated output length and resulting in a 62-byte out-of-bounds write.
- Hardware Dependency: The flaw is triggered by JIT-compiled machine code utilizing AVX-512 instructions to process 64-byte chunks; ARM-based servers are not affected.
- Exploitation Path: Researchers demonstrated that the overflow can overwrite adjacent array length fields to facilitate arbitrary heap writes and memory reads, eventually escalating to remote code execution via heap grooming.
- Affected Software: The bug impacts OpenJDK 17.0.6 and newer; common entry points include Spring Security, Tomcat, Jetty, and the java-jwt library due to their use of Base64 for authentication handling.
- Mitigation: Users can temporarily disable the vulnerable code path by launching the Java Virtual Machine with the '-XX:-UseBASE64Intrinsics' flag.
Why it matters
This vulnerability poses a significant challenge for DevOps and system administrators because it requires updating the core Java runtime across all containerized environments. Unlike application-level bugs, this necessitates a fundamental infrastructure update to ensure security in high-traffic environments where JIT compilation is active.
What to do
- Replace the OpenJDK runtime and all container images with fixed versions.
- If you cannot update immediately, launch the Java Virtual Machine with the '-XX:-UseBASE64Intrinsics' flag to disable the vulnerable code.
Original reference: hackaday.com →