Mitigating CVE-2026-114938 ("Java4Shell") in Apache Kafka deployments

CVE-2026-114938, also known as “Java4Shell”, is a vulnerability in the JDK that can affect Apache Kafka® deployments. The flaw is in an AVX-512 VBMI intrinsic that OpenJDK uses on x86-64 CPUs to speed up Base64 decoding.

Because the vulnerability is in the JDK, Kafka itself needs no upgrade or code change. The fix is to upgrade your JDK. Until you can, a JVM flag disables the affected code.

Who is affected

A Kafka process (a broker, controller, Kafka Connect worker, Kafka Streams application or client) is affected only if both of these are true:

  • It runs on an affected Java version (see the table below).
  • It runs on an x86-64 CPU that supports AVX-512 VBMI.

Java 8, Java 11 and ARM64 machines are not affected.

JavaAffectedFixed in
1717.0.6 through 17.0.2117.0.21.1
2121 through 21.0.1321.0.13.1
2525 through 25.0.525.0.5.1
2727 through 27.0.127.0.1.1
18–20, 22–24, 26All releasesNo fix (no longer updated)

JDK vendors may use their own version numbers, so check your vendor’s advisory for the build that contains the fix.

Upgrading

Upgrade every Kafka JVM to the “Fixed in” version or later once your JDK vendor publishes it. If you run Kafka on a Java version that no longer receives updates, move to a maintained LTS release supported by your Kafka version.

Until you can upgrade

Disable the Base64 intrinsic with the JVM flag -XX:-UseBASE64Intrinsics. Kafka’s start scripts, such as kafka-server-start.sh and connect-distributed.sh, pass the KAFKA_OPTS environment variable to the JVM:

export KAFKA_OPTS="-XX:-UseBASE64Intrinsics"
bin/kafka-server-start.sh config/server.properties

If KAFKA_OPTS is already set, for example to point to a JAAS file, append the flag to the existing value. For client and Kafka Streams applications, add the flag to the application’s own JVM options.

Keep in mind:

  • The flag exists on Java 11 and later. Java 8 does not recognize it and fails to start, so do not set it there (Java 8 is not affected).
  • -XX:UseAVX=2 also avoids the affected code on x86-64, but it disables all AVX-512 use, and JVMs on ARM reject it and fail to start. -XX:-UseBASE64Intrinsics works on both architectures.

Docker images

apache/kafka

The apache/kafka images bundle an Eclipse Temurin JRE, and every tag published so far includes an affected version. For example, 4.4.0 ships Temurin 25.0.4.1, 4.3.2 ships Temurin 21.0.12.1 and 4.2.2 ships Temurin 21.0.12. To check the JRE in a given image:

docker run --rm --entrypoint java apache/kafka:4.4.0 -version

To apply the workaround, pass the flag through KAFKA_OPTS. The image hands this variable to the JVM rather than treating it as a broker property:

docker run -e KAFKA_OPTS="-XX:-UseBASE64Intrinsics" apache/kafka:4.4.0

Future apache/kafka images will ship with a fixed JRE.

apache/kafka-native

The apache/kafka-native images are not affected. They contain a GraalVM native executable and do not run on the HotSpot JVM, where the affected code lives.