Key Takeaways
- Java4Shell (CVE-2026-114938) is a heap out-of-bounds write in the HotSpot JVM's x86-64 Base64 decoder intrinsic.
- A malformed padded Base64 tail makes the decoder write 62 bytes past the end of its output buffer.
- Exploitation can crash the JVM, leak heap secrets such as private keys and tokens, or enable unauthenticated RCE.
- OpenJDK 17.0.6 and newer and its downstream distributions are affected only on x86-64 CPUs with AVX-512 VBMI.
- Patch the JDK, or disable the vulnerable path with -XX:-UseBASE64Intrinsics or -XX:UseAVX=2 until you can patch.
- Picus Threat Library threat 69479, Java4shell Web Attack Campaign, tests your defenses against Java4Shell attacks.
On November 17, 2026, OpenJDK published a security advisory and Oracle shipped a patch for CVE-2026-114938, a memory-corruption bug in the HotSpot JVM's x86-64 Base64 decoder. The researchers who found it call it Java4Shell. CISA has asked organizations to patch it immediately and to prioritize internet-facing systems [1].
An application is exposed when it decodes attacker-supplied Base64 on an affected JDK running on a CPU with AVX-512 VBMI. A malformed padded tail makes the JIT-compiled decoder write 64 bytes starting near the end of its output buffer. Depending on how the overwrite lands, an attacker can crash the JVM, read Java heap memory that may hold PII, private keys, secret keys and tokens, or achieve unauthenticated remote code execution against specific applications [2].
What is Java4Shell?
Java4Shell (CVE-2026-114938) is a heap out-of-bounds write in the Base64 intrinsic that HotSpot's C2 JIT compiler uses on x86-64. When the decoder is fed a specific malformed padded tail, it computes a negative output length, turns that into an all-ones store mask, and writes 64 bytes where it should write none. The Java code then rejects the input with IllegalArgumentException, but by that point the bytes past the end of the output buffer have already been overwritten.
Specially crafted Base64 input can crash the JVM, leak Java heap memory or lead to unauthenticated remote code execution. The heap leak, called JavaBleed, comes before code execution in the attack chain and can expose PII, private keys, other secret keys and tokens.
Three conditions limit where the bug can be reached:
- The JVM has to run on an x86-64 CPU with AVX-512 VBMI. ARM64 is not affected.
- The decoder has to be compiled by C2 before the malformed input arrives. An attacker can arrange this by sending valid Base64 until the JIT picks the vectorized path.
- Code execution needs an application-specific exploit, and every target needs its own profile. Weaponized chains for individual products, including Elasticsearch, have not been published yet.
Which Products Are Affected by Java4Shell?
A system is affected when it runs a vulnerable JDK build on a CPU that supports AVX-512 VBMI. Both conditions have to hold.
Java runtimes
OpenJDK 17.0.6 and newer is affected. Distributions built from OpenJDK inherit the bug:
- Amazon Corretto
- Eclipse Temurin
- Microsoft Build of OpenJDK
- Azul Zulu
- BellSoft Liberica
- SAP SapMachine
- Red Hat OpenJDK
- Oracle OpenJDK
- Oracle Java SE
- 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 [3]. The 8u entry falls outside the 17.0.6-and-newer OpenJDK range, so check the Oracle advisory for the exact ranges that apply to your builds.
JDKs and Java runtimes often do not appear as separate entries in software inventories. Look inside third-party applications that bundle their own runtime, container images and appliances as well as host-installed JDKs.
CPUs
The vulnerable code path only exists on x86-64 processors with AVX-512 VBMI. These mainstream families meet the requirement:
|
Vendor |
Families |
|
Intel Xeon |
Ice Lake, Sapphire Rapids, Emerald Rapids, Granite Rapids |
|
AMD EPYC and Ryzen |
Zen 4 or newer |
On Linux, this command shows whether a host has the required CPU features. All four flags must appear in the output for the host to be exposed:
|
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$' |
Because exposure depends on the host CPU, a container image that is safe on an older node becomes exposed when it is scheduled onto one of the families above. Patch every affected JDK whatever the CPU, and use the CPU check to decide which systems go first.
How Does Java4Shell Work?
The bug is a wrong length calculation in hand-written vector code that the JIT substitutes for java.util.Base64 decoding.
C2 and the Base64 intrinsic
HotSpot starts by interpreting bytecode and compiles methods that run often. C2 is its most aggressive compiler tier. For some library methods, C2 does not compile the Java code at all. It swaps in an intrinsic, a stub of hand-written machine code that uses CPU-specific instructions.
On x86-64 with AVX-512, the Base64 decode intrinsic works through the input in 256-byte blocks, then 64-byte blocks, and handles the final tail of fewer than 64 bytes with a masked vector move. That move is evmovdqub, HotSpot's assembler wrapper for VMOVDQU8. It takes a 64-bit mask register and loads or stores only the bytes whose mask bit is set. The stub builds one mask for reading the tail and another for writing the decoded bytes.
The stub returns how many bytes it decoded and stops early on invalid input. Java code finishes whatever the stub did not, and throws IllegalArgumentException if the input is malformed.
The store mask bug
The tail masks are derived from the tail length and then corrected for = padding. Simplified, the logic is:
|
// tail of fewer than 64 input bytes in_mask = bzhi(ALL_ONES, in_len) // keep the low in_len bits out_len = (in_len / 4) * 3 // integer division if in[in_len - 1] == '=': out_len -= 1; in_mask >>= 1 if in[in_len - 2] == '=': out_len -= 1; in_mask >>= 1 out_mask = bzhi(ALL_ONES, out_len) |
The code assumes the tail holds at least one complete 4-character group before padding is subtracted. When the tail is =, ==, ===, X=, X== or XY=, the tail length is 1 to 3, so in_len / 4 is 0 and out_len starts at 0. The padding check then subtracts 1 or 2, and out_len underflows to -1 or -2.
BZHI clears bits from the position given by the low 8 bits of its index operand. For -1 or -2 that position is 255 or 254. Any position of 64 or more clears nothing, so out_mask stays all ones. The following masked store writes all 64 lanes of the vector register to the destination:
|
evmovdqub(Address(dest, dp), // current output position k1, // k1 = out_mask = 0xFFFFFFFFFFFFFFFF tmp, // decoded vector true, Assembler::AVX_512bit); |
Walking through the trigger
Take 64 A characters followed by one =, 65 bytes in total.
- Base64.Decoder sizes the output as ceil(65 / 4) × 3 − 1 padding byte, which is a 50-byte array.
- The stub decodes the first 64 characters as one 64-byte block. That produces 48 bytes at offsets 0 to 47.
- The tail is the single =. out_len becomes -1 and out_mask becomes all ones.
- The masked store writes 64 bytes starting at offset 48. Offsets 48 and 49 are inside the array. Offsets 50 to 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 62 out-of-bounds bytes are already in the heap by then, so the corruption succeeds even though the decode call fails.
On OpenJDK 17 the vectorized path starts at a larger input size, so the equivalent trigger is 128 A characters plus =.
Turning the overwrite into an attack
The overwrite is small and made mostly of fixed bytes, so on its own it gives an attacker little control. What the attacker can influence is where it lands. The exploit arranges memory so that the decoder's output buffer sits right next to other objects the application uses, and the overwrite damages those neighbours in a useful way.
The published exploit then works in three stages:
- Get a wider write. The overwrite corrupts the size field of a neighbouring buffer. The application then writes past the real end of that buffer, which gives 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 (JavaBleed).
- Take control. With the ability to read and write heap memory, the attacker can change application data or go further and reach the JVM's compiled code, which leads to code execution.
Arranging the heap remotely
For this to work, the right objects have to sit next to each other in memory, and Java does not place objects in a fixed order. Each thread allocates from its own area, and the G1 garbage collector splits the heap into regions [4]. The exploit works around this by creating many candidate neighbour objects and sending its HTTP requests in timed pieces, so that allocations happen in a predictable order. It checks the response size to see whether the layout lined up, and retries if it did not.
This makes the attack sensitive to network latency, and it is more reliable when the attacker is close to the target, for example in the same cloud region. A wrong guess can crash the JVM, but the attacker can usually try again.
Constraints on exploitation
The attack does not work the same way everywhere. Some versions of it send a request in small timed pieces, and a reverse proxy that waits for the full request before passing it on, as nginx does by default [5], breaks that timing. Proxy buffering is still not a full defence, for two reasons. First, the exploit against Elasticsearch fits in a single complete request, so it does not rely on timed pieces and buffering does not affect it. Second, once a connection is upgraded to WebSocket, nginx forwards later messages straight to the application without buffering them, so the timing trick works again over that connection.
There is also no single payload that works against every application. Each target needs its own exploit, built around how that application uses Base64 and what it sends back.
How to Remediate or Mitigate Java4Shell?
Update the JDK. OpenJDK released its security advisory [6] and Oracle released its Critical Security Patch Update [3] at 1:00 pm PT on November 17, 2026. Use your distribution vendor's patched build for Corretto, Temurin, Zulu and the others listed above, and patch internet-facing systems first.
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. For each one, record the Java version and whether the host CPU has the four flags listed in the affected products section.
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. Disable the vulnerable code path until you can patch
Two JVM flags remove the vulnerable path:
|
Flag |
Effect |
|
-XX:-UseBASE64Intrinsics |
Turns off hardware-accelerated Base64 encoding and decoding. |
|
-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.
3. Monitor for exploitation
Watch for rogue runtimes, unexpected JVM crashes and suspicious Java processes. A failed exploitation 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 steps described above.
How Picus Simulates Java4Shell (CVE-2026-114938) Attacks?
We also strongly suggest simulating Java4Shell (CVE-2026-114938) attacks to test the effectiveness of your security controls against real-life cyber attacks using the Picus Platform. You can also test your defenses against other vulnerability exploitation attacks, such as regreSSHion, Citrix Bleed, and Follina, within minutes with a 14-day free trial of the Picus Platform.
Picus Threat Library includes the following threats for the Java4Shell (CVE-2026-114938) attacks:
|
Threat ID |
Threat Name |
Attack Module |
|
69479 |
Java4shell Web Attack Campaign |
Web Application |
Start simulating emerging threats today
Get actionable mitigation insights with a 14-day free trial of the Picus Platform.