Security advisory: update your JDK (CVE-2026-114938, "Java4Shell")

Piotr Chabelski (VirtusLab)

BLOG

On 2026-11-17, OpenJDK published a vulnerability advisory for CVE-2026-114938, also known as “Java4Shell” (CVSS 4.0: 9.2, Oracle’s CVSS 3.1: 8.1). It is a heap buffer overflow in the HotSpot JIT’s AVX-512 Base64 decoder on x86-64. An attacker who can send crafted Base64 input to a JVM can crash it, and in some cases run code remotely, with no authentication needed. Base64 is everywhere: HTTP Basic auth headers, JWTs, SAML, file uploads, and more.

This is not a Scala issue, but it affects every application running on the JVM, including Scala ones. Server-side applications that decode untrusted input are the most exposed.

Am I affected?

You are affected if all of the following are true:

  • you run JDK 17.0.6 or later, 21, 25, or 27 without the fix (see the table below). JDK 8 and 11 are not affected;
  • on an x86-64 CPU with AVX-512 VBMI support (Intel Ice Lake or newer server CPUs, AMD Zen 4 or newer). ARM machines, including Apple silicon and AWS Graviton, are not affected;
  • your application decodes Base64 input that an attacker can control.

If you’re unsure, assume you are affected. Many cloud servers and CI runners use CPUs with AVX-512.

To check your JDK version and CPU on Linux:

$ java -version
openjdk version "17.0.21" 2026-10-20
...
$ grep -o 'avx512vbmi' /proc/cpuinfo | head -1
avx512vbmi

If java -version shows an affected version and the second command prints avx512vbmi, the vulnerable code can run on that machine.

Updating to the fixed JDKs

The real fix is to update your JDK. As of 2026-11-18, the fixed builds are:

JDK Oracle Corretto Temurin, Zulu, Microsoft, Red Hat
JDK 17 17.0.21.1 17.0.21.1.2 not yet
JDK 21 21.0.13.1 21.0.13.1.2 not yet
JDK 25 25.0.5.1 25.0.5.1.2 not yet
JDK 27 27.0.1.1 27.0.1.1.4 not yet

Other vendors have not yet released fixed builds, or have not confirmed them at the time of this blog post being written. Check your vendor’s advisory, and use the workaround below until a fix is out.

  • Standalone JDKs (for example, ones installed via Coursier, SDKMAN!, Homebrew, or downloaded from a vendor): update every JDK you have, including the ones used in CI.
  • Docker images: a patched host does not patch the JDK inside a container. Rebuild your images on an updated base image.
  • JDKs from your Linux distribution: watch your distribution’s security tracker. As of writing, Debian and Red Hat list their OpenJDK 17+ packages as affected, with fixes pending.

Workaround: disable the Base64 intrinsic

Until you can update, start the JVM with this flag:

-XX:-UseBASE64Intrinsics

It makes the JVM use the plain Java Base64 decoder instead of the vulnerable optimised one. It works on every platform, but Base64-heavy workloads may run a little slower. Remove it once you are on a fixed JDK.

The easiest way to apply it to every JVM on a machine or CI job, including build tools, is the JAVA_TOOL_OPTIONS environment variable:

export JAVA_TOOL_OPTIONS="-XX:-UseBASE64Intrinsics"

The JVM will print Picked up JAVA_TOOL_OPTIONS: ... on startup, which confirms the flag is picked up. You can also check it directly:

$ java -XX:-UseBASE64Intrinsics -XX:+PrintFlagsFinal -version | grep UseBASE64Intrinsics
     bool UseBASE64Intrinsics                      = false                                     {product} {command line}

To set it for your application only:

  • sbt: add run / javaOptions += "-XX:-UseBASE64Intrinsics" (with run / fork := true) to your build. For the sbt JVM itself, add the flag to .jvmopts.
  • Mill: add "-XX:-UseBASE64Intrinsics" to forkArgs. For the Mill JVM itself, add the flag to .mill-jvm-opts.
  • Scala CLI: pass --java-opt -XX:-UseBASE64Intrinsics, or add //> using javaOpt -XX:-UseBASE64Intrinsics to your sources.
  • Deployed applications: add the flag wherever you set JVM options, such as your start script, JAVA_OPTS, the Dockerfile ENTRYPOINT, or your Kubernetes manifest.

On GitHub Actions it might look like:

env:
  JAVA_TOOL_OPTIONS: -XX:-UseBASE64Intrinsics

Further reading