Every Java application decodes Base64. Tokens, file uploads, API payloads, SAML assertions, JWTs — the little alphabet of A-Za-z0-9+/= is everywhere, and every time your server touches it, java.util.Base64 does the work. On 17 November 2026, researcher Q. Luong of Calif showed that this most boring of operations can corrupt the JVM's heap and, in the right application, hand an unauthenticated attacker a remote shell. The bug is Java4Shell (CVE-2026-114938), and the scariest part is how ordinary the trigger looks: 64 letter A's followed by a single =.
That is not a typo. One malformed input, 65 bytes long, makes the HotSpot JVM write 62 bytes past the end of a heap buffer — and then, helpfully, the Java code reports the whole thing as an ordinary decoding error.
01A bug in the fast path, not the Java code
The flaw does not live in the Java implementation of Base64. It lives in the intrinsic — the hand-written machine code that HotSpot's C2 compiler substitutes for java.util.Base64 when the method runs hot. JIT compilation means the JVM starts by interpreting bytecode and compiles frequently-run methods into native code; for a handful of library methods, C2 does not compile the Java at all, it swaps in a stub written to exploit the CPU's vector instructions directly.
On x86-64 chips with AVX-512 VBMI, that stub decodes in 256-byte blocks, then 64-byte blocks, and handles the final tail — fewer than 64 bytes — with a masked vector store. The stub builds a mask from the tail length, corrects it for = padding, and stores only the bytes the mask allows. The bug is in that correction.
Simplified, the logic computes the output length as (in_len / 4) * 3, then subtracts 1 for each trailing = character — assuming the tail holds at least one complete 4-character group first. But when the tail is just =, ==, ===, X=, X==, or XY=, its length is 1 to 3, so in_len / 4 is 0, and subtracting the padding sends the output length negative, to -1 or -2.
That negative length flows into a BZHI instruction, which uses the low 8 bits of its index to decide how many bits to keep. For -1 or -2 that position is 255 or 254 — and any position of 64 or more clears nothing. The output mask stays all ones. The following masked store then writes all 64 lanes of the vector register to the destination.
02Walking through the trigger
Take 64 A characters followed by one =, 65 bytes in total:
Base64.Decodersizes the output as ceil(65 / 4) × 3 − 1 padding byte — a 50-byte array.- The stub decodes the first 64 characters as one 64-byte block, producing 48 bytes at offsets 0–47.
- The tail is the single
=. The output length becomes -1 and the mask becomes all ones. - The masked store writes 64 bytes starting at offset 48. Offsets 48 and 49 are inside the array. Offsets 50–111 — 62 bytes — are past its end.
- The stub reports the input as invalid. Java throws
IllegalArgumentException, and the caller sees an ordinary decoding error. The corruption is already in the heap.
On OpenJDK 17 the vectorized path starts at a larger input size, so the equivalent trigger is 128 A characters plus =.
03From 62 bytes to a shell
A 62-byte overwrite of mostly fixed bytes is not, by itself, code execution. What the attacker controls is where it lands. The published exploit works in three stages:
- Get a wider write. The overwrite corrupts the size field of a neighbouring buffer. The application then writes past that buffer's real end, giving the attacker a larger write with values of their choosing.
- Read memory. The wider write enlarges another buffer whose contents the application sends back in a response. The response now carries extra heap memory — which is how keys, tokens, and other secrets leak. This stage has its own name: JavaBleed.
- Take control. With the ability to read and write heap memory, the attacker can change application data or reach the JVM's compiled code, which leads to remote code execution.
Arranging the heap is the hard part. Java does not place objects in a fixed order, and each thread allocates from its own area. The exploit works around this by creating many candidate neighbour objects and sending its HTTP requests in timed pieces, so allocations happen in a predictable order — then it checks the response size to see whether the layout lined up, and retries if it did not. That makes the attack sensitive to network latency, and more reliable when the attacker is close to the target. A wrong guess can crash the JVM, but the attacker can usually try again.
There are real constraints. A reverse proxy that waits for the full request before passing it on — nginx does this by default — breaks the timing trick. But that is not a full defence: the exploit against Elasticsearch fits in a single complete request, and once a connection is upgraded to WebSocket, nginx forwards later messages straight to the application without buffering them. And there is no single payload that works everywhere — each target needs its own exploit, built around how that application uses Base64 and what it sends back.
04Who is actually exposed
Both conditions have to hold: a vulnerable JDK and a CPU with AVX-512 VBMI. OpenJDK 17.0.6 and newer is affected, along with every distribution built from it — Amazon Corretto, Eclipse Temurin, Microsoft Build of OpenJDK, Azul Zulu, BellSoft Liberica, SAP SapMachine, Red Hat OpenJDK, Oracle OpenJDK, Oracle Java SE, and Oracle GraalVM for JDK. Vulnerable Oracle Java SE versions are 8u511b33-perf, 17.0.21.0.3, 21.0.13.0.3, 25.0.5.0.3, and 27.0.1.0.3.
On the CPU side, the vulnerable path exists on Intel Xeon Ice Lake, Sapphire Rapids, Emerald Rapids, and Granite Rapids, and on AMD EPYC and Ryzen Zen 4 or newer. ARM64 is not affected. Check a Linux host with:
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'
All four flags must appear for the host to be exposed. But exposure depends on the host CPU, so a container image that is safe on an older node becomes exposed when it is scheduled onto a newer one. Patch every affected JDK whatever the CPU, and use the CPU check to decide which systems go first.
Oracle scores the flaw 8.1 (High) under CVSS 3.1; Calif Research scores it 9.2 (Critical) under CVSS 4.0. CISA issued an alert on 17 November urging organisations to patch immediately and prioritise internet-facing systems. As of 18 November it was not yet listed in CISA's Known Exploited Vulnerabilities catalog — but absence from that catalog is not evidence of safety.
05What to do this week
1. Find every Java runtime. Review software inventories for JDKs and Java runtimes — including ones bundled inside third-party applications, container images, and appliances. Bundled runtimes often do not show up as separate inventory entries. Vendor appliances and applications that ship their own JRE cannot be fixed by updating the system JDK; apply the vendor's patch when it is available.
2. Patch the JDK. OpenJDK published its security advisory and Oracle shipped its Critical Patch Update on 17 November. Use your distribution vendor's patched build for Corretto, Temurin, Zulu, and the rest — and patch internet-facing systems first.
3. If you cannot patch yet, disable the vulnerable code path. Two JVM flags remove it entirely:
-XX:-UseBASE64Intrinsics # turns off hardware-accelerated Base64
-XX:UseAVX=2 # turns off AVX-512 in the JVM (x86-64 only)
For runtimes you cannot easily relaunch with new arguments, the JAVA_TOOL_OPTIONS environment variable passes flags to any JVM that starts in that environment. Confirm the flag took effect on a test system before relying on it.
4. Monitor for exploitation attempts. A failed attempt can crash the JVM, and an attacker can retry — so repeated crashes or restarts of an internet-facing Java service deserve investigation. Bursts of Base64 decoding errors on the same endpoint, or unusually large responses from an endpoint that echoes decoded data, fit the trigger and disclosure stages of this attack.
06The lesson that outlives the patch
Java4Shell is a reminder that the most dangerous code in your stack is often the code you never wrote and never review: a hand-optimised intrinsic, buried three layers below your application, in a function so fundamental that nobody thinks to question it. Your application did not have a Base64 bug. The platform did — and your application inherited it the moment it decoded untrusted input.
That is also why the fix is boring in the best way: update the JDK, or flip one flag. No architecture change, no rewrite, no new product. The hard part is only finding every runtime you actually run — the bundled ones, the ones inside containers, the ones in appliances you forgot were Java at all.
Sixty-five bytes. One =. That is all it takes to remind a whole industry that the decoder is part of the attack surface too.