Java4Shell and GraalVM: Oracle's Patch Doesn't Reach You
No GraalVM Community release has the Java4Shell fix yet. Run as a JVM, it's exposed through both of its compilers. As Native Image, the build target decides, not the JDK on the host.
Overview
If you run GraalVM Community, patching Java didn't fix Java4Shell for you: no GraalVM Community release contains the fix today. The newest, 25.5.5.0.3 (released 3 November), is built on JDK 25.0.5.0.3, before the patch, and carries a second, unpatched copy of the vulnerable decoder inside the Graal compiler.
Java4Shell (CVE-2026-114938) is a heap write past the end of an array in the AVX-512 VBMI Base64 decoder that HotSpot uses for java.util.Base64, disclosed on 17 November. GraalVM ported that decoder into its own compiler in March 2026, bug included, and shipped it in every release from 25.1 on.
The public guidance so far says the GraalVM problem is Native Image binaries built with 25.1 or later, and that GraalVM running as a normal JVM is covered by Oracle's November update. We tested both on real hardware. The JVM case is worse than that, and the Native Image case is narrower.
What to do now
- Running GraalVM Community as a JVM: add
-XX:-UseBASE64Intrinsics. No Community release is patched, and on an AVX-512 VBMI CPU both of its compilers reach the bug. The flag stopped Graal's path in our tests, and it is the standard workaround for C2's. It is case-sensitive:-XX:-UseBase64Intrinsicsis an unknown option and the JVM won't start. - Native Image: find out which CPU target each binary was built for. Binaries built for a CPU with AVX-512 VBMI (for example with
-march=nativeon such a machine) carry the bug. Binaries built with the default target don't include the vulnerable code path. JVM flags don't exist in a Native Image binary, so only a rebuild changes it. - Rebuild affected Native Image binaries. Until a fixed GraalVM ships (GraalVM has said 25.6, on 24 November), building with the default target instead of
-march=nativeleaves the vulnerable path out. Then rebuild again on 25.6. - Check the CPU before anything else. None of this applies on CPUs without AVX-512 VBMI: Skylake-SP, Cascade Lake and Cooper Lake, Zen 3, and ARM.
The full conditions, fixed builds by distribution and check commands for every JVM are on our Java4Shell page. This post is about GraalVM.
How it works
Java4Shell lives in the tail of a hand-written decoder. After decoding 64-byte blocks, 1 to 3 bytes can be left over. The decoder computes the output size for them as zero, takes one off for each trailing =, and ends up with a negative number. The instruction that builds the write mask reads only the low byte of that number, so the mask comes out all ones and the decoder writes a full 64 bytes past the end of the output. Java throws an exception afterwards, but the write has already happened. OpenJDK's fix adds four lines that send short tails to the plain code path.
GraalVM has its own copy. In March 2026 GraalVM's compiler ported HotSpot's Base64 fast paths as AMD64Base64DecodeOp (oracle/graal ec076abb, GR-65455), including this tail logic. Graal uses that op in two places:
- As the JIT compiler of a GraalVM JDK. Graal compiles hot Java methods and emits its own decoder, not HotSpot's.
- In Native Image. Graal compiles the application ahead of time, and the decoder is built into the binary. The JDK on the host is never involved.
GraalVM's fix for its copy is dated 14 September (13a4853144b8, "Avoid AVX-512 Base64 tail overwrite"), was merged on 11 November (oracle/graal pull request 15006), and has shipped in no release. Every release from 25.1.3 to 25.5.5.0.3 has the unguarded tail; 25.0 releases don't have the port at all.
What we tested
We ran each build on two AWS machines: an m7i.large (Intel Xeon 8488C, Sapphire Rapids, with AVX-512 VBMI) and an m5.large (Intel Xeon 8175M, Skylake, with AVX-512 but no VBMI). Each test decodes crafted Base64 into an array larger than the output, pre-filled with marker bytes; a changed marker past the decoded length is a write the decoder must never make. No exploit was run.
| Build, on the VBMI machine | Out-of-range write |
|---|---|
| GraalVM Community 25.5.5.0.3, Graal as the JIT | 62 bytes past a 50-byte output, from a 65-byte input |
| The same, with HotSpot's C2 as the JIT | The same: its JDK 25.0.5.0.3 predates OpenJDK's fix |
The same, Graal as the JIT with -XX:-UseBASE64Intrinsics |
None |
Native Image binary, built with -march=native |
62 bytes past the output from a 65-byte input, basic and URL decoders |
Native Image binary, default target (x86-64-v3) |
None of this kind: the AVX-512 path isn't compiled in |
Three things follow.
- GraalVM as a JVM is exposed twice over. Oracle's November update lists Oracle's GraalVM for JDK 17 and 21 builds; it doesn't make GraalVM Community safe. The Community release's own JDK lacks the OpenJDK patch, so C2 reaches HotSpot's decoder, and Graal reaches its own copy. Switching compilers doesn't help. The flag stopped the Graal path in our test.
- Native Image depends on how the binary was built, not where it runs. A binary built for a VBMI target carries the bug on any host with VBMI, whatever JDK is installed there and whatever flags you set. A binary built for the default target doesn't contain the AVX-512 path, even when it runs on a VBMI CPU.
- "Native Image built with 25.1 or later is affected" is too broad. It is true for binaries built for a VBMI target. Most builds use the default target, and we saw no Java4Shell write from one.
What else the lab confirmed
- The CPU condition is real. The same unpatched Temurin 17 and 21 builds made the Java4Shell write on the Sapphire Rapids machine and never on the Skylake one, which has AVX-512 but no VBMI. Checks that flag "any AVX-512" (several vendor scripts and queries do) mark machines that can't be hit. Check for
avx512vbmi. - Java 17 needs longer input. Temurin 21.0.13 wrote from 65-byte inputs; Temurin 17.0.21 only from 129 bytes, because the 17 line's decoder takes the fast path only above 128 bytes. Either is far below any header or body limit.
- The workarounds hold on HotSpot.
-XX:-UseBASE64Intrinsics,-XX:UseAVX=2and C1-only (-XX:TieredStopAtLevel=1) each stopped the write on Java 17 and 21. We prefer the first:-XX:UseAVX=2turns off AVX-512 for all compiled code, not just Base64. - The patch works. Temurin 17.0.21.1+2 and 21.0.13.1+2 made no out-of-range write.
Timeline (UTC)
- 24 March 2026: GraalVM's compiler ports HotSpot's AVX-512 Base64 code, bug included (
ec076abb). - 30 June: GraalVM Community 25.1.3, the first release with the port.
- 9 September: the OpenJDK fix appears as a public pull request (openjdk/jdk #32781), later closed unmerged.
- 14 September: date of GraalVM's fix for its copy (
13a4853144b8), not labelled as a security fix. - 3 November: GraalVM Community 25.5.5.0.3, still without the fix.
- 11 November: GraalVM's fix merged to master (oracle/graal #15006).
- 17 November: Calif discloses Java4Shell; Oracle's Critical Security Patch Update and OpenJDK's advisory ship the HotSpot fix.
- 18 November: GraalVM says Native Image applications built with 25.1 or later are affected and the fix ships in 25.6 on 24 November (as reported by Precursor Security).
- 20 November: no GraalVM Community release has the fix.
Am I affected?
| What you run (x86-64 with AVX-512 VBMI) | Status as of 20 November 2026 |
|---|---|
| GraalVM Community 25.1 to 25.5 as a JVM | Exposed through Graal and through C2. Use -XX:-UseBASE64Intrinsics |
| GraalVM Community 25.0.x as a JVM | No Graal copy, but its JDK (25.0.2 and earlier) predates OpenJDK's fix: with C2 it reaches HotSpot's unpatched decoder. With Graal, its default JIT, not established. Use the flag |
Native Image binary built with 25.1 to 25.5 for a VBMI target (such as -march=native on a VBMI machine) |
Exposed, on any host with VBMI, whatever JDK is installed. Rebuild |
| Native Image binary built with 25.1 to 25.5, default target | No Java4Shell write in our test: the AVX-512 path isn't in the binary |
| Native Image binary built with 25.0 or earlier | No Graal copy of the decoder |
| Mandrel or Quarkus native executables | Quarkus and Red Hat say not affected. That holds for builds made with GraalVM before 25.1; we didn't check Mandrel's own releases |
| Oracle GraalVM for JDK 17.0.21.1 | Not confirmed fixed: Oracle's notes say it is built on 17.0.20.1+4, which may be a typo for the patched 17.0.21.1+4 |
Check your own:
# 1. Does the CPU have what the bug needs? (all four must appear)
grep -o -w -E 'avx512f|avx512bw|avx512vbmi|bmi2' /proc/cpuinfo | sort -u
# 2. Which GraalVM is this, and is the flag on? (JVM mode; replace PID)
java -version
jcmd PID VM.flags -all | grep -E ' (UseAVX|UseBASE64Intrinsics) '
# 3. Native Image: which GraalVM built it, and for which target?
native-image --version
grep -rn -- '-march' pom.xml build.gradle* src/main/resources/application.properties 2>/dev/null
For Native Image, step 3 runs where the binary is built: the GraalVM version and any -march option in your build configuration or CI, including the Maven and Gradle native plugins and Quarkus's quarkus.native.additional-build-args. A binary has no JVM flags to read at runtime.
What doesn't protect you
- Patching the host JDK. It doesn't touch a Native Image binary, and it doesn't touch a GraalVM Community JDK, which ships its own Java.
- JVM flags on a Native Image binary. They don't exist at its runtime.
-XX:-UseBASE64Intrinsicsworks for GraalVM as a JVM, not for Native Image. - Switching GraalVM's JIT back to C2. C2 reaches HotSpot's own unpatched decoder in the same release.
- Rebuilding on the newest GraalVM Community today. 25.5.5.0.3 has the same unguarded copy. Rebuild for the default target now, and on 25.6 when it ships.
These reduce risk while you wait for a fixed release; only the fixed release removes the bug.
Recovery and detection
- Inventory first. List every GraalVM JDK and every Native Image binary, with the GraalVM version and build target of each. Container images built with GraalVM are part of the list.
- Apply the flag to GraalVM JVMs and restart them. A flag set without a restart isn't in the running process; read the running JVM's flags to confirm.
- Rebuild Native Image binaries built for VBMI targets with the default target, then again on 25.6.
- Watch for crashes. On exposed builds, the reproduced impact so far is crashes and memory leaks; look for JVM crash logs (
hs_err_pid*.log) or Native Image process crashes that follow requests carrying long Base64 values, such asAuthorization: Basicheaders or tokens ending in=.
How Defendermate helps
- Verify exposure per build and per machine. Defendermate verifies, read-only and agentless, whether a finding is exploitable where it runs: the build actually in the process, the CPU it runs on and the flags it runs with. A version string can't tell a GraalVM Community JDK or a Native Image binary from a patched one; the conditions can.
- Contain it while the fix is pending. Where there is no fixed release yet, Defendermate delivers compensating controls as code, and orchestrates the real fix when it ships.
Acknowledgments
Calif (Quang Luong) for finding and disclosing Java4Shell, and Albert Yang, credited by Oracle; the OpenJDK Vulnerability Group and Oracle for the fix; the GraalVM team for fixing its copy; Precursor Security for reporting GraalVM's statement.
References
- Our Java4Shell page (conditions, fixed builds by distribution, check commands): https://www.defendermate.com/cve/java4shell
- Calif: https://calif.io/java4shell
- Oracle Critical Security Patch Update, November 2026: https://www.oracle.com/security-alerts/cspunov2026.html
- OpenJDK advisory, 17 November 2026: https://openjdk.org/groups/vulnerability/advisories/2026-11-17
- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-114938
- GraalVM's port: https://github.com/oracle/graal/commit/ec076abb · GraalVM's fix: https://github.com/oracle/graal/commit/13a4853144b8 · https://github.com/oracle/graal/pull/15006
- GraalVM Community releases: https://github.com/graalvm/graalvm-ce-builds/releases
- OpenJDK pull request #32781: https://github.com/openjdk/jdk/pull/32781
- Precursor Security, live updates (GraalVM's statement, 18 November): https://www.precursorsecurity.com/blog/java4shell-critical-openjdk-rce-vulnerability
Updates
- 20 November 2026: published.
For current figures: What AI changed · The CTEM guide · Start free