Java4Shell (CVE-2026-114938): How to Mitigate the OpenJDK Base64 RCE

To mitigate Java4Shell, patch OpenJDK, and start every JVM you can’t patch yet with -XX:-UseBASE64Intrinsics. A buffering proxy only blocks some attack chains. The other published flag, -XX:UseAVX=2, stops a JVM on ARM from starting.

In Java4Shell: Write once, RCE everywhere, Quang Luong and Calif disclose CVE-2026-114938, a heap overflow in OpenJDK’s Base64 decoder. Below is why the first two fixes fall short, what holds, and how to tell which hosts are exposed.

Table of Contents

What Java4Shell is

To decode Base64 faster, HotSpot uses hand-written AVX-512 code on recent x86-64 CPUs. Calif found that the code miscounts the output length when the input ends in a stray =. Their trigger is 64 A characters followed by one =. For that input, Java allocates 50 bytes, and the decoder writes 62 bytes past the end.

Java rejects the input afterwards, but the neighboring objects on the heap are already overwritten. Calif scores it 9.2 under CVSS 4.0. They report pre-auth remote code execution in default configs of Keycloak, Jira, Confluence, Artifactory, Jenkins and PingFederate. A client is exposed too: Calif describes a Java program compromised just by opening a TLS connection to a malicious server.

Plan A: a proxy that buffers requests

Calif’s own limitations section notes that some of their exploit chains need a partial request body to reach the application. A proxy that waits for the full body, as nginx does by default, breaks that timing.

Calif also says request buffering is not a general mitigation. Their Elasticsearch chain runs from one complete request. After a WebSocket upgrade, later frames pass through the tunnel and skip the buffer. A proxy also does nothing for the client-side case. Keep it, but don’t treat it as the fix.

Plan B: -XX:UseAVX=2

Capping the JVM at AVX2 keeps HotSpot away from the AVX-512 code path where the bug lives. Calif lists it as a mitigation, with a warning: OpenJDK on ARM doesn’t recognize the flag and fails to start.

On a fleet that mixes x86-64 and ARM hosts, one shared JAVA_OPTS value with this flag takes the ARM services down. One developer in the discussion added that it also fails on machines without AVX2, and recommended the other flag instead.

Plan C: patch, with a flag as the bridge

OpenJDK published an advisory, and Oracle shipped a patch on Nov 17, 2026, per Calif. Update first. Calif lists Corretto, Temurin, Microsoft’s build, Zulu, Liberica, SapMachine, Red Hat’s build and GraalVM as affected, so each vendor has to ship its own build. When the article came out, Temurin had not shipped one yet, a developer pointed out. Adoptium aims to release within two days of the upstream tags, according to a reply.

Until your build lands, start the JVM with the Base64 intrinsic turned off:

# Disable the hand-written Base64 code path until the patched JDK is deployed
JAVA_OPTS="$JAVA_OPTS -XX:-UseBASE64Intrinsics"

This turns off hardware-accelerated Base64 encoding and decoding, which is the code with the bug. You pay with slower Base64 until you remove the flag after patching.

Which hosts are exposed

Calif says the bug affects OpenJDK 17.0.6 and newer on HotSpot. It also needs an x86-64 CPU with AVX-512 VBMI: Intel Xeon from Ice Lake onward, or AMD Zen 4 and newer. ARM64 is not affected. Their check for Linux:

grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'

A host is exposed only if all four flags print. Run it across the fleet before choosing where the bridge flag goes first.

How urgent is it?

Calif says there’s no universal exploit. Each target needs its own profile, and the heap grooming over the network is sensitive to round-trip time and jitter. They are holding back the product-specific chains for now.

Developers in the discussion pushed back on reading that as time to wait. One noted that even a partly working heap leak against Keycloak could expose live tokens on a lot of internet-facing hosts. I agree. Patch the internet-facing JVMs today, and put the flag on the rest.

What to do this week: list every JVM you run, clients included, with its vendor, version and CPU. Patch the exposed ones and set -XX:-UseBASE64Intrinsics on anything still waiting for a build.

FAQ

What is Java4Shell?

Java4Shell (CVE-2026-114938) is a heap overflow in the AVX-512 Base64 decoder of OpenJDK’s HotSpot JVM. Malformed Base64 input can overwrite neighboring memory, and Calif turned that into remote code execution.

Does Java4Shell affect ARM servers?

No. Calif says the vulnerable code needs an x86-64 CPU with AVX-512 VBMI, and ARM64 CPUs are not affected.

Which Java versions are affected?

OpenJDK 17.0.6 and newer, plus the distributions built from it, per Calif. Oracle also lists affected Java SE builds, including an 8u performance build.

Is -XX:UseAVX=2 a safe mitigation?

Only on x86-64 hosts. On ARM, OpenJDK doesn’t recognize the flag and won’t start, so -XX:-UseBASE64Intrinsics is the safer choice for a mixed fleet.

Does nginx protect me from Java4Shell?

Partly. Buffering request bodies breaks the chains that need a streamed request, but Calif’s Elasticsearch chain uses one complete request.

Are Java clients at risk too?

Yes. Calif describes a client-side exploit where a Java program is compromised by opening a TLS connection to a malicious server.

Sources