With the recently disclosed Java4Shell vulnerability (CVE-2026-114938), we had to apply a temporary mitigation to some of our Java applications.
For context, our setup is pretty straightforward. We have applications built through Jenkins, packaged into Docker images, and deployed as containers.
No Kubernetes, no fancy orchestration. Just good old Docker. :)
Before applying the mitigation#
First, let's check whether the running JVM is actually affected. Not every Java version or machine is.
-
Check the Java version inside the container, not just the JDK on your laptop or the version in the Dockerfile:
docker exec <container-name> java -version -
Check the affected versions. For the standard OpenJDK HotSpot builds, the vulnerable implementation starts with Java 17.0.6. Earlier Java 17 releases (17.0.0–17.0.5) don't have this vulnerable path, and standard Java 8 and Java 11 aren't affected.
Java line Affected releases First fixed OpenJDK release 17 17.0.6 through 17.0.21 17.0.21.1 21 21 through 21.0.13 21.0.13.1 25 25 through 25.0.5 25.0.5.1 27 27 through 27.0.1 27.0.1.1 The no-longer-supported lines 18–20, 22–24, and 26 are also affected; move to a supported, fixed JDK rather than expecting patches for those releases. Vendor-specific builds may differ: for example, Oracle's Java 8 Enterprise Performance Pack is a special exception to the usual Java 8 guidance.
-
Check the hardware and code path. The reported bug needs an x86-64 JVM on a CPU that supports AVX-512 VBMI, with the vulnerable Base64 intrinsic enabled and attacker-controlled input reaching it. An ARM64 runtime won't use this affected x86 implementation.
-
Check your JDK vendor's fix. Eclipse Temurin, for example, is built from OpenJDK and uses HotSpot. Adoptium lists fixed Temurin builds 17.0.21.1+2, 21.0.13.1+2, 25.0.5.1+2, and 27.0.1.1+4. Check the full build number, especially if your application runs in Docker.
Prefer a patched JDK whenever one is available. The JVM flag below is an interim workaround, not a replacement for updating your runtime.
Sources: Calif — original research and affected builds; Apache Flink — affected version ranges; Eclipse Adoptium — fixed Temurin builds.
One of the recommended mitigations for Java4Shell is disabling the JVM's optimized Base64 implementation using:
-XX:-UseBASE64Intrinsics
So, we add the flag to our JVM startup configuration, rebuild, redeploy, and we're done.
But how do we know the flag actually made it to the running JVM?
Well, there's a handy little tool for that: JConsole.
How to check using JConsole#
JConsole is a monitoring and management tool included with the JDK. Among other things, it lets you inspect the JVM arguments used to start a Java application.
Here's how:
- Open a terminal on a machine with the JDK installed.
- Run
jconsole. - A graphical interface opens, allowing you to connect to a running Java process.
- Select your application and connect.
- Navigate to the VM Summary tab (called VM in some JDK versions).
- Look for the VM arguments section.
You should see something like:
-XX:-UseBASE64Intrinsics
And that's it! You can confirm that the JVM received the argument.
For an additional check, you can navigate to MBeans → com.sun.management → HotSpotDiagnostic → Operations → getVMOption, enter UseBASE64Intrinsics, and check that its value is false.
A small Docker caveat: If your application runs inside a container, it won't necessarily appear in JConsole's local process list. You'll need access to the JVM, either through a supported local attachment or a properly configured JMX connection.
Why is this useful?#
Because adding a flag to a Dockerfile, Jenkins pipeline, or startup script doesn't necessarily mean it was applied to the Java process that's actually running.
And this isn't limited to security mitigations. The same approach works when checking memory settings, garbage collection options, or other JVM arguments.
The takeaway? Don't just trust your configuration. Check your running JVM.
One last note: disabling Base64 intrinsics is a temporary mitigation for Java4Shell, not a replacement for updating to a patched JDK.
If you want the explanation behind the mitigation, I also wrote Java4Shell explained: how can Base64 corrupt the JVM?, including the HotSpot code and diagrams.