Java4Shell: OpenJDK Base64 Flaw Enables RCE
Contents
A memory corruption vulnerability tracked as Java4Shell (CVE-2026-114938) affects OpenJDK's built-in Base64 decoder. Assigned a CVSS 4.0 score of 9.2, the bug lets unauthenticated attackers overwrite heap memory, read out-of-bounds data, and achieve remote code execution (RCE).
The mechanics behind Java4Shell
Java manages memory automatically at the application layer, but the virtual machine itself relies on C, C++, and assembly for performance-critical paths. To speed up Base64 decoding on x86-64 hardware, OpenJDK's C2 JIT compiler uses intrinsics that rely on AVX-512 VBMI instructions.
An arithmetic underflow occurs in the assembly routine that handles padded tail bytes. When parsing inputs like 64 characters followed by a single '=', the routine mishandles the trailing character and decrements the output length below zero. This underflow causes the bzhiq instruction to use a mask that writes up to 62 bytes beyond the allocated buffer.
input_mask := bzhiq(-1, input_length)
output_len := (input_length / 4) * 3
// Handle padding characters
if input[input_length - 1] == '=':
output_len -= 1
input_mask >>= 1
if input[input_length - 2] == '=':
output_len -= 1
input_mask >>= 1
// Negative output_len triggers out-of-bounds write
output_mask := bzhiq(-1, output_len)Affected software
Because Base64 decoders run on authentication tokens, file uploads, and API parameters, the issue affects many standard deployments. Testing confirmed pre-authentication RCE on default installations of several enterprise platforms:
- Keycloak
- Atlassian Jira and Confluence
- JFrog Artifactory
- Jenkins
- PingFederate
Post-authentication code execution was also confirmed on Apache Kafka Broker, Elasticsearch, and Apache Solr. Client-side exploitation is also possible when a Java client opens an outbound connection to an attacker-controlled server.
Centaur hackers and code complexity
The researchers who found the bug described using a centaur hacker workflow, combining LLM prompts with manual exploit development. They audited the code path in about an hour and produced a working exploit in two, spending under $200 on API tokens.
The bug points to the ongoing risk of low-level assembly optimizations in common runtimes. The researchers suggest vibe-uncoding, using AI agents to review older optimization code and remove intrinsics that add complexity without measurable real-world performance gains.