Base64.getDecoder().decode() is one of the most-called methods in enterprise Java. HotSpot replaces its body on x86-64 CPUs with AVX-512 VBMI, substituting roughly five hundred lines of hand-written assembly committed in JDK 18 and backported to 17.0.6. The Java method validated its input before writing. The assembly that replaced it does not, and on a 129-byte input ending in = it writes 62 bytes past the end of the destination array, after which the Java method's exception handler fires on the input it should have refused. CVE-2026-114938 is that gap, called Java4Shell by the Calif researchers who disclosed it, affecting Oracle Java SE 17, 21, 25, 27 and every OpenJDK distribution built from the same tree.
CVE-2026-114938: HotSpot Swapped Java's Base64 Decoder for 500 Lines of AVX-512. The Length Check Did Not Come Along.
vendor
pattern
cve
proof of concept
- infosec.exchange/@Blackpoint_APG/117631853934152633
- infosec.exchange/@DarkWebInformer/117632801815103850
- infosec.exchange/@rwhitworth/117632754496643620
- ashrafzaryouh/CVE-2026-114938%20(%E2%98%851)
- jeffschafer/BigFix-Java4Shell-CVE-2026-114938-Scanner%20(%E2%98%850)
- infosec.exchange/@greynoise/117634650115444443
- infosec.exchange/@technotenshi/117634573666907039
- seclists.org/oss-sec/2026/q4/757
- theori-io/java4shell-runtime-patch-CVE-2026-114938%20(%E2%98%855)
- arturo-b-cmu/CVE-2026-114938%20(%E2%98%850)
- Pwned-test/cve-2026-114938-java17-PoC%20(%E2%98%850)
- jeffschafer/MANUAL-Scanner-Java4Shell-CVE-2026-114938%20(%E2%98%850)
- Dungsocool/CVE-2026-114938%20(%E2%98%850)
- pathcosmos/CVE-2026-114938%20(%E2%98%850)
- arkrwn/PoC-CVE-2026-114938%20(%E2%98%850)
- douglasmun/CVE-2026-114938_Java4Shell_lab%20(%E2%98%850)
- klapertart/Java4Shell-CVE-2026-114938-Summary%20(%E2%98%850)
- infosec.exchange/@security_crawler_carl/117636477665273969
- infosec.exchange/@decio/117636418753142030
- infosec.exchange/@elhackernet/117636389075458212
- arkrwn/PoC-CVE-2026-114938-CrashLeak%20(%E2%98%850)
- ubitquity/cve-2026-114938-java4shell-remediation%20(%E2%98%850)
- infosec.exchange/@pentesttools/117637500865661198
- avergnaud/cve-2026-114938%20(%E2%98%850)
- avoliomattia/CVE-2026-114938%20(%E2%98%850)
- infosec.exchange/@AAKL/117638466080268332
- alequinterok/CVE-2026-114938%20(%E2%98%850)
- zulloper/cve-2026-114938-spring-poc%20(%E2%98%850)
- yora1928/CVE-2026-114938_by_yora1928%20(%E2%98%850)
- akamai/CVE-2026-114938-java4shell-validation-mitigation%20(%E2%98%850)
- TahuCryptsi/poc-cve-2026-114938-java4shell-base64-oob%20(%E2%98%851)
- infosec.exchange/@censys/117639342322661606
- DistributedIT/cve2026-114938-java4shell-check%20(%E2%98%851)
- LLCForge/CVE-2026-114938%20(%E2%98%850)
- Quaerendir/cve-2026-114938-java4shell-audit%20(%E2%98%850)
- Certbn/CVE-2026-114938-OpenJDK-HotSpot-AVX-512-Base64-Java4Shell-%20(%E2%98%850)
- sam00/Java4Shell-CVE-2026-114938-PoC%20(%E2%98%850)
- alt3kx/CVE-2026-114938%20(%E2%98%850)
- shivabalaj/CVE-2026-114938%20(%E2%98%850)
- seclists.org/oss-sec/2026/q4/786
- gbuyssens/CVE-2026-114938%20(%E2%98%850)
- gbuyssens/CVE-2026-114938-Check%20(%E2%98%850)
- tc4dy/CVE-2026-114938-Toolkit%20(%E2%98%855)
- kjry8sb/java4shell_CVE-2026-114938%20(%E2%98%850)
- uxokpro1234/Java4Shell-CVE-2026-114938-Defender%20(%E2%98%852)
- tomcek42/Omnissa-UAG_CVE-2026-114938-remediation%20(%E2%98%850)
- Pamircil/Symantec-DLP-25.x-26.x-CVE-2026-114938-Java4Shell-Fixing%20(%E2%98%850)
- infosec.exchange/@stackwatch/117653990957025965
HotSpot replaced the method. It did not replace the invariants.
java.util.Base64.Decoder.decode0 is a plain Java method with a plain Java preamble: length checks, the standard bounds-checked array writes the Java verifier inserts, and an IllegalArgumentException path for malformed padding. When C2 compiles a caller of decode0 on a host whose CPU reports avx512f, avx512bw, avx512vbmi, and bmi2, HotSpot substitutes the method body wholesale with _base64_decodeBlock, a native stub emitted by StubGenerator::generate_base64_decodeBlock() at src/hotspot/cpu/x86/stubGenerator_x86_64.cpp:5945 in jdk17u. The stub was added in JDK 18 and backported to 17.0.6. Encoding is one surface of the Base64 API; decoding is the other. Both the Java body and the native stub implement the same contract the caller sees. One of them carries the invariants that made the contract safe. The other was authored against the Base64 specification and the Intel software developer's manual.
This is a parallel-implementation-gap in the shape the pattern names. The security invariant that has to hold, "write only as many bytes into the destination as the input actually decodes to," lives in the Java bytecode of decode0 as checks the compiler inserts around the array stores. The intrinsic that replaces the method body at JIT-compile time implements the same client-facing contract and never imports those checks. For callers of Base64.getDecoder().decode(byte[], byte[]), which Spring Security's Basic-auth header parser, Tomcat and Jetty 12's authentication filters, java-jwt's JWT segment decoder, Keycloak's SAML endpoints, and Jenkins, Jira, and Confluence's pre-authentication code paths all reach, the gated surface disappears the moment C2 warms up.
The Tomcat administrator who configured a Spring Boot service to accept Authorization: Basic is the victim of record. Nothing they wrote in their application calls into native code. The instant C2 compiles a caller of decode0 with the right CPU flags, every subsequent Base64 decode in their process runs assembly they did not choose and that nobody at their vendor wrote the length check for.
Three arithmetic primitives agreed on a 64-byte write to a 0-byte output
The vectorized decoder processes input in 64-byte chunks, writes 48-byte output chunks, and falls into the label L_finalBit with 1 to 63 bytes of tail left. The tail path computes the output length by taking length >> 2 and multiplying by 3. For length of 1, 2, or 3 bytes, that output length is zero. The path then checks whether the input ends with = and decrements the output length by one for each padding character present. output_size is now -1 or -2.
Here is the pre-patch path, verbatim from the assembly emitter:
__ BIND(L_finalBit);
// Now have 1 to 63 bytes left to decode
// (no length guard here in the vulnerable version)
__ movq(rax, -1);
__ bzhiq(rax, rax, length); // input mask, fine for length in 1..63
__ movl(output_size, length);
__ shrl(output_size, 2); // output_size = length / 4, so 0 when length < 4
__ lea(output_size, Address(output_size, output_size, Address::times_2, 0));
__ addq(length, start_offset);
__ cmpb(Address(source, length, Address::times_1, -1), '=');
__ jcc(Assembler::equal, L_padding); // decrement output_size per '=' char
__ BIND(L_donePadding);
__ subq(length, start_offset);
__ kmovql(input_mask, rax);
__ movq(output_mask, -1);
__ bzhiq(output_mask, output_mask, output_size); // output_size is -1 or -2 herebzhi is the mask-forming instruction the whole path depends on. Intel documents its behaviour at counts of 64 or higher: "If the start bit position is greater than or equal to the operand size, the destination operand is loaded with the source operand unchanged, and CF is set." The output_size register, read by bzhiq as an unsigned 64-bit value, is 0xFFFFFFFFFFFFFFFF. That is comfortably above 64. bzhiq returns -1 unchanged. output_mask is now sixty-four one-bits.
__ vpermb(tmp, pack24bits, tmp, Assembler::AVX_512bit);
__ kmovql(k1, output_mask);
__ evmovdqub(Address(dest, dp), k1, tmp, true, Assembler::AVX_512bit);evmovdqub with a mask of all ones is a full 64-byte store. The destination pointer is at dest + dp. For the Calif trigger, 129 bytes of A followed by =, the first 128 bytes consume two iterations of the 64-byte loop and advance dp to 96. The output buffer was sized 98 bytes. The store writes 64 bytes at dest[96..160). Sixty-two of those bytes are past the end of the output buffer. Theori's LoopHarness, run across every release of the JVM from 17.0.6 through 27 on an AMD Zen 5 host, reports the same measurement on each: OOB WRITE 62 bytes.
The three arithmetic primitives in that path, shrl, decrementq, and bzhiq, are each correct in isolation. Right-shift by two is right-shift by two. Decrement is decrement. bzhi's "clamp to operand size" semantics are the behaviour its manual page documents. The bug is that the path assumed length >= 4 and encoded that assumption in nothing. Three operations that were each honest about what they did agreed on a 64-byte write to a zero-byte output.
The author wrote the safe path first. The comment explaining why they didn't ship it is still there.
The upstream fix, tracked as JDK-8393212 and titled Base64 optimization improvements, is two instructions:
__ BIND(L_finalBit);
// Now have 1 to 63 bytes left to decode
+
+ // A padded Base64 tail shorter than one complete block is handled by Java.
+ __ cmpl(length, 4);
+ __ jcc(Assembler::less, L_bruteForce);
+
// I was going to let Java take care of the final fragment
// however it will repeatedly call this routine for every 4 bytes
// of input data, so handle the rest here.
__ movq(rax, -1);
__ bzhiq(rax, rax, length);The comment on the sixth line of that block, "I was going to let Java take care of the final fragment however it will repeatedly call this routine for every 4 bytes of input data, so handle the rest here," is older than the patch. It documents a decision the author made when they wrote the stub. Java's non-vectorized decoder, the scalar L_bruteForce block farther down in the same function, was available. They considered routing the 1-to-63-byte tail to it. They rejected the route because Java would re-enter the native stub four bytes at a time, paying the dispatch cost for every quartet, and chose to handle the tail in-stub for speed.
The patch is that decision, reversed, within bounds. For tails of four or more bytes the author's fast path is still taken. For tails of one, two, or three bytes, which is exactly the window where output_size can underflow, control jumps to L_bruteForce, the Java-handled path the comment rejects.
The comment is still accurate. Java does re-enter the stub for every four bytes of input. Writing the slow path was always going to be slower. The author's reason for picking the fast path was not wrong. What the author did not model, and what the comment does not acknowledge, is that the fast path's correctness required a lower bound on length that nothing in the function was going to enforce.
The exception Java's method would have thrown now fires after the write.
Base64.Decoder.decode(byte[] src, byte[] dst) is defined to throw IllegalArgumentException if the source does not match the Base64 scheme, including malformed padding. On the un-JIT'd interpreter path, the Java body of decode0 checks the padding and throws before writing anything. On the C2-compiled path with the intrinsic active, the native stub runs to completion first, returns the number of bytes decoded, and only then does the surrounding Java code look at the returned value against its own validation and raise. The IllegalArgumentException fires. The stack trace is clean. The heap, at dest[98..160), is not.
Every public PoC in the set exploits that race between the write and the exception. TahuCryptsi's RemoteRceLab3 allocates a 98-byte scratch immediately adjacent to a 100-byte blob whose object header begins at scratch[98]:
static final class Sess {
final byte[] scratch = new byte[98]; // decode destination
final byte[] blob = new byte[100]; // neighbour, header gets corrupted
// ...
}The 62-byte out-of-bounds write clobbers the blob's mark word, its class pointer, and its length field. The length field becomes a huge unsigned integer. The next JVM-emitted bounds check on blob[off] reads from the clobbered length and lets the attacker read arbitrary bytes out of the heap, which the lab service then passes to Runtime.exec. That the service catches IllegalArgumentException and keeps serving is what lets the next request use the corrupted blob. Calif has claimed working pre-authentication RCE chains against Keycloak, Jira, Confluence, JFrog Artifactory, Jenkins, and PingFederate using this shape, with the per-product grooming held back from public release. Wiz has demonstrated remote chains against Jenkins, Confluence, and Tomcat independently.
The documented runtime mitigation does not mitigate anything.
Oracle's advisory and every vendor repack tells operators to install the fixed build and restart the JVM. Three paragraphs down from that, the documentation for the UseBASE64Intrinsics and DisableIntrinsic flags implies two runtime escape hatches: disable the Base64 intrinsic specifically, or disable intrinsics for _base64_decodeBlock by name. Theori's team at Xint, while building a runtime hotpatch, worked through both and found that neither works at runtime.
-XX:-UseBASE64Intrinsics added via jcmd VM.set_flag returns "flag is not manageable." Writing false into the flag's byte in /proc/PID/mem with Unsafe or a ptrace tool succeeds, the flag reads as false from the diagnostic bean afterwards, and HotSpot still calls the intrinsic. The reason is in vmIntrinsics::is_disabled_by_flags: the per-intrinsic decision is cached in vm_intrinsic_control_words the first time any caller is compiled, and the cached decision wins every later compilation. On 17u, the method-level -XX:CompileCommand=DisableIntrinsic,_base64_decodeBlock directive, documented as the surgical disable, is silently a no-op: compilerDirectives.cpp initializes the directive's intrinsic control words from the global -XX flags only and never applies the JSON option. The two mechanisms the Oracle manual names as the runtime fix are each non-functional at the point an operator would reach for them.
Theori's workaround synthesises a third path. Compiler.directives_add is used to exclude java/util/Base64$Decoder.decode0 from C2 compilation and forbid it from being inlined anywhere, so no C2-emitted code contains the intrinsic call site:
[{ "match": "java/util/Base64$Decoder.decode0",
"c2": { "Exclude": true } },
{ "match": "*.*",
"inline": "-java/util/Base64$Decoder.decode0" }]Then inst.retransformClasses(Base64$Decoder.class, Base64$Encoder.class) with unchanged bytecode forces deoptimization of every already-compiled method that reached the intrinsic. Across a 49k RPS Spring Boot workload, Theori measured the retransform at 18ms with zero errors. The path works. It is not documented as a Base64 mitigation. It had to be derived because the documented ones do not. The vendor advisory that tells you to upgrade or disable the intrinsic is correct about upgrade. The disable half of the sentence describes a mechanism that stopped working the first time the application called Base64.getDecoder().decode().
Why this exists
The AVX-512 Base64 decoder is one of a growing set of HotSpot intrinsics that replace Java methods with hand-written vector assembly: AES, SHA, ChaCha20, CRC32, Adler, Base64. Each stub implements the Java method's contract against an instruction set that cannot run Java's bounds checks, because the bounds checks are inserted by the Java verifier around bytecode array stores, not called from the method body. The invariants that the Java method depended on, including "writes do not exceed the output array's declared length," live in the Java bytecode. The stubs are authored against the algorithm's specification and the Intel software developer's manual. The only path that would make the invariants travel with the contract is a convergence point every implementation routes through, and there is none. The stubs are leaves of a dispatcher in vmIntrinsics.cpp, each authored against the contract separately, each responsible for its own safety.
CVE-2026-114938 is one instance of the class. The patch here closes this stub's path for tails of fewer than four bytes. The architecture that lets a method body be swapped for a vector stub without the Java method's invariants travelling into the stub is unchanged.
PoC: theori-io/java4shell-runtime-patch-CVE-2026-114938 (Theori's runtime hotpatch, with verification harness). Trigger disclosure and discovery credit: Quang Luong and Albert Yang at Calif, calif.io/java4shell/.
HotSpot replaced the Java method's body and kept its exception handler. The exception now fires after the 62 bytes.