Skip to main content

Java4Shell (CVE-2026-114938): What Keycloak Operators Need to Do

· 6 min read
Jeff Patzer
Phase Two

Bottom line: if you run Keycloak on x86-64 servers with recent Intel or AMD CPUs, add -XX:-UseBASE64Intrinsics to the JVM today, then move to a patched Java runtime. Java4Shell (CVE-2026-114938), disclosed on November 17, 2026, is a memory-corruption bug in OpenJDK's Base64 decoder, and Keycloak is the first application on the researchers' list of products where they demonstrated remote code execution without authentication, in a default configuration. ARM64 is not affected, which is why Phase Two hosted clusters were never exposed.

What the bug is​

java.util.Base64.Decoder is ordinary Java code, but because Base64 is everywhere, HotSpot ships hand-written assembly for it — an intrinsic — and the C2 JIT compiler swaps that in once the decoder is hot. On x86-64 CPUs with AVX-512 VBMI, HotSpot uses a vectorized intrinsic that decodes 64 characters at a time.

The bug is in how that assembly handles the last few characters of malformed input. A specific invalid string (64 A characters followed by =) makes the tail handling write past the end of the output buffer on the Java heap, corrupting whatever object sits next to it. The researchers at Calif turned that into remote code execution with application-specific heap grooming. There is no universal payload, but they demonstrated it against Keycloak and several other widely deployed Java applications, including Jira, Confluence, Artifactory, Jenkins and PingFederate.

Keycloak is an easy target because it decodes attacker-supplied Base64 before anyone logs in: JWTs such as client assertions and request objects, the SAMLRequest parameter, Authorization: Basic client credentials, and cookies. On a busy server the decoder has long since been JIT-compiled, so the vulnerable path is the one running.

Who is affected​

JDKOpenJDK 17.0.6 and later, and builds derived from it (Temurin, Corretto, Red Hat, Zulu, Liberica, Microsoft, Oracle and others)
CPUx86-64 with AVX-512 VBMI — Intel Ice Lake or newer, AMD Zen 4 or newer
Not affectedARM64 (for example AWS Graviton), which uses a separate implementation
SeverityOracle rates it CVSS 3.1 8.1; the researchers rate it CVSS 4.0 9.2

The CPU scope comes from the researchers. The official CVE record, filed by Oracle, lists affected Oracle Java builds and says nothing about architecture. Oracle's patches are in its November 2026 security alert, released the same day as the disclosure.

Check whether you are exposed​

On each Linux host that runs Keycloak:

grep -o -w -E 'avx512f|avx512bw|avx512vbmi|bmi2' /proc/cpuinfo | sort -u

If all four flags are listed, the JVM can select the vulnerable code path. Inside the container, java -version tells you which runtime build you have. Cloud instances count too: many current-generation x86 instance families run on Ice Lake or newer Intel CPUs, or Zen 4 AMD CPUs.

Mitigate today: one JVM flag​

Add -XX:-UseBASE64Intrinsics to the JVM options and restart Keycloak. It makes java.util.Base64 run as plain Java instead of the intrinsic. Behavior is unchanged and the performance cost is negligible for Keycloak. The official Keycloak images read extra options from JAVA_OPTS_APPEND:

JAVA_OPTS_APPEND="-XX:-UseBASE64Intrinsics"

The researchers also suggest -XX:UseAVX=2, which hides AVX-512 from the JVM altogether. That works on x86-64 only — a JVM on ARM64 will not start with it — so the Base64 flag is the safer default for mixed fleets.

The gotcha: deploy-time options replace image options​

JAVA_OPTS_APPEND set by your deployment — Helm extraEnv, a Kubernetes env block, an ECS task definition, a Compose file — replaces any value baked into the image rather than adding to it. So if your deployment already sets JAVA_OPTS_APPEND (for an APM agent, JGroups settings, heap tuning), a flag shipped in the image never takes effect. Append the flag to the value your deployment sets, and keep the options that are already there:

# Helm values (keycloakx chart)
extraEnv: |
- name: JAVA_OPTS_APPEND
value: "-javaagent:/opt/dd-java-agent.jar -XX:-UseBASE64Intrinsics"

The same applies one level up: setting a full JAVA_OPTS replaces Keycloak's own default JVM options, so if you do that, add the flag to that line too. After restarting, confirm the flag is on the running process — for example with ps -o args= -p 1 inside the container.

The permanent fix: a patched Java runtime​

The flag is a mitigation; the fix is a JDK that contains the patch.

  • Official Keycloak or Red Hat build of Keycloak images: take the refreshed image when your vendor publishes one with a patched runtime. Until then, the flag is your protection.
  • Images built on Wolfi or Chainguard: the patched runtime is openjdk-21 21.0.13.1. Pin the runtime package itself — openjdk-21-jre>=21.0.13.1 — not only openjdk-21-default-jvm. The default-jvm package is just the symlink, and pinning it alone left the old runtime in place when we rebuilt on top of an existing image.
  • Phase Two's image: quay.io/phasetwo/phasetwo-keycloak:26.8.2.1794965685 ships the patched JDK (21.0.13.1) with -XX:-UseBASE64Intrinsics already set, for both linux/amd64 and linux/arm64.

Whatever you build, verify on every architecture you run:

docker run --rm --platform linux/amd64 --entrypoint java <image> -version
docker run --rm --platform linux/arm64 --entrypoint java <image> -version

Phase Two hosted clusters​

Phase Two hosted Keycloak runs on ARM64, which never uses the affected code, so hosted clusters were not exposed at any point and customers do not need to do anything. As defense in depth we have released the image above, with the patched runtime and the intrinsic disabled, and we are scheduling the upgrade with each customer.

Further reading​

Running Keycloak yourself and want a second pair of eyes on this? Our Keycloak support covers exactly this kind of week. If you would rather not patch JVMs at all, our managed Keycloak clusters are handled for you, under SOC 2 Type II and ISO 27001.