Java4Shell: How to Check and Patch CVE-2026-114938
Check your running Java build for Java4Shell, patch affected Linux servers and containers, and verify the permanent fix or temporary JVM workaround after restart.
A Java security update can install successfully while your application keeps running the vulnerable JVM. This happens when a service hasn’t restarted, a container still uses an old image, or an application starts its own bundled copy of Java.
To fix Java4Shell, identify the runtime serving production traffic, install your vendor’s corrected build, restart the service, and verify the new JVM. If you can’t patch an affected service immediately, disable its accelerated Base64 decoder with -XX:-UseBASE64Intrinsics and restart it. access.redhat.com
1. Check whether your Java service is affected
Java4Shell, disclosed on 17 November 2026 and tracked as CVE-2026-114938, is a memory corruption vulnerability in the accelerated Base64 decoder used by certain Java runtimes. On an affected x86-64 deployment with AVX-512 VBMI support, the flaw can allow unauthenticated remote code execution. To assess a service, you need two pieces of information: its running Java build and the CPU features available to the workload. www.sophos.com
Identify the running JVM
For a Linux service managed by systemd, replace myapp.service with your unit name and get its main process ID.
systemctl show --property=MainPID --value myapp.serviceIf the result is 1842 and that process is Java, run the following command as the service account. It requires the JDK’s jcmd diagnostic tool.
jcmd 1842 VM.versionRecord the full version and build. If the main process is a wrapper script, inspect its Java child instead. For a containerised application, check in the application container. Running java -version in your SSH session tells you which Java executable your shell starts. The service may use a different one.
Check the CPU feature
On the Linux host or VM running the workload, use these read-only commands.
uname -m
grep -m1 -ow avx512vbmi /proc/cpuinfoIf you see x86_64 followed by avx512vbmi, the relevant CPU feature is present. Compare the running build with your vendor’s advisory to determine whether it needs remediation. ARM64 falls outside this particular hardware-dependent issue. For Kubernetes, check every node pool where the application can be scheduled, especially if your cluster mixes processor types. access.redhat.com
2. Choose the fixed build for your Java distribution
For Eclipse Temurin, Adoptium identifies these November 2026 builds as containing the Java4Shell fix. adoptium.net
| Temurin release | November build containing the fix |
|---|---|
| Java 17 | 17.0.21.1+2 |
| Java 21 | 21.0.13.1+2 |
| Java 25 | 25.0.5.1+2 |
| Java 27 | 27.0.1.1+4 |
Read the entire build string. For example, 21.0.13+9 was Temurin’s October release. The November build carrying the fix is 21.0.13.1+2. Both can appear as “Java 21” in an inventory dashboard. adoptium.net
For Oracle Java, Red Hat OpenJDK or another distribution, use that vendor’s fixed build or package revision. A Linux distributor can backport a security fix, so keep the package revision alongside the JVM version when documenting the update. www.oracle.com
3. Patch the runtime your application uses
Ubuntu or Debian
The following example applies to a service using the distribution’s OpenJDK 21 headless runtime. Refresh the package index and check which revision your repository offers.
sudo apt update
apt-cache policy openjdk-21-jre-headlessCompare the Candidate revision with your distribution’s security advisory. Once you confirm that it contains the fix, upgrade the package and restart the service.
sudo apt install --only-upgrade openjdk-21-jre-headless
sudo systemctl restart myapp.serviceIf the candidate is still affected, use the temporary workaround in step 4. If your application uses a different Java package, substitute its installed package name.
RHEL, AlmaLinux or Rocky Linux
For a service using the distribution’s OpenJDK 21 headless package, confirm the corrected revision in your distribution’s advisory, then run:
sudo dnf upgrade java-21-openjdk-headless
sudo systemctl restart myapp.serviceCheck the installed revision afterwards. A package manager reporting “nothing to do” means it found no upgrade in the enabled repositories. You still need to match the installed revision to the advisory before closing the issue. access.redhat.com
Docker Compose or Kubernetes
For a containerised application, the fix belongs in the application image. Select a base image containing the corrected runtime, record its digest, and rebuild. Adoptium publishes container images after the corresponding binaries are ready, so verify the Java build inside the replacement container even when you use a familiar tag such as 21-jre. adoptium.net
For a Compose service named app that builds from your Dockerfile:
docker compose build --pull app
docker compose up -d --no-deps app
docker compose exec app java -versionThat last command checks the container’s default Java executable. If the application starts a bundled JVM, verify that process separately. For a worked example of rebuilding and replacing a Compose-managed service, see Hitori Tech’s guide to updating Ghost with Docker.
For Kubernetes, deploy the rebuilt image through your usual release process. Check that the rollout completes and that every serving replica uses the expected image digest. One healthy new pod can coexist with older replicas during a rollout.
Applications with bundled Java
Check the product vendor’s supported upgrade path before changing JAVA_HOME. An application may start Java from its own installation directory or ship it inside a vendor-maintained image. For example, Red Hat documents both a JDK upgrade and a corrected container image as permanent fixes for its build of Keycloak, depending on how you installed it. access.redhat.com
4. Apply a temporary workaround if the patch must wait
Add the following option to the affected JVM’s startup configuration:
-XX:-UseBASE64IntrinsicsThis is the preferred interim mitigation because it disables the accelerated Base64 implementation while preserving other vector optimisations. Red Hat also documents -XX:UseAVX=2 as a broader x86-64-only fallback. That option can prevent an ARM64 JVM from starting. Choose one option and test it on a single affected instance first. access.redhat.com
For a systemd service that launches Java directly, create a service-specific override:
sudo systemctl edit myapp.serviceIf the service has no existing JDK_JAVA_OPTIONS value, add:
[Service]
Environment="JDK_JAVA_OPTIONS=-XX:-UseBASE64Intrinsics"If it already has a value, append the flag where that value is defined so the service keeps its existing startup options. Then reload the unit and restart the application.
sudo systemctl daemon-reload
sudo systemctl restart myapp.service
sudo systemctl is-active myapp.serviceFor Compose or Kubernetes, add the option to the Java container’s environment and roll out replacement containers. Editing a deployment file alone leaves the existing JVM running with its original settings.
5. Verify the patch or workaround on the live service
After the restart, retrieve the new process ID. For a patched service, run jcmd PID VM.version, replacing PID with the current numeric ID. Compare the output with your vendor’s fixed build. If your distribution backported the fix, also verify the installed package revision.
For a service using the temporary workaround, inspect its effective JVM settings:
jcmd PID VM.flags -all | grep -E 'UseBASE64Intrinsics|UseAVX[[:space:]]'
| Change applied | What to verify |
|---|---|
| Patched runtime | The running JVM matches the vendor-confirmed build or patched package revision. |
| Preferred Base64 workaround | The running JVM reports UseBASE64Intrinsics = false. |
| x86-64 AVX fallback | The running JVM reports UseAVX = 2. |
Finally, send a normal request through the application and check its health on every serving replica. Close the patch ticket when every affected instance is running the corrected build and serving requests successfully. If an instance still relies on a startup flag, record its owner and patch date so the temporary mitigation gets replaced. access.redhat.com