Introduction
An easy-to-understand explanation of how a tiny counting mistake inside Java’s Base64 decoder can lead to memory corruption, and how an attacker may turn it into Remote Code Execution.
Imagine a shelf with exactly 50 slots reserved for you. Your neighbour’s shelf stands right next to it.
Now imagine a helper is told to put away "-1 items". A sensible helper would do nothing. But what if the helper reads "-1" as "put away everything" and starts filling 64 slots?
Your 50 slots overflow, and the extra items land on your neighbour’s shelf.
That is the basic idea behind Java4Shell (CVE-2026–114938), a heap out-of-bounds write inside the Java runtime itself.
The bug was reported by Calif and disclosed on 17 November 2026, the same day OpenJDK published its advisory and Oracle shipped patches. Oracle rates it CVSS 3.1: 8.1 (High), and early reports using CVSS 4.0 give 9.2.
Let’s understand how this works step by step.
1. First, Understand What Base64 Is
Many systems can only carry plain text, such as emails, JSON, and web forms. When an app needs to send a file, an image, or a login token through them, it first converts the binary data into harmless letters and numbers.
That conversion is called Base64.
For example:
Hello ──(encode)──→ SGVsbG8= ──(decode)──→ Hello
The = at the end is padding. It simply fills the last empty space, like bubble wrap in a shipping box.
Java decodes Base64 constantly, for example when it reads a login token (JWT), an API payload, or an uploaded image. That is why a vulnerability in this core decoder matters so much across the enterprise ecosystem.
2. What Is a JIT Intrinsic? (Java’s “Speed Mode”)
Java does not run everything slowly. The Java runtime, HotSpot, starts by interpreting bytecode, then compiles the methods that run frequently. Its most aggressive compiler is called C2.
For certain heavily used standard library methods, C2 does not compile the standard Java bytecode at all. Instead, it swaps in an intrinsic: a small piece of hand-written machine code that uses specialized CPU vector instructions to achieve maximum throughput.
For Base64 decoding on x86–64 CPUs with AVX-512 VBMI, the intrinsic works like this:
Input
│
├── 256-byte blocks → decoded quickly
├── 64-byte blocks → decoded quickly
└── final tail (<64) → decoded with a masked store
A masked store writes data into memory, but only the bytes selected by a bitmask. Think of the mask as a stencil that instructs the CPU: "write only here".
If the stencil calculation is incorrect, the write goes where it should not.
3. What Is a Heap Out-of-Bounds Write?
A program keeps its dynamically allocated objects in an area of memory called the heap. Each buffer receives a fixed amount of space based on the expected decoded output size.
An out-of-bounds write occurs when the program writes past the end of that reserved space.
Normal:
[ Buffer (50 bytes) ][ Neighbour object ]
└─ write stays inside ─┘
Out-of-bounds:
[ Buffer (50 bytes) ][ Neighbour object ]
└─ write ─────────────────────→ spills into the neighbour
The overwritten neighbour may be another object, an array header, or internal metadata used by the application. This is classic memory corruption.
4. What Is the Bug in CVE-2026–114938?
Now let’s connect the concept to the actual vulnerability.
When the decoder handles the final tail of the Base64 input, it calculates how many bytes it should write. The assembly implementation assumes the tail contains at least one full group of 4 characters before padding is stripped.
But what happens if the tail is malformed and consists only of =, ==, X=, or XY=?
Tail length = 1 to 3 characters
Full groups (÷ 4) = 0
Bytes to write = 0
Padding adjustment = minus 1 or 2
↓
Bytes to write = -1 or -2 (integer underflow)
A negative count is invalid for generating a store mask. However, the vector hardware instruction only inspects the low 8 bits of that integer, meaning -1 (0xFF) is evaluated as 255. A shift value of 64 or greater clears nothing, causing the mask to end up with every single bit enabled:
Expected: "write 0 bytes" → mask = 0000...0000
Actual: "write -1 bytes" → mask = 1111...1111 → writes all 64 bytes
A Simple Walkthrough
Take 64 A characters followed by a single = (65 characters in total):
- Step 1: Java allocates a 50-byte output byte array.
- Step 2: The first 64 characters decode into 48 bytes, written at positions 0 to 47.
- Step 3: The tail is the single
=, so the byte count underflows to-1and the mask becomes all ones. - Step 4: The decoder writes 64 bytes starting at index 48. Positions 48 and 49 lie inside the array. The remaining 62 bytes land directly outside it.
- Step 5: The decoder notices the input format is invalid, and Java throws an
IllegalArgumentException.
On older OpenJDK 17 builds, the trigger requires 128 A characters plus =.
[ 0 ........ 47 ][ 48 ][ 49 ][ 50 ............. 111 ]
decoded data inside array 62 bytes OUTSIDE the array
[IMPORTANT] The
IllegalArgumentExceptionis thrown after the out-of-bounds write occurs. The application catches a normal "invalid input" error, but heap memory has already been corrupted behind the scenes.
5. How Can This Lead to Remote Code Execution?
This is the most critical part of understanding the exploit chain.
The overwrite on its own is relatively small and consists mostly of predictable bytes, so it grants an attacker little immediate control. What the attacker can influence is where those bytes land on the heap.
If the overwrite corrupts the metadata or length field of an adjacent object, it can be leveraged into a powerful primitive:
Malformed Base64 tail
↓
Out-of-bounds write
↓
Neighbouring object corrupted
↓
Wider read / write access to heap memory
↓
Secrets leaked, data altered
↓
Potential Remote Code Execution
The Attack Flow
The published vulnerability research describes a multi-stage sequence:
- Step 1: Warm up the JIT compiler. Java only switches to the vulnerable AVX-512 intrinsic after C2 compiles the Base64 method. An attacker sends repeated valid Base64 payloads until the JIT optimizes the path.
- Step 2: Heap grooming. The exploit sends requests in carefully timed chunks to arrange memory. By creating and releasing objects, the attacker places the target object immediately adjacent to the decoder’s output buffer.
- Step 3: Trigger the overflow. The malformed tail is submitted, causing the 62-byte out-of-bounds write to smash the adjacent object's length or pointer fields.
- Step 4: Memory leak (JavaBleed). With an object length inflated, the application returns more memory than intended. Responses begin leaking raw heap fragments, including session tokens, passwords, and TLS private keys.
- Step 5: Arbitrary code execution. By chaining heap manipulation primitives, an attacker may overwrite critical pointers or JVM internal data structures to redirect code execution flow.
Does One Request Give the Attacker a Shell?
Not necessarily.
The malformed Base64 is only the entry trigger. Converting it into reliable RCE requires complex heap layout grooming, memory disclosure, and target-specific orchestration. Each application handles Base64 differently, meaning universal, turn-key exploits are rare.
[NOTE] Not every memory corruption bug results in RCE. In many cases, unexpected memory corruption simply causes a
SIGSEGVor crashes the JVM. Successful exploitation depends heavily on application memory patterns.
A reverse proxy that buffers incoming requests completely (such as standard NGINX configurations) can interfere with timed chunk exploits. However, single-request triggers (demonstrated against services like Elasticsearch) and WebSocket endpoints bypass buffering defenses.
6. Who Is Affected?
A deployment is exposed only when all three of the following conditions are met:
Vulnerable Java build
+ x86–64 CPU with AVX-512 VBMI
+ Attacker-controlled Base64 input
=================================
Exposed to CVE-2026–114938
1. Hardware Architecture
The intrinsic requires an x86–64 CPU with AVX-512 VBMI support (specifically avx512f, avx512bw, avx512vbmi, and bmi2). Compatible processors include:
- Intel: Xeon Ice Lake, Sapphire Rapids, Emerald Rapids, Granite Rapids, and modern desktop/server chips supporting AVX-512 VBMI.
- AMD: EPYC and Ryzen processors based on Zen 4 or newer architectures.
- ARM64: Not affected (ARM utilizes different vector instructions and intrinsics).
2. Software Versions
OpenJDK 17.0.6 and later is affected across downstream distributions:
- Oracle Java SE:
8u511b33-perf,17.0.21.0.3,21.0.13.0.3,25.0.5.0.3, and27.0.1.0.3. - Adoptium / Eclipse Temurin, Amazon Corretto, Azul Zulu, BellSoft Liberica, Microsoft Build of OpenJDK, Red Hat OpenJDK, SAP SapMachine.
[!WARNING] In Kubernetes clusters, a container running on a non-AVX node is safe, but migrating or rescheduling that same pod onto a node with AVX-512 VBMI hardware immediately activates the vulnerable code path.
7. What Is the Impact?
Successful exploitation may allow an unauthenticated remote attacker to:
- Denial of Service (DoS): Crash the JVM worker process, leading to repeated service interruptions.
- Information Disclosure (JavaBleed): Exfiltrate sensitive secrets, cryptographic keys, authentication tokens, and user records stored in heap memory.
- Remote Code Execution (RCE): Achieve arbitrary code execution with the operating system privileges of the Java process.
Enterprise products such as Jenkins, Atlassian Jira, Confluence, and Keycloak were analyzed by security researchers and confirmed vulnerable under qualifying hardware conditions. The vulnerability resides entirely within the Java runtime, meaning application-level code does not need to have flaws to be compromised.
8. How Can Organizations Protect Themselves?
The primary and recommended action is upgrading the Java runtime to a patched build.
These are the affected and fixed versions according to the official advisories:
| Product | Affected Versions | Fixed Versions |
|---|---|---|
| **OpenJDK 17** | `17.0.6` and later (before fix) | `17.0.21.1` |
| **OpenJDK 21** | Builds before the fix | `21.0.13.1` |
| **OpenJDK 25** | Builds before the fix | `25.0.5.1` |
| **OpenJDK 27** | Builds before the fix | `27.0.1.1` |
| **Amazon Corretto** | Builds based on affected OpenJDK | `17.0.21.1.2`, `21.0.13.1.2`, `25.0.5.1.2`, `27.0.1.1.4` |
| **Oracle Java SE** | `8u511b33-perf`, `17.0.21.0.3`, `21.0.13.0.3`, `25.0.5.0.3`, `27.0.1.0.3` | See Oracle November 2026 Critical Patch Update |
Important Deployment Traps
- Container Base Images: Patching the host OS does not patch the Java runtime inside Docker containers. Rebuild container images on updated base distributions.
- Embedded / Bundled Runtimes: Many third-party enterprise tools ship with their own isolated JRE/JDK directory. Upgrading the system Java will not protect bundled installations; vendor application patches must be applied.
Temporary JVM Mitigation
If immediate patching is not possible, disable the vulnerable intrinsic at JVM startup:
# Disable Base64 intrinsic acceleration
java -XX:-UseBASE64Intrinsics -jar app.jar
Alternatively, disabling AVX-512 extensions (-XX:UseAVX=2) forces Java to avoid AVX-512 instructions, mitigating the intrinsic without disabling all vectorization.
What Should Defenders Watch For?
Exploit attempts frequently cause transient JVM segmentation faults. Key telemetry signals to monitor in SIEM solutions:
- Repeated crashes or process restarts with freshly generated
hs_err_pid*.logcrash dumps. - Sudden spikes in
java.lang.IllegalArgumentException: Input byte array has incorrect ending byteacross web application endpoints. - Unusually large HTTP responses originating from endpoints that reflect decoded data back to clients.
- Relevant MITRE ATT&CK technique: T1190 — Exploit Public-Facing Application.
Conclusion
CVE-2026–114938 demonstrates how a subtle arithmetic underflow in high-performance assembly code can compromise memory safety in a memory-safe language like Java.
The defect arises when a fast Base64 intrinsic interprets a negative length as an all-ones bitmask, writing 64 bytes into adjacent memory before any exception is thrown. With deliberate heap alignment, this localized overflow can escalate from denial of service into memory disclosure and remote code execution.
Even fundamental standard library helpers require defensive design. Audit your Java runtimes, patch host installations and container images, and apply JVM flags where patching requires scheduled downtime.
References and Further Reading
- OpenJDK Vulnerability Advisory (2026-11-17)
- Calif: Java4Shell Technical Write-up
- Oracle Critical Security Patch Update
- CISA Alert: Critical Java Vulnerability Requires Immediate Patching
- Picus Security: Java4Shell Explained
- Help Net Security: Java4Shell OpenJDK Flaw
- GitLab: How to Find and Fix Java4Shell
Connect & Contact
- Buy Me a Coffee: buymeacoffee.com/jaseervk
- GitHub: github.com/jaseervk
- Portfolio: www.jaseervk.com
- Blog: blog.jaseervk.com
- LinkedIn: linkedin.com/in/jaseer-vk-
- Medium: https://medium.com/@jaseervk321