Skip to content
All posts

Java4Shell (CVE-2026-114938): what it is and how to fix it

Java4Shell (CVE-2026-114938) is an OpenJDK heap overflow that can lead to RCE. See who is affected, how to check your servers, and how to patch or mitigate it.

Polin Khan

11 min read

A glowing CPU decodes a stream of Base64 characters, and red bytes overflow past the end of a memory buffer into neighbouring blocks

On 17 November 2026 the security firm Calif disclosed Java4Shell (CVE-2026-114938). It is a memory-corruption bug in the JVM itself, not in a library you pulled in. Any Java service that decodes Base64 from users can be exposed, if it runs on a recent JDK and a recent x86-64 CPU. Login headers, tokens and file uploads all go through Base64.

The name is a nod to Log4Shell, and like Log4Shell the worry is that the vulnerable code sits under a huge number of applications. Unlike Log4Shell, there is no single string that pops a shell everywhere. Attacks depend on the CPU, the JDK build and the application. That makes it harder to exploit, but it also makes it harder to rule out.

This post covers what the bug is, who is affected, how to check your machines, and what to do while patches roll out.

Java4Shell at a glance

CVECVE-2026-114938 ("Java4Shell")
ComponentHotSpot JIT, x86-64 AVX-512 Base64 decode intrinsic
Bug classHeap buffer overflow (out-of-bounds write)
Affected JavaOpenJDK 17.0.6 and later, 21, 25 and 27, from every vendor
Affected CPUsx86-64 with AVX-512 VBMI (Intel Ice Lake and later Xeons, AMD Zen 4 and later)
Not affectedJava 8 and 11 (standard builds), ARM64, older x86-64 CPUs
ImpactJVM crash, heap memory disclosure, remote code execution
AuthenticationNot needed where Base64 is decoded before login (Basic auth, JWTs)
SeverityCVSS 3.1: 8.1 (Oracle). CVSS 4.0: 9.2 (Calif). Red Hat: 9.8 preliminary
FixUpdate the JDK. Stopgap: -XX:-UseBASE64Intrinsics

What is Java4Shell? The root cause

java.util.Base64 is plain Java code, but the JVM doesn't always run it as written. Once a method is called often enough, HotSpot's optimizing compiler (C2) swaps hot paths for hand-written machine code called intrinsics. Base64 encoding and decoding have one. On CPUs with AVX-512 it chews through 64 bytes at a time using vector instructions.

To handle a final chunk shorter than 64 bytes, the intrinsic builds a store mask from the number of output bytes left. That mask says which of the 64 lanes the vector store may write. Calif's write-up explains what happens with padding (=):

  1. Each padding character makes the decoder lower the expected output length.
  2. With certain endings, the output length underflows to -1 or -2. One example is a padding character right after a full 64-character block.
  3. The mask is computed with a bit-manipulation instruction (bzhi) that treats this value as huge, so the mask comes out as all ones.
  4. The masked store then writes all 64 lanes, even though the output array has room for far fewer.

In Calif's example the decoder allocates a 50-byte result and writes 64 bytes starting at offset 48. That puts 62 bytes past the end of the array, into whatever object the heap put next to it.

Afterwards Java notices the input is malformed and throws IllegalArgumentException. By then the memory next to the array has already been overwritten. The application sees a normal validation error, and the corruption shows up later.

Which Java versions and CPUs are affected

Three things have to line up:

  • The JDK must contain the AVX-512 decoder. It arrived in the 17 line in 17.0.6 and is in every later release. Java 8 and 11 never got it.
  • The CPU must support AVX-512 VBMI (plus AVX-512F, AVX-512BW and BMI2). The JVM only picks this code path when the CPU has those instructions. Ice Lake, Sapphire Rapids, Emerald Rapids and Granite Rapids Xeons qualify, and so do AMD Zen 4 and newer. Skylake-SP, Cascade Lake and older AMD parts do not.
  • The decoder must be hot. The intrinsic only runs after C2 compiles the decode path. A busy server that decodes Base64 on every request warms it up quickly. Calif's proof of concept runs many valid decodes before the bad one.

On ARM64 (Graviton, Ampere, Apple Silicon) or 32-bit x86 you are not affected by this bug.

How severe is Java4Shell?

The bytes that spill over are mostly fixed values. The attacker controls the first one fully and the second partly, but they do get to choose where the write lands by shaping the heap. Calif describes two outcomes:

  • Memory disclosure. Corrupting a neighbouring object's length can make the JVM read past it and send heap memory back. Calif calls this "JavaBleed", after Heartbleed. That memory can include session tokens, keys and passwords.
  • Remote code execution. Calif says it got code execution, without logging in and with default configuration, on Keycloak, Jira, Confluence, JFrog Artifactory, Jenkins and PingFederate. It also got code execution after logging in on Kafka, Solr, Elasticsearch, Gerrit and Spinnaker, and on sample Struts and Spring Boot apps. It is not publishing those chains yet.

The surprising part is that clients are at risk too. A Java program that only connects to a malicious TLS server can be compromised. Calif credits that finding to samczsun and has not published the details. A crawler, a webhook sender or a CI agent pulling from somewhere you don't control all count.

Each exploit has to be built for the specific application, and a failed attempt usually crashes the JVM. Oracle rates attack complexity as high for that reason, and gives it 8.1. Calif and Red Hat score it higher because there are routes that need no login. Both views are fair. If a pre-login service of yours decodes Base64 on a vulnerable host, treat it as critical.

Attack surface: where attacker-controlled Base64 comes from

Almost every web stack decodes Base64 before it knows who you are:

  • Authorization: Basic … headers (Tomcat's Basic auth is one of the routes mentioned)
  • JWTs and other bearer tokens (the java-jwt library is named as a route)
  • SAML assertions and other SSO messages
  • Cookies and session blobs
  • data: URIs, file uploads and Base64 fields in JSON APIs

Request buffering in a reverse proxy like nginx is not a general fix. Calif notes that some chains need only one complete request.

How to check if you are vulnerable to Java4Shell

Work through these on each x86-64 host that runs Java.

1. Does the CPU have the instructions?

check-cpu.shBash
grep -oE '(avx512f|avx512bw|avx512vbmi|bmi2)' /proc/cpuinfo | sort -u

All four flags printed: the CPU can run the vulnerable path. No avx512vbmi: this bug can't reach you on this host, but you should still patch so a later migration to newer hardware doesn't expose you.

Cloud VMs pass through the host's CPU flags, so an instance type upgrade can quietly change the answer.

2. Which JVMs are running, and which version?

find-jvms.shBash
# What java on PATH says
java -version
 
# Every running JVM, and the binary it was started from
ps -C java -o pid,cmd
ls -l /proc/<pid>/exe
 
# Ask a running JVM directly (more reliable than PATH)
sudo jcmd <pid> VM.version

Don't trust the java on your PATH alone. Jenkins, Jira, Confluence, Keycloak, Elasticsearch and many container images ship their own JDK. Look for bundled runtimes:

Bash
sudo find / -xdev -name release -path '*j*' -exec grep -l '^JAVA_VERSION=' {} + 2>/dev/null

3. Is the intrinsic switched on?

Bash
java -XX:+PrintFlagsFinal -version | grep UseBASE64Intrinsics
# bool UseBASE64Intrinsics = true  {product} {default}   <- default, exposed

4. Does the service decode Base64 from users?

If it takes logins, tokens, SSO, uploads or API traffic from outside, assume yes.

Your risk is highest when all four answers are yes and the service is reachable from the internet before login.

How to fix Java4Shell

Patch: update to a fixed JDK

Oracle shipped fixes in its November 2026 Critical Security Patch Update on 17 November:

LineAffected Oracle buildFixed in
8 Performance Pack8u511b33-perf8u513-perf
1717.0.21.0.317.0.21.1
2121.0.13.0.321.0.13.1
2525.0.5.0.325.0.5.1
2727.0.1.0.327.0.1.1

Amazon Corretto has released 17.0.21.1.2. As of 18 November, Eclipse Temurin, Red Hat (RHEL 8, 9 and 10), Ubuntu, Debian, Rocky Linux and AlmaLinux had not shipped rebuilt packages. Red Hat says its fix is being expedited.

After updating, restart every JVM. A running process keeps the old runtime in memory, and bundled runtimes need their application updated or re-imaged.

Mitigation: disable the Base64 intrinsic until your vendor ships

If you can't update yet, turn off the vulnerable code path with a JVM flag. There are two options:

Option A: disable only the Base64 intrinsic (preferred)Bash
-XX:-UseBASE64Intrinsics
Option B: disable all AVX-512 use (x86-64 only)Bash
-XX:UseAVX=2

Option A is narrow. It is a normal product flag, so you don't need UnlockDiagnosticVMOptions. Base64 work falls back to slower generic code. Option B gives up AVX-512 everywhere in the JVM, which costs more performance, and it fails to start on ARM ("Unrecognized VM option"). Neither Oracle nor the OpenJDK advisory mentions these flags, but Calif and JFrog both list them as blocking exploitation. No source has published benchmark numbers, so watch your latency after you roll one out.

The simplest way to apply a flag to every JVM on a host, including bundled ones, is JAVA_TOOL_OPTIONS. With systemd:

/etc/systemd/system/myapp.service.d/java4shell.confini
[Service]
Environment="JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics"
Bash
sudo systemctl daemon-reload && sudo systemctl restart myapp
 
# Confirm it took effect on the running process
sudo jcmd <pid> VM.flags | tr ' ' '\n' | grep BASE64

For containers, set the same environment variable in your deployment manifest. A JVM that picks up the variable prints Picked up JAVA_TOOL_OPTIONS: … at startup, so you can grep the logs for that line.

Reduce exposure

  • Take Java admin consoles (Jenkins, Artifactory, Kafka UIs) off the public internet, or put them behind a VPN or allow list.
  • Shut down Java services you don't use. Calif's write-up makes the same point: code you don't run can't be attacked.
  • A WAF rule can block the most obvious malformed input as a temporary measure. Treat it as a speed bump, not a fix.

How to detect Java4Shell exploitation

There are no published indicators of compromise yet. These are the most useful signals:

  • JVM crashes. New hs_err_pid*.log files or SIGSEGV entries in syslog on Java hosts, especially repeated ones, since failed exploit attempts usually crash the JVM.
  • Odd Base64 in auth headers. In proxy or WAF logs, look for Basic or Bearer values that end in = and whose length leaves a remainder of 1 when divided by 4. Valid padded Base64 is always a multiple of 4 long. This also catches plain broken clients, so use it to triage, not to alert.
  • Spikes of Base64 validation errors. Many IllegalArgumentException messages from Base64 in application logs.
  • Post-exploitation behaviour. A Java process starting sh, bash, curl or wget, or making new outbound connections.
  • Inventory. Java 17, 21, 25 or 27 on AVX-512 VBMI hosts that accept inbound connections from the internet.

How Java4Shell was found

Calif says the bug was found during an AI-assisted audit of the JIT, intrinsics and crypto code. Finding it took about an hour and the first working exploit about two more. Most of the AI's early findings were false positives, and a human had to sort through them. The lesson isn't that AI hacks Java. It's that hand-written assembly in a runtime is now cheap to audit, for attackers as well as defenders. Expect more bugs like this.

Java4Shell FAQ

Is Java 8 or Java 11 affected by Java4Shell?

No. Standard Java 8 and 11 builds don't contain the AVX-512 Base64 decoder. The exception is Oracle's Java 8 Performance Pack (8u511b33-perf), which is fixed in 8u513-perf.

Are ARM64 servers like AWS Graviton affected?

No. The bug is only in the x86-64 AVX-512 code path. ARM64 and 32-bit x86 JVMs are not affected.

Is Java4Shell being exploited in the wild?

Not as of 18 November 2026. No attacks have been reported and the CVE is not in CISA's KEV catalogue. Researchers say they have working exploits for specific products, so expect that to change.

Does -XX:-UseBASE64Intrinsics fully mitigate Java4Shell?

Calif and JFrog both say disabling the intrinsic blocks exploitation, because the vulnerable code never runs. It is a stopgap. Update to a fixed JDK when your vendor ships one.

Only by name. Log4Shell (CVE-2021-44228) was a bug in the Log4j logging library. Java4Shell is in the JVM itself, so updating libraries doesn't fix it. You have to update the Java runtime.

Are Node.js, Python or Go applications affected?

Not directly, because the bug is in the JVM. Check the rest of your stack, though. Elasticsearch, Kafka, Jenkins and Keycloak all run on Java, even if your own code doesn't.

Summary: what to do now

  1. Check each x86-64 host for avx512vbmi and Java 17.0.6 or later. Include bundled JDKs and container images.
  2. Patch to a fixed build as soon as your vendor ships one, then restart every JVM.
  3. Until then, set JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics and confirm it with jcmd.
  4. Watch for JVM crashes and malformed Base64 in auth headers.
  5. Remember clients. Java programs that connect out to untrusted servers need the same treatment.

References