hopeless/labs

Blog

Java4Shell (CVE-2026-114938): Pre-auth Heap Overflow in Java's AVX-512 Base64 Decoder

Choirul Huda6 min read
javacvevulnerabilitysecurityjvmheap-overflow

Java4Shell breaking news: pre-auth heap overflow in Java's AVX-512 Base64 decoder. Affects Java 17 (17.0.6+), 21, and 25 on x86 with AVX-512 VBMI. ARM is clean. The hype says RCE. The source says crash. Here's the actual breakdown.


There's a thing about performance optimizations: they're the bugs you never audit. Business logic gets reviewed. The assembly intrinsic your JIT drops in to decode 64 bytes at once? Not so much. That's exactly what CVE-2026-114938 is about.

The flaw lives in HotSpot's AVX-512 Base64 decoder, the hand-written x86 assembly that JIT compiles in when your CPU is fast enough and the JDK version is new enough. On Java 17.0.6 and later (also 21 and 25), that routine has an integer underflow in its tail step that lets it write 62 or 63 bytes past the end of its output buffer, straight into the Java heap.

No auth required. The decode happens before your app even has a chance to validate anything.

What actually breaks

The decoder's last step handles the leftover bytes after all the full 64-byte blocks are done. For a tail of 1–3 bytes, it computes an output size of (n / 4) * 3, which rounds down to zero for small tails. Subtract 1 for a trailing = and you get -1. The store mask is derived from a bzhi instruction that only reads the low 8 bits, so -1 becomes 255, the mask clears nothing, and all 64 bytes get written past the end.

The smallest trigger on Java 21/25 is 65 bytes: 64 valid Base64 chars + a =. On Java 17 it's 129 bytes.

Here's the part the headlines glossed over: the attacker doesn't control what gets written. The bytes that land past the buffer are fixed: 9A, then 69 A6 9A repeated, then more 9A. The JVM writes them, not the attacker. What the attacker controls is whether the write happens, not what ends up on the heap.

That's the difference between "heap corruption that could lead to RCE" and "heap corruption that causes a crash." The source shows the second one. The RCE claim from early reports isn't supported yet. No public PoC, nobody has demonstrated attacker-controlled writes.

Realistic outcome: the stray bytes often land in free memory and get overwritten on the next allocation. When they hit a live object they wipe its header and the JVM crashes. Run it enough times against a service and you have a DoS.

Why it's still a big deal

Pre-auth. That's the word. Java processes that sit behind APIs decode Base64 constantly before they ever check who's asking:

  • HTTP Basic credentials: Authorization: Basic <base64> gets decoded before the password is verified. Spring Security decodes this with java.util.Base64.
  • JWT header and payload, decoded before signature verification in many libraries. Auth0 java-jwt uses java.util.Base64 for this; JJWT and Nimbus (which Spring Security OAuth2 uses) have their own decoders.
  • SAML messages, webhook payloads, any Base64 field in a request body, if the app calls java.util.Base64 to decode it, the trigger can fire.

A service you haven't even authenticated against can be crashed by sending a crafted header or token. If that service holds DB credentials, signing keys, or session tokens (and Java API servers usually do), a reliable crash becomes operational noise for lateral movement or extraction windows.

Also: internal services. The host doesn't need to face the internet. Anything that processes data from other systems is in scope for lateral movement if it runs a vulnerable JDK.

What's NOT affected

This one has a surprisingly narrow blast radius once you check the prerequisites:

ARM is completely clean. AWS Graviton, Ampere Altra, Azure Cobalt, Google Axion, Apple Silicon: all use a different decoder path. We ran 794 crafted inputs against Temurin 17.0.21 for arm64 and saw nothing. If your Java fleet runs on ARM, you can breathe.

Java 8 and 11 have no Base64 decode intrinsic at all. November patches exist for them but they're for other flaws.

x86 without AVX-512 VBMI: Skylake, Cascade Lake, Cooper Lake Xeons; AMD EPYC before Zen 4 (Naples, Rome, Milan); Intel desktop CPUs from Alder Lake on (AVX-512 disabled by default). All fine. The vulnerable routine simply never generates on these CPUs.

Libraries with their own decoders like Apache Commons Codec, Jackson (for byte[] JSON fields), JJWT, and Nimbus JOSE+JWT: they don't call the intrinsic. Only java.util.Base64.getDecoder() and .getUrlDecoder() hit it. The MIME decoder also takes a different path.

Check your CPUs: grep -c avx512vbmi /proc/cpuinfo returns >0 on the vulnerable hardware (Ice Lake Xeon and later, Zen 4 EPYC and later).

Fix and mitigations

Patch. Oracle shipped the November 17 Critical Patch Update with fixed builds (17.0.21.1, 21.0.13.1). OpenJDK vendors (Temurin, Corretto, Zulu, MS, Red Hat) haven't all confirmed dates but typically ship same day. Check your vendor's advisory, not Oracle's build numbers.

One thing to remember: replacing files on disk doesn't fix a running JVM. Use jcmd <PID> VM.version to verify what's actually running, then restart. Container images pinned to old digests stay vulnerable until you rebuild.

WAF rule while you wait. Every trigger is invalid Base64: it ends in = but its length isn't a multiple of 4. Valid Base64 never looks like that. This rule catches it in the Authorization header:

^Basic\s+(?:\S{4})*\S{0,2}=$

JWTs carry no padding at all (RFC 7515), so any JWT containing = in its Base64URL segments is malformed and can be rejected.

JVM flags (temporary, test first):

-XX:-UseBASE64Intrinsics   # narrower: just disables the Base64 routine
-XX:UseAVX=2               # broader: disables all AVX-512, slows crypto too

Neither has been officially confirmed for this CVE by any vendor. Test before rolling out.

Find your exposure. java -version only tells you about the first Java on PATH. Use readlink -f /proc/<PID>/exe and jcmd <PID> VM.version on running processes (many apps bundle their own JDK). Check container Dockerfiles for base image versions.

The pattern

This is the second CVE in a row (after CVE-2026-119618 in Apache HTTP Server's HTTP/2 module) that sits below the application layer and fires before any authentication runs. The flaw isn't in your code, the framework, or even the library your app calls. It's in the assembly the JIT generated from a 2021 performance proposal.

The optimization sat in production JVMs for almost four years. Nobody's Java scanner caught it. It didn't show up in black-box tests because a patched and unpatched JVM respond identically to the trigger, both throwing IllegalArgumentException. The only way to know you're fixed is to verify the JVM version.

Three facts per service tell you if you're in scope: Java build, CPU flags, and whether that service decodes client input with java.util.Base64. Inventory now, patch when the fixed builds land, WAF rule in the meantime.

The hype machine called it Java Log4Shell. The source says it's a pre-auth crash with an unproven RCE path. Still worth taking seriously, just don't let the headline drive your prioritization.