Java4Shell: Is Your Server Next? Find Every Vulnerable JVM
Java4Shell: Is Your Server Next? Find Every Vulnerable JVM CVE-2026-114938 (Java4Shell) is a heap out-of-bounds write in OpenJDK's AVX-512 Base64 decoder. I covered the background in a separate post. This one is the ru
Java4Shell: Is Your Server Next? Find Every Vulnerable JVM
CVE-2026-114938 (Java4Shell) is a heap out-of-bounds write in OpenJDK's AVX-512 Base64 decoder. I covered the background in a separate post. This one is the runbook: how to find the JVMs that matter, what to run, what to change and how to prove it worked.
I have not run this against a vulnerable machine. The commands come from the Qualys, Upwind, Endor Labs and Equixly write-ups, and I only checked that the shell and Java snippets parse. Test in staging first.
TL;DR
| Step | Goal | Time |
|---|---|---|
| 1. Inventory | Find the real runtime behind every Java process | minutes per host |
| 2. Hardware check | Split hosts by AVX-512 VBMI | seconds |
| 3. Patch | Move to a vendor build that carries the fix | your restart window |
| 4. Mitigate | Apply a JVM flag where you cannot patch | one restart |
| 5. Verify | Prove the flag or build is live in the running process | seconds |
| 6. Watch | Alert on crash and decode patterns | ongoing |
1. Inventory the JVM that actually runs
Your shell's java tells you very little. Jenkins, Jira, Confluence, Keycloak and Elasticsearch ship or select their own runtime. Equixly and Endor Labs both call this out. Ask the process.
#!/usr/bin/env bash
# jvm-inventory.sh: one line per running JVM with its real binary and version
set -u
for pid in $(pgrep -f '[j]ava'); do
exe=$(readlink -f "/proc/$pid/exe" 2>/dev/null || echo unknown)
ver=$(jcmd "$pid" VM.version 2>/dev/null | grep -m1 -E 'JDK|OpenJDK' || echo "jcmd unavailable")
printf '%s\t%s\t%s\n' "$pid" "$exe" "$ver"
done
jcmd must run as the same user as the target JVM. If it prints "jcmd unavailable", the process may be a minimal runtime without the JDK tools. Fall back to "$exe" -version.
Version triage, using the ranges Qualys and Upwind list.
| Line | Affected | Fixed Oracle build |
|---|---|---|
| 17 | 17.0.6 and later, before the fix | 17.0.21.1 |
| 21 | up to 21.0.13 | 21.0.13.1 |
| 25 | up to 25.0.5 | 25.0.5.1 |
| 27 | up to 27.0.1 | 27.0.1.1 |
| 8 | Oracle Enterprise Performance Pack 8u511b33-perf | 8u513-perf |
| 11, 17.0.0 to 17.0.5, standard 8 | not affected | none needed |
A version number is not proof. Endor Labs warns that an LTS build with a matching number may still lack the commit, because the fix is tracked as JDK-8393212. Treat the vendor advisory as the source of truth, and note that Qualys lists Corretto 17.0.21.1.2 as released.
2. Check the hardware
Only x86-64 hosts with AVX-512 VBMI reach the vulnerable routine. Run this on each host or container node.
grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$' | sort
Per Qualys, you are on the hardware side of the risk only when all four flags appear. Intel Ice Lake and later server parts and AMD Zen 4 and later qualify. ARM64, including Graviton and Apple silicon, does not.
In Kubernetes, pods inherit the node's CPU, so check the node and not the image.
# Which nodes would run the vulnerable path
for node in $(kubectl get nodes -o name); do
pod="cpucheck-${node#node/}"
kubectl debug "$node" -q --image=busybox --profile=general -- \
sh -c "grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -c avx512vbmi" 2>/dev/null \
| sed "s|^|$node avx512vbmi=|"
done
Remember Qualys's caution: a resize or an instance family change can move a workload onto an affected CPU later. A host that passes today is not a permanent pass.
3. Patch
Patching is the only complete fix, and the vendors say so. The steps that bite people are all about the running process.
- Rebuild container images from a base that carries the fixed JDK, then redeploy. Replacing files on disk does not change a JVM that is already running.
- Restart every Java process. Without a restart you have patched a file, not a process.
- For bundled runtimes, take the application vendor's update, not a hand-swapped JDK, unless the vendor documents it.
- For Temurin, Zulu, Microsoft, Red Hat and distro packages, confirm the fixed build in the vendor advisory. Equixly could not confirm those on November 17.
4. Mitigate where you cannot patch yet
Both Qualys and Upwind recommend one flag first.
-XX:-UseBASE64Intrinsics
It turns off the fast decoder on any architecture. Qualys warns that large Base64 workloads may slow down, and Upwind reports it stopped the overflow on every affected version they tested. In a container, set it through the environment.
ENV JAVA_TOOL_OPTIONS="-XX:-UseBASE64Intrinsics"
Two alternatives appear in the write-ups, and each has a trap.
| Flag | Trap |
|---|---|
-XX:UseAVX=2 |
Disables all AVX-512, so it can slow unrelated work. On ARM the JVM refuses to start. |
-XX:DisableIntrinsic=_base64_decodeBlock |
Without -XX:+UnlockDiagnosticVMOptions the JVM will not start. Pushed through JAVA_TOOL_OPTIONS, Upwind calls it a fleet-wide outage. |
A reverse proxy is not a control. Qualys says so plainly, and CISA's size-limit advice does not stop this bug on its own.
5. Verify in the running process
Setting a flag in a manifest proves nothing until you ask the process.
# Flag state inside a live JVM
jcmd <pid> VM.flags | tr ' ' '\n' | grep -E 'UseBASE64Intrinsics|UseAVX'
# Or ask a fresh JVM what it would do with your options
java -XX:+PrintFlagsFinal -version | grep -E 'UseAVX|UseBASE64Intrinsics'
You want UseBASE64Intrinsics = false in the process. Remove the flag after the patch lands, because it costs speed.
6. A guard in your own code
If you decode untrusted Base64 with java.util.Base64, you can reject the malformed shape before the decoder sees it. Upwind's detection heuristic is a Base64-alphabet token of 32 or more characters that ends in = and whose length is not a multiple of 4. Well-formed padded Base64 always has a length divisible by 4.
import java.util.Base64;
public final class SafeBase64 {
private SafeBase64() {}
/** Rejects padded input whose length cannot be valid Base64 before decoding. */
public static byte[] decode(String input) {
if (input.endsWith("=") && input.length() % 4 != 0) {
throw new IllegalArgumentException("malformed base64 padding");
}
return Base64.getDecoder().decode(input);
}
}
This is defense in depth. It narrows the input, and it does not replace the patch. I have not tested it against Calif's chains, which are unpublished.
7. Detection
Endor Labs and Equixly suggest the same few signals.
- Authorization headers or request fields where Base64 ends in
=or==and the length is not a multiple of 4. Equixly offers a WAF rule for the header:^Basic\s+(?:\S{4})*\S{0,2}=$. I have not validated it. - Bursts of
IllegalArgumentExceptionfromjava.util.Base64in request handlers, because every trigger throws after the write. - New
hs_err_pid*.logfiles. Equixly warns the log will not name Base64, because the crash comes later when the garbage collector reads the damaged object. Endor Labs describes a SIGSEGV in a GC copy routine with a compiledBase64$Decoder.decode0frame, clustered by source IP. - Java processes that start a shell or open new outbound connections, which Qualys lists as a monitoring signal.
# Quick sweep for recent JVM crash logs and their crash frame
find / -name 'hs_err_pid*.log' -mtime -2 2>/dev/null | while read -r f; do
echo "$f"; grep -m1 -E '^# (SIGSEGV|Problematic frame)' "$f"
done
8. Priorities
Qualys orders the work like this: internet-facing identity providers first, then Jira, Confluence, Jenkins and Artifactory, then other internet-facing Java services, then internal Kafka, Solr, Elasticsearch, Gerrit and Spinnaker. The first group is first because Calif's pre-auth claims name them.
The bottom line
The slow part of this incident will not be the patch. It will be learning which of your processes are Java and which JDK they use. Run the inventory script once, keep its output, and you will have the answer ready for the next runtime bug too.
How many of your JVMs would the script find that nobody on your team knew about?
GDS K S ยท thegdsks.com ยท building Glincker ยท follow on X @thegdsks
You cannot patch a runtime you have not inventoried.
Sources: Qualys, Upwind, Endor Labs, Equixly, CISA alert.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.