Skip to content
Java4Shell: Remote Code Execution in OpenJDK (CVE-2026-114938)

Java4Shell: Remote Code Execution in OpenJDK (CVE-2026-114938)

Securitylabs.Datadoghq • November 18, 2026

Denial of service is the more readily achievable impact where attacker-controlled input reaches the vulnerable decoder. Reliable remote code execution requires additional exploitation work tailored to the application and Java Virtual Machine (JVM) environment.

Exploiting this vulnerability requires the affected Java runtime to execute its AVX-512 Vector Byte Manipulation Instructions (VBMI) decoding path. Systems running on processors that lack AVX-512 VBMI support are not affected.

On affected x86-64 deployments, starting the JVM with -XX:UseAVX=2 disables the AVX-512 path and prevented out-of-bounds writes in our tests. Scope the flag to x86 deployments as native ARM64 JVMs do not recognize it and will fail to start if that flag is passed.

In a standalone test, the extra write corrupted a neighboring array's header and the JVM later crashed during garbage collection. The resulting damage depends on which objects occupy the overwritten memory.

On November 17, 2026, Oracle released a security update for CVE-2026-114938, an out-of-bounds write in OpenJDK’s optimized Base64 decoder. This vulnerability affects OpenJDK 17.0.6 and later and has been rated 9.2 (Critical) under CVSS 4.0.

While the vulnerability can lead to remote code execution in a worst-case scenario, it is important to stress that an attacker would have to do additional work for every application they target. There is no single, universal exploit that would work against all Java applications.

How to know if you’re affected

Oracle stated that the Java versions affected by vulnerabilities patched in this release are as below:

In addition to running a vulnerable version of Java, the application must be running on a CPU that supports the AVX-512 VBMI decoding path. Not all systems (including modern ones) support this instruction set so it is recommended to check when prioritizing systems for patching. The following is a shell command to see if the instruction set is supported:

If this command returns nothing, that is an indication that the CPU does not support VBMI. If the command returns avx512vbmi and/or avx512_vbmi , that is a signal that it does support VBMI and could be potentially vulnerable.

Native ARM64 Java runtimes are not affected by this vulnerability because they do not execute the vulnerable x86 AVX-512 decoding path.

An affected Java runtime and a compatible CPU are prerequisites, but the application must also pass attacker-controlled data to the vulnerable decoder. In the OpenJDK 17.0.6 build we tested, the AVX-512 path handles the basic and URL decoders returned by Base64.getDecoder() and Base64.getUrlDecoder() . The MIME decoder returned by Base64.getMimeDecoder() bypasses this path.

This distinction matters when assessing authentication and token-processing code. Base64-encoded credentials, tokens, or SAML messages expose an application only if its implementation passes the malformed value to the affected decoder. Libraries that implement their own decoding, or reject or normalize the value before calling the JDK decoder, can behave differently.

From a Java method to a native decoder

Java's Base64.Decoder supports decoding into a new array or one supplied by the caller. In both cases, it calculates the required output space before decoding. The allocating method uses that calculation directly:

The allocation is not the source of the overflow. Further down this call chain, HotSpot's optimizing compiler, C2, can replace decodeBlock() with a native implementation. These replacements, called intrinsics, let the JVM use specialized CPU instructions. The native implementation must respect the bounds of the Java arrays it receives.

The AVX-512 decoding routine converts each 64-byte input block into 48 output bytes. When fewer than 64 input bytes remain, a separate handler decodes the final fragment. That is where the length calculation goes wrong.

Padding produces a negative output length

Consider a value containing 128 A characters followed by one = :

The first 128 characters form complete Base64 groups. The final = is invalid: Padding cannot form a group by itself. However, the initial output-length calculation does not reject this value. It counts the input and trailing padding and produces a destination length of 98 bytes.

The native routine decodes the first 128 characters into 96 bytes. It then reaches the final-fragment handler with just the = remaining.

To calculate the fragment's output size, the handler divides the remaining length by four, discards the remainder, and multiplies by three. In HotSpot's code generator, those operations are:

For a 1-byte fragment, this produces zero. The padding branch then decrements output_size for the trailing = . There is no check that the result remains nonnegative, so the count becomes -1 .

The same problem occurs with other fragments containing fewer than 4 bytes.

The negative count enables a full-width store

AVX-512 supports masked stores, where individual mask bits determine which bytes reach memory. The decoder uses the output count to construct such a mask. A count of zero should permit no writes; a count of three should permit 3 output bytes.

The code starts with a 64-bit value whose bits are all set, then uses BZHI to retain the requested number of low bits:

BZHI reads its bit count from the low byte of the last operand. For -1 , that byte is 255. For -2 , it is 254. Both exceed the width of the 64-bit operand, so the instruction leaves all 64 bits set.

The contents of the write also follow from the implementation. The tail handler fills unused input positions with the character a before decoding the vector. Much of the excess output is consequently the repeating byte pattern 69 a6 9a . The vulnerability causes a constrained overwrite rather than a freely chosen 64-byte value.

An exception does not contain the corruption

The decoder eventually throws IllegalArgumentException for the malformed input. The Java API permits partially written output when decoding fails. Here, however, the native routine has written outside the output array altogether.

This explains why the symptom may appear far from the decoder call. A write into unused heap space can go unnoticed. A write into an object header can instead damage information that the JVM consults later, including during garbage collection. Catching the decoding exception leaves that damage in place.

Follow your Java runtime vendor's guidance for a fixed build. Include runtimes bundled with applications and container images in that review. After updating a container base image, rebuild and redeploy the application image. Restart affected Java processes so they use the updated runtime.

If an update cannot be deployed immediately, our tests confirmed two JVM startup options that prevented the out-of-bounds writes.

To disable the Base64 intrinsics specifically, add:

Alternatively, on x86-64 deployments, disable AVX-512 execution by limiting the JVM to AVX2:

Disabling the Base64 intrinsics is the narrower workaround. Limiting AVX affects other JVM operations that use AVX-512, so assess its performance impact on your workload.

Scope UseAVX=2 to x86 deployments. Native ARM64 JVMs do not execute the vulnerable code, and they do not recognize this option. Adding it to shared startup settings can prevent ARM64 services from starting.

Apply the selected option to the application's JVM startup configuration and restart the service. Check the running process, including any bundled runtime, rather than relying on the Java installation found on your shell's path. Where jcmd is available, inspect the runtime version and effective flags with:

Confirm that the process reports UseBASE64Intrinsics = false or UseAVX = 2 , depending on the workaround selected.

Datadog Live Processes provide real-time visibility into the processes running on your infrastructure. You can use it to identify Java processes running on x86-64 hosts, then filter to determine which hosts are running an affected Java runtime.

Datadog Cloud Security Management reports findings for CVE-2026-114938. Check the vulnerability findings for affected hosts and container images.

While this vulnerability can lead to remote code execution, its practical impact depends on the environment.

Applications running on processors without AVX-512 VBMI support are not affected by this vulnerability. On affected systems, denial of service is more readily achievable than reliable code execution. Attackers seeking to execute arbitrary code would need to tailor their exploits to the Java runtime and application behavior, which complicates the development of a broadly reusable exploit.

These constraints give security teams a way to prioritize their response, but affected services still need prompt attention. Follow your runtime vendor’s guidance for a fixed build, including Java runtimes bundled with applications or container images. Where an update cannot be deployed immediately, disable the vulnerable decoding path as a temporary workaround.

Extracted Entities

Platforms (1)

Vulnerabilities (1)