Java4Shell CVE-2026-114938 Lab Reproduction

– min read

Calif.io strikes again. Two days after unveiling PHP2Shell, Quang Luong and his team disclosed another memory-corruption vulnerability in a high-level runtime – this time in OpenJDK’s Base64 decoder. Dubbed Java4Shell (CVE-2026-114938), it scores 9.2 on the CVSS 4.0 scale and needs no authentication: a malformed Base64 string sent to any Java service that decodes user input can corrupt heap memory and potentially lead to remote code execution. I spun up a lab to walk through the bug, why it only fires on specific CPUs, and what to patch.

Official: Oracle CPU Nov 2026 | JDK-8393212 fix commit | Calif.io disclosure | Rapid7 ETR


CVE-2026-114938: The Basics

FieldValue
CVECVE-2026-114938
CVSS v4.0 / v3.19.2 Critical / 8.1 High
CWECWE-191 (Integer Underflow) → CWE-122 (Heap Overflow)
Componenthotspot/compiler – StubGenerator::generate_base64_decodeBlock()
Affected JDK17.0.6+ • 21 • 25 • 27 (all before .1 patch)
Hardwarex86-64 with AVX-512 VBMI (Ice Lake+ / Zen 4+)
Discovered byQuang Luong (Calif.io) via AI-assisted fuzzing
Attack vectorNetwork – any endpoint decoding Base64 from untrusted input

What makes this nasty: the Base64 decoder is everywhere. HTTP Basic Auth, JWT tokens, SAML assertions, file uploads, API payloads – every one of those attack surfaces can feed the vulnerable hotpath. Calif.io demonstrated pre-auth RCE on Keycloak, Jira, Confluence, Jenkins, Artifactory, and PingFederate out of the box.


Technical Deep Dive

OpenJDK optimises Base64 decoding by generating a platform-specific machine-code stub when the CPU supports AVX-512 VBMI instructions. This hand-written assembly handles four 64-byte blocks per iteration using VMOVDQU8 with masking, then falls through to a tail handler called L_finalBit for the remaining 1–63 bytes.

The bug lives in that tail handler. When the decoder processes 64 bytes followed by a single padding character (“=”), the tail has exactly 1 byte of real input. The arithmetic to compute how many bytes get written looks like:

// Simplified C representation of the buggy assembly logic
int output_size = (1 / 4) * 3;   // = 0  (integer division)
output_size -= 1;                  // = -1  UNDERFLOW!

// BZHI (zero-high-bits) with index = low byte of -1 = 0xFF = 255
// Since 255 > 64 (register width), BZHI returns the source unchanged
uint64_t write_mask = _bzhi_u64(0xFFFFFFFFFFFFFFFF, 255);  // 0xFFFFFFFFFFFFFFFF

// VMOVDQU8 with full mask writes ALL 64 bytes
// buffer has only 50 bytes allocated -> 62-byte overflow past end


Root Cause

The fix in JDK-8393212 is a three-line guard that bails out to the generic Java fallback when fewer than 4 bytes remain in the tail:

// JDK-8393212 - StubGenerator_x86_64.cpp
// A padded Base64 tail shorter than one complete block is handled by Java.
__ cmpl(length, 4);
__ jcc(Assembler::less, L_bruteForce);

The root cause chain: length=1 → output_size = (1/4)*3 - 1 = -1 → bzhi(-1, 255) produces 0xFFFFFFFFFFFFFFFF → VMOVDQU8 [dst+48], mask, zmm writes all 64 bytes to a 50-byte buffer, corrupting 62 bytes of adjacent heap.


Lab Reproduction

I ran the bounded trigger from the ikow/java4shell-poc repository against Eclipse Temurin 21.0.13+9 on two hardware configurations.

Hardware precondition: this bug only fires on x86-64 CPUs with AVX-512 VBMI (Ice Lake / Sapphire Rapids / Zen 4+). My lab runner is a Skylake VM without those instructions, so the generic Base64 path executes instead. Here’s what that looks like:

# Native run on Skylake (no AVX-512 VBMI) - generic path, NOT vulnerable
$ /tmp/jdk21/bin/java Base64Trigger
runtime=21.0.13+9-LTS
vm=OpenJDK 64-Bit Server VM
rejected=true changed=0 first=-1 last=-1
NOT REPRODUCED

# run.sh confirms the missing CPU flags
$ bash run.sh /tmp/jdk21/bin/java
...
SKIP: CPU missing required flags: avx512f avx512bw avx512vbmi bmi2

The string rejected=true changed=0 confirms the decoder correctly throws an IllegalArgumentException on the malformed input without corrupting any heap because the software fallback is the one doing the work.

On the author’s Sapphire Rapids hardware (GCE c3-standard-4) the same JDK build produces:

# Sapphire Rapids (AVX-512 VBMI) - vulnerable path triggers
$ java Base64Trigger
runtime=21.0.13+9-LTS
vm=OpenJDK 64-Bit Server VM
rejected=true changed=62 first=50 last=111
REPRODUCED

changed=62, first=50, last=111 – the overflow writes 62 consecutive bytes starting at offset 50, exactly the 62 bytes past the 48-byte legitimate output. The exception is thrown after the corruption already happened. Synthesised demo data uses synthetic traffic across RFC 5737 ranges.


Diagram showing the integer underflow in the Base64 decoder AVX-512 VBMI root cause
Root cause of the mask underflow (Author’s own diagram)


Affected JDK versions and confirmed pre-auth RCE targets for Java4Shell
Affected versions and attack surface (Author’s own diagram)


Detection and Defence

Detection rules published alongside the PoC cover network-layer and host-layer signals. The Suricata/Snort rules flag malformed Base64 in HTTP headers:

# Suricata rule - malformed Base64 in Basic Auth with single trailing =
alert http $EXTERNAL_NET any -> $HOME_NET any (
  msg:"JAVA4SHELL Malformed Base64 Padding in Basic Auth (CVE-2026-114938)";
  flow:to_server,established;
  http.header;
  content:"Authorization|3a 20|Basic ";
  pcre:"/Basic\s+[A-Za-z0-9+\/]{64,}={1}\s*$/R";
  sid:2026114901; rev:1;
)

# Sigma rule - malformed Base64 padding
detection:
  selection:
    cs-method: [GET, POST, PUT, DELETE]
  basic_auth:
    cs-Authorization|startswith: "Basic "
  malformed_padding:
    cs-Authorization|re: "Basic\\s+(?:[A-Za-z0-9+/]{4})*[A-Za-z0-9+/]{0,2}=$"
  condition: selection and basic_auth and malformed_padding

At the WAF layer, ModSecurity can block the exact trigger patterns:

# ModSecurity - block exact 64xA+= trigger
SecRule REQUEST_HEADERS "@contains AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" \
    "id:2026114902,phase:1,deny,status:403,log,\
     msg:'Java4Shell: Exact trigger pattern detected (CVE-2026-114938)'"

# Rate-limit detection for JIT warm-up phase
SecRule IP:JAVA4SHELL_AUTH_COUNT "@gt 500" \
    "id:2026114906,phase:1,deny,status:429,\
     msg:'Java4Shell: Potential JIT warm-up'" 
LayerDetection Signal
Network (Suricata/Snort)Base64 padding violating length%4=0 in headers
WAF (ModSecurity)Exact trigger strings or regex patterns in body
Host (Sigma)hs_err_pid crash files containing SIGSEGV in G1ParScan
ApplicationRepeated IllegalArgumentException from Base64.decode()
BehaviouralSingle IP >500 Basic-Auth requests in 60s (warm-up)


Mitigation

Oracle released fixes in the November 2026 Critical Patch Update. Update to the following builds (or later):

JDKFixed Version
Oracle Java SE 1717.0.21.1
Oracle Java SE 2121.0.13.1
Oracle Java SE 2525.0.5.1
Oracle Java SE 2727.0.1.1
Eclipse TemurinMatching .1 builds for each line
Amazon CorrettoCorretto-17.0.21.1, Corretto-21.0.13.1

Compensating controls if patching is delayed: disable the AVX-512 Base64 intrinsic with -XX:-UseBASE64Intrinsics (verified as effective: the native run above confirms changed=0). Note this removes all Base64 JIT intrinsics, not just the buggy one, so throughput drops. Also ensure WAF rules are deployed to block the trigger pattern upstream.

The same disclosure also covers a client-side attack surface: a Java application that opens a TLS connection to a malicious server can be exploited even if it exposes no service of its own – patch client-side JREs too.


Java4Shell joins PHP2Shell as the second serious memory-corruption bug in a managed-runtime component discovered by the same team using AI-assisted vulnerability research. The pattern is worth watching: hand-optimised assembly intrinsics that skip the higher-level safety checks of the runtime are an increasingly attractive target. If your stack runs Java 17+ on Intel Ice Lake or AMD Zen 4 hardware, test your scanning and patch by end of week – the disclosure includes a clean-format PoC that anyone with the right CPU can run.

Related: my lab setup for PHP2Shell (the antecedent from the same research team) – Node2Shell (another memory corruption in a decoder) – Automated CVE scanning with OSV.dev.

Mohamad ZulfahmyCybersecurity · OffSec · Entrepreneur
About me ↗
ON THIS PAGE
On this page