Java2Shell (CVE-2026-114938): a bug in the JVM's Base64 decoder, how to check and patch
Tung Bui Thanh (MikeDaDev)12 mins read

On this page
On the afternoon of 17 November, every company's security channel had the same link: Java had a new vulnerability called "Java4Shell", a name chosen to recall Log4Shell from 2021, scored CVSS 9.2 and able to take over a server without logging in. Within hours people were calling it "Java2Shell" to rhyme with PHP2Shell and Node2Shell from a few weeks earlier. Two names, one bug: CVE-2026-114938.
Unlike Log4Shell, which lived in a library, this one sits inside the JVM, in a call everyone makes without thinking: Base64.getDecoder().decode(...). This post covers where the bug is, why experts disagree about how serious it is, and most importantly how to check whether your systems are affected.
This post is based on public information as of 20 November 2026. I could not read the Oracle and OpenJDK advisories directly (both block automated tools), so the patch list is cross-checked across several independent analyses. Before patching, confirm against the release notes of the JDK vendor you actually use.
# timeline
The most striking part is that the bug has been public since June; nobody recognised it as a security issue.
| Date (2026) | Event |
|---|---|
| 9 June | A user opens issue #1480 on Adoptium about the JVM crashing during garbage collection. The issue is still open |
| 8 September | A reproducer appears and the root cause is identified the same day |
| 9 September | A fix, openjdk/jdk#32781, is opened with the title "AVX-512 Base64 decoder overwrites output buffer". It is closed on 4 November without being merged |
| 24 October | Quang Luong (Calif) rediscovers the bug with the Codex agent and reports it to Oracle with a post-auth Elasticsearch takeover PoC |
| 31 October | Calif sends pre-auth PoCs for Jenkins and Keycloak |
| 13 November | Oracle confirms the fix is done and schedules release for 17 November |
| 17 November | Oracle ships the patch, Calif publishes technical details, CISA issues an urgent alert |
| 17 to 18 November | Other teams reproduce independently; Harness reproduces the out-of-bounds write but not code execution |
Calif writes that the bug "is actually public (although people do not realize it)". A GC crash report, a fix with a very explicit title, and five months later a headline vulnerability. I come back to that lesson at the end.
# where the bug is
To decode Base64 quickly, HotSpot has an intrinsic: once Base64.Decoder is hot enough for the C2 JIT to compile it, the JVM swaps the Java body for hand-written machine code using AVX-512 VBMI instructions, processing 64 bytes per step. That machine code does not go through the array bounds checks that ordinary Java code does.
The bug is in how it handles a tail with = padding. Per the analyses by Calif and JFrog:
- The output length is computed as
(len / 4) * 3, minus 1 for each=. - For some inputs with a surplus trailing
=, that calculation wraps to -1. - The
BZHIinstruction uses the value to build a store mask, and -1 becomes a mask covering all 64 bytes. - The masked store writes 64 bytes into the destination array, 62 of them past its end, over whatever object sits next on the heap.
- Only after the write does the JVM notice the input is invalid and throw
IllegalArgumentException. The application sees an ordinary error; the heap is already damaged.
The trigger is simple: a run of valid Base64 characters followed by one =. Calif uses 64 As plus =; Java 17 needs 128 As. Since the intrinsic only runs after C2 has compiled the decoder, an attacker needs a warm service, but a server handling real traffic gets there within minutes.
# why Base64 decoding is so dangerous
Base64 shows up in many places where data arrives before the user is authenticated:
- The
Authorization: Basic ...header in Tomcat, Jetty, Undertow, Spring Security, Quarkus, Micronaut, Vert.x, Helidon, Shiro, Keycloak, Jenkins and more. - JWT headers and payloads, decoded before the signature is checked.
- Kafka's SASL SCRAM authentication, SAML assertions, and cookies and tokens of every kind.
So a carefully shaped Authorization header is enough to push malicious Base64 straight into the intrinsic. No account, no path guessing. That is why the bug is compared to Log4Shell, even though the mechanism is completely different.
# real RCE, or just a JVM crash
This is where the sources disagree, and you should know both sides before you set priorities.
Calif says it built two stages. First "JavaBleed", reading heap contents much like Heartbleed in 2014. Then remote code execution, by grooming the G1 heap and writing into the JIT Code Cache. It claims pre-auth chains for Keycloak, Jira, Confluence, JFrog Artifactory, Jenkins and PingFederate in default configurations, and post-auth chains for Kafka, Solr, Elasticsearch, Gerrit and Spinnaker. There is also a client-side variant: a Java application that opens a TLS connection to a malicious server can be compromised. Calif is withholding the exploit chains until people have had time to patch; its published PoC only demonstrates the memory corruption.
The sceptical side rests mainly on Harness's lab reproduction. It reproduced exactly 62 bytes written out of bounds, but found the overflowing bytes are a fixed pattern produced by the decoder, not chosen by the attacker. JFrog also notes these bytes are mostly the value 0x9a; the attacker only controls where they land. Harness could crash the JVM (a SIGSEGV in G1) with small TLABs, while with the default heap thousands of deliveries produced nothing visible. Datadog reaches a similar view: denial of service is the more readily achievable impact, and reliable RCE needs exploitation work specific to each application and environment.
The scores reflect the disagreement: Calif gives 9.2 under CVSS 4.0, while Oracle, as quoted by several analyses, gives 8.1 under CVSS 3.1, citing high attack complexity. CISA covers both: crafted input could crash the JVM and allow unauthenticated code execution.
My reading is this. Crashing a JVM remotely without authentication is certain on affected hardware, and that alone justifies urgent patching. RCE has been claimed by a credible team but not independently verified. Once Calif publishes its chains, the gap between "hard" and "there is a script for it" will be very short, so do not wait for that.
# who is affected
A machine has to meet all three conditions:
- An x86-64 CPU with AVX-512 VBMI: Intel Xeon from Ice Lake onwards (Sapphire Rapids, Emerald Rapids, Granite Rapids) and AMD from Zen 4 onwards. Most recent cloud instances fall in this group. ARM64 is not affected: Graviton, Ampere and Apple Silicon are safe.
- A JDK version in the affected range (table below).
- The intrinsic is enabled:
UseBASE64Intrinsicsdefaults totrueon supported CPUs.
Cross-checked from JFrog, Sweet Security and MQTec:
| Java line | Affected | Fixed in |
|---|---|---|
| 17 | 17.0.6 to 17.0.21.0.3 | 17.0.21.1 |
| 21 | up to 21.0.13.0.3 | 21.0.13.1 |
| 25 | up to 25.0.5.0.3 | 25.0.5.1 |
| 27 | up to 27.0.1.0.3 | 27.0.1.1 |
| 8 EPP "perf" builds | 8u511b33-perf | 8u513-perf |
Standard Java 8 and Java 11 builds, and OpenJ9, are not affected. Unsupported lines (18 to 20, 22 to 24, 26) get no fix, so if you still run them the only option is to move to a patched LTS. Other distributions such as Corretto, Temurin, Zulu, Liberica, SapMachine, Microsoft Build of OpenJDK and Red Hat share the HotSpot code and are affected too; each vendor ships its own fixed build numbers, so check their notes.
The biggest trap: the JDK installed on the host is not necessarily the one your application runs. Jira, Confluence, Jenkins, Keycloak, Elasticsearch, IntelliJ, many appliances and container images ship their own JRE. Patch the operating system's Java and forget the bundled runtimes, and you have not patched.
# checking whether you are affected
Step 1: does the CPU have AVX-512 VBMI? Run it inside the VM or container, because the CPU type the hypervisor exposes is what matters:
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'If it prints all four lines, avx512f, avx512bw, avx512vbmi and bmi2, the machine may be affected. If it prints nothing, or avx512vbmi is missing, the faulty intrinsic does not run there.
Step 2: find every running JVM and every bundled runtime.
# Running Java processes and the real binary path
ps -eo pid,args | grep -E '[j]ava ' | awk '{print $1, $2}'
for p in $(pgrep -f '[j]ava '); do readlink -f /proc/$p/exe; done | sort -u
# JREs scattered on disk, including runtimes bundled with applications
find / -type f -path '*/bin/java' 2>/dev/null | while read j; do echo "== $j"; "$j" -version 2>&1 | head -1; doneStep 3: is the intrinsic enabled? (run it with the application's own Java binary):
/path/to/bin/java -XX:+PrintFlagsFinal -version 2>/dev/null | grep -E 'UseBASE64Intrinsics|UseAVX 'UseBASE64Intrinsics = true with UseAVX = 3 on a VBMI-capable CPU is the dangerous combination. I tested this command and the intrinsic-disabling flags below on JDK 21; reproducing the bug itself needs an x86-64 CPU with AVX-512, so I could not run that part on an ARM machine.
For containers, scan images, not only running containers. JFrog Xray already covers this CVE with contextual analysis; with other scanners, check that their vulnerability database includes CVE-2026-114938 before trusting a clean result.
# patching and interim mitigations
The real fix is upgrading to your JDK vendor's patched build and restarting the application. For applications that bundle a JRE, wait for the vendor's update, or follow its guidance to point the application at a patched JDK.
Meanwhile there are two JVM flags, and both need a restart to take effect:
# Recommended: disable only the Base64 intrinsic and fall back to the safe Java implementation
-XX:-UseBASE64Intrinsics
# Heavier: disable AVX-512 entirely (x86-64 only)
-XX:UseAVX=2The quickest way to apply it to every Java process in a container is an environment variable:
export JAVA_TOOL_OPTIONS="-XX:-UseBASE64Intrinsics"The JVM prints Picked up JAVA_TOOL_OPTIONS: -XX:-UseBASE64Intrinsics at startup; use that line to confirm the flag took effect. I recommend -XX:-UseBASE64Intrinsics for two reasons. It only slows down Base64 decoding, whereas -XX:UseAVX=2 affects every piece of code that uses AVX-512 (crypto, compression, string handling). And -XX:UseAVX=2 prevents the JVM from starting on ARM (Unrecognized VM option 'UseAVX=2'), so pushing one configuration to both x86 and Graviton hosts would take down the ARM ones yourself.
At the application level you can add a filter: accept only canonical Base64, with the right length and = only at the end, before handing it to the decoder. This is an extra layer of defence and does not replace patching, because you do not control every library underneath that also calls Base64.getDecoder():
import java.util.Base64;
import java.util.regex.Pattern;
public final class StrictBase64 {
// Canonical standard Base64: groups of 4, '=' only as 1-2 trailing padding characters.
private static final Pattern CANONICAL =
Pattern.compile("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$");
private static final int MAX_LEN = 8 * 1024;
/** Rejects malformed input before it ever reaches Base64.Decoder. */
public static byte[] decode(String s) {
if (s == null || s.length() > MAX_LEN || !CANONICAL.matcher(s).matches()) {
throw new IllegalArgumentException("malformed Base64");
}
return Base64.getDecoder().decode(s);
}
}I ran it: valid input such as dXNlcjpwYXNz still decodes to user:pass, while both trigger shapes (64 or 128 As plus =) and a string with = in the middle are rejected before reaching Base64.Decoder. Calif and MQTec both point out that request size limits at a reverse proxy do not reliably block it, because the trigger is only a few dozen bytes long.
# signs of an attack
As of 20 November there is no confirmed exploitation in the wild; according to MQTec, GreyNoise has seen a few addresses sending requests that match the pattern. Things to watch:
- Unexpected JVM crashes, especially
hs_err_pid*.logfiles with a SIGSEGV in a GC thread (G1 or Parallel), right after a burst of failed authentication requests. The Adoptium crash report from five months ago looks exactly like this. Authorization: Basicheaders or JWTs containing a long run of repeated characters ending in a single stray=, with a length not divisible by 4.- As CISA recommends: unknown Java processes, and runtimes appearing outside your known inventory.
# lessons for operations teams
Vulnerabilities do not always arrive looking like vulnerabilities. Java2Shell sat on GitHub for five months as a GC crash report and a closed fix. If your team has had "unexplained" JVM crashes on newer servers, they are worth reopening.
Intrinsics and the JIT are machine code without a safety net. We think of Java as memory-safe, and for Java code that is true. But the hand-tuned paths inside the JVM skip the very bounds checks that make it safe. A speed optimisation that only runs on newer CPUs became a weakness that only exists on newer CPUs.
Know which runtimes you run. The three lessons from Log4Shell still hold: keep a software bill of materials (SBOM), scan both images and running hosts, and have a way to push a JVM flag across the whole estate in hours, not weeks.
AI is shortening the time from bug to exploit. According to MQTec, Calif needed about two hours and under 200 dollars to turn the bug into an exploit using an agent. If one side can move that fast, so can the other. The safe window between disclosure and mass exploitation keeps shrinking.
References:
- Calif: Java4Shell, write once, RCE everywhere (original disclosure)
- CISA: Critical Java vulnerability requires immediate patching (17 November 2026)
- JFrog Security Research: What we know about Java4Shell
- Harness: Past the end of the buffer, reproducing CVE-2026-114938 in the lab
Just personal notes, shared in the hope they are useful. If you found this helpful, feel free to pass it on to your friends and colleagues!
Happy coding ๐ ๐๐ป ๐ ๐ฅ.