[ Java4Shell CVSS 9.2 ]
[ Overview |
The bug |
Why the numbers line up |
From overflow to RCE |
Am I affected? |
What I'd patch first |
Fix & workarounds |
FAQ ]
[ Overview ]
This one is Calif's research, not mine. I'm writing it up because it's the rare bug that deserves the Log4Shell-style name, and because the first question everyone asked me today was "am I exposed?" The short version: a remote, unauthenticated memory-corruption bug in the JVM itself, patched by OpenJDK and Oracle on 2026-11-17, tracked as CVE-2026-114938 and scored 9.2 critical. The name nods to Log4Shell, but mechanically it's the opposite kind of flaw. Log4Shell was application logic: a feature (JNDI lookup) doing exactly what it was told. Java4Shell is a memory-safety bug in HotSpot's JIT, reachable from almost anything that Base64-decodes untrusted bytes. In a normal Java stack that surface is enormous: Basic-auth headers, JWTs, SAML assertions, session cookies, API payloads. There's no library to find and no gadget chain to assemble. The decoder is the bug. Calif calls the heap-disclosure half of it JavaBleed, and the comparison to Heartbleed is fair: attacker-chosen reads of server memory, coming back in the response. From there they escalated to full remote code execution.
[ The bug ]
HotSpot ships a hand-written x86-64 assembly intrinsic forjava.util.Base64.Decoderthat chews through input in 64-byte blocks using AVX-512 VBMI. The tail, the last partial block, is flushed with a masked vector store (evmovdqub), and the write mask is built from the output length. That's where it goes wrong: 1. A padding-only tail (=,==,X=,XY=,===, …) leavesoutput_lenat 0, then the code subtracts for the padding. It underflows to -1 or -2 — as an unsigned value, 0xFFFF…FE or 0xFFFF…FF. 2. The mask isbzhiq(-1, output_len).BZHIzeroes the bits above a given index, but it's a no-op when the index is 64 or more. A giant unsigned length leaves the mask all ones. 3. A mask of all ones means the "masked" store isn't masked at all. It writes the full 64 bytes, straight past the end of the output buffer. Java does reject the malformed input — it throwsIllegalArgumentExceptiona moment later. But the 64-byte write has already happened. The validation is downstream of the corruption, which is the whole problem.
[ Why the numbers line up ]
When I first read the figures they looked inconsistent, so it's worth walking through why they aren't. The canonical trigger on modern OpenJDK 17 is 64Acharacters followed by a single=: "AAAAAAAA…AAAA=" 65 characters in Base64 turns 4 input characters into 3 output bytes, so a 65-character string makes the decoder allocate a 50-byte output array. By the time it reaches the faulty tail store, 48 bytes are already written, and the final store lands at offset 48 — where the next couple of decoded bytes belong. Then it writes 64 bytes from there.
So the 64-byte write and the 62-byte overflow were never in conflict: two bytes in bounds, 62 out. On older OpenJDK 17 builds the path is reached with 128Acharacters plus=instead of 64.
[ From overflow to RCE ]
Here's the part I find clever. The overflow isn't a free write of
attacker data — it's a fixed overwrite. Byte 0 of the spill is
fully attacker-controlled, byte 1 has four controllable bits, and bytes
2 through 63 are constant; offsets 48 to 63 are always 0x9a. The only
thing the attacker really steers is where those bytes land. That makes
Java4Shell a heap-grooming problem, not a direct write primitive, and the
exploit is built out of that one constant spill:
Getting two arrays to sit next to the decoder's output, in the right
order, is the hard part. Calif's chain:
Warm up run valid decodes until the JIT compiles the fast
path and the vulnerable intrinsic is live (C2).
Groom locally control TLAB and outside-TLAB allocation and
spray-and-retry until the writer and reader arrays
land in adjacent G1 regions.
Groom remotely send request data in stages and wait on TCP
ACKs, so allocation order can be steered over the
network. They rented a VM near the target to keep the
latency steady enough to do it.
Escalate repair corrupted objects, run data-only attacks
on application logic, then build arbitrary writes that
reach the Code Cache and JVM hooks for execution.
Two honest caveats Calif is clear about: there is no universal
exploit — every target needs its own profile, and a missed groom can
crash the JVM — and a body-buffering proxy (nginx's default) breaks
some remote chains. Neither is a reason to sleep on it. The per-product
chains were held back; the primitive is public.
[ Am I affected? ]
Two conditions, both have to be true:
The runtime OpenJDK 17.0.6 or newer, or any downstream build of
it: Temurin, Corretto, Zulu, Liberica, Microsoft
Build, SapMachine, Red Hat, GraalVM, Oracle Java SE.
The CPU x86-64 with AVX-512 VBMI. In practice that's Intel
Ice Lake and newer (Xeon Ice/Sapphire/Emerald/Granite
Rapids) and AMD Zen 4 and newer. ARM64 is not
affected — the bug lives in an x86-64-only intrinsic.
The CPU flags are the quick filter. On Linux:
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'
If all four print, the silicon qualifies. Pair that with java -version
showing 17.0.6 or newer and you have an affected host until it's patched.
Plenty of cloud instance types land on exactly this hardware, so don't
assume you're clear just because you didn't buy the CPU.
[ What I'd patch first ]
Calif demonstrated this against a long list of software, so I'd triage
by exposure. Internet-facing, pre-auth, default config goes to the front:
Pre-auth RCE Keycloak, Atlassian Jira, Atlassian Confluence,
JFrog Artifactory, Jenkins, PingFederate
Post-auth RCE Apache Kafka, Apache Solr, Elasticsearch,
Gerrit, Spinnaker
The lists aren't exhaustive — sample apps on Struts and Spring Boot
fell too. If you run an SSO or identity product from that first row on
vulnerable hardware, that's the one that ruins your week, so it's first.
This is also exactly the question cvescope exists to answer: point
it at the versions you actually run and it'll tell you which of these
are live on your estate and rank them by real exploitation evidence,
instead of you eyeballing a vendor list.
[ Fix & workarounds ]
Patch. OpenJDK published an advisory and Oracle shipped the fix on
2026-11-17. Updating the JVM is the real answer; everything below is a
stopgap for hosts you can't bounce yet.
-XX:-UseBASE64Intrinsics turns off the hardware-accelerated
Base64 path and falls back to the plain
Java decoder, which isn't vulnerable.
Works on every architecture. This is the
one I'd reach for — no way to shoot
yourself in the foot with it.
-XX:UseAVX=2 disables AVX-512 outright. Also closes
the bug, but x86-64 only: OpenJDK on
ARM doesn't recognise the flag and won't
start, so don't push it into a config
that's shared with ARM nodes.
Both are JVM start flags, so they need a restart of the service to take
effect. If you can only touch one thing on a mixed fleet, use the first.
