November 19, 2026
Java4shell assessment
Patch now, then audit your own code

By Pjastrza
3 min read
On November 17, 2026, Calif disclosed Java4Shell, a critical memory-corruption bug in OpenJDK's x86โ64 Base64 decoder. The technical write-up is at https://calif.io/java4shell. It covers the root cause, the trigger, the affected versions and CPUs, and the products they exploited. We won't repeat it here. This note covers what to do about it.
Act first
Big vendors are exposed, including identity, CI and collaboration tools that many of us run (Keycloak, Jira, Confluence, Artifactory, Jenkins and PingFederate). If you self host any of it treat this as urgent.
- Patch the JDK. Update, rebuild images from fresh base layers, restart, and confirm the running version.
- If you can't patch today, redeploy every service with one of these flags: โ -XX:-UseBASE64Intrinsics disables hardware-accelerated Base64 encoding and decoding. โ -XX:UseAVX=2 disables AVX-512. Apply it needed only on x86โ64 hosts. OpenJDK on ARM doesn't recognize it and will fail to start.
Keep the risk in proportion
As of Today, a crash (DoS) is the main risk. RCE needs a heap-grooming chain built for one target. Vibe-produced RCE are not publicly available, but. That can change quickly, so don't wait.
What this says about custom applications?
There is no public exploit for your custom applications. Are you safe then?Well if the first working exploit took two hours and under $200 in tokens, redoing it for your app is not unlikely now.
Source leaks, and so do decompiled jars. If an attacker has your source, a targeted exploit may cost about that much. Assume a motivated attacker can do this.
Use the same tools on your own code
The attackers' advantage is cheap AI-assisted code review. You can use it too as well.
Start small:
- For this specific bug, explore use of native base64 decoders in code as well as in libraries
- Apart from Base64 decode issue give assistant a narrow, specific task. "Find places where input length or offset arithmetic could underflow, overflow or be miscomputed." Narrow prompts give better results than "find vulnerabilities."
- Focus on riskiest surface. Look at code that parses untrusted input before authentication, such as decoders, deserializers, file and archive handlers, and custom protocol code. Look at native or Unsafe usage as well.
- Ask for a failing input. Make the tool produce a concrete input or test for each suspected bug. Discard the findings it can't demonstrate. Review and fix. Have a person confirm each result. Then add the working inputs to your regression tests and fuzzing corpus.
Finding and exploiting bugs like this is now cheap, so finding them first is worth the effort.
Bonus: Below there is kubernetes deployment to reproduce if given combination of AWS ec2 instance + java container is still prone to this bug
(source of java comes from here)
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-config
data:
run.sh: |
#!/usr/bin/env bash
# Triage detector for CVE-2026-114938 ("Java4Shell").
#
set -u
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
echo "===== Compiling detector ====="
javac Java4ShellCheck.java || { echo "compile failed"; exit 2; }
echo
java Java4ShellCheck
Java4ShellCheck.java: |
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
/** Bounded standalone trigger: every write stays inside a real 4096-byte array. */
public final class Java4ShellCheck {
private static volatile int sink;
public static void main(String[] args) {
Base64.Decoder decoder = Base64.getDecoder();
byte[] valid = "A".repeat(64).getBytes(StandardCharsets.US_ASCII);
byte[] malformed = ("A".repeat(64) + "=").getBytes(StandardCharsets.US_ASCII);
byte[] target = new byte[4096];
for (int i = 0; i < 200_000; i++) {
sink += decoder.decode(valid, target);
}
Arrays.fill(target, (byte) 0x5a);
boolean rejected = false;
try {
decoder.decode(malformed, target);
} catch (IllegalArgumentException expected) {
rejected = true;
}
int changed = 0;
int first = -1;
int last = -1;
for (int i = 50; i < target.length; i++) {
if (target[i] != (byte) 0x5a) {
changed++;
if (first < 0) first = i;
last = i;
}
}
System.out.println("runtime=" + System.getProperty("java.runtime.version"));
System.out.println("vm=" + System.getProperty("java.vm.name"));
System.out.printf("rejected=%s changed=%d first=%d last=%d%n",
rejected, changed, first, last);
if (!rejected || changed != 62 || first != 50 || last != 111) {
System.err.println("NOT REPRODUCED");
System.exit(1);
}
System.out.println("REPRODUCED");
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-app
labels:
app: demo-app
spec:
replicas: 1
selector:
matchLabels:
app: demo-app
template:
metadata:
labels:
app: demo-app
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: karpenter.k8s.aws/instance-family
operator: In
values:
- c8i
- m8i
- m8a
- c7i
- m7i
- c7a
- c6i
- m6i
containers:
- name: app
image: eclipse-temurin:25
command: ["sh", "-c"]
args:
- |
# ConfigMap mounts are read-only and run.sh compiles into its own dir,
# so copy the files to a writable workdir first.
cp /config/run.sh /config/Java4ShellCheck.java /work/
bash /work/run.sh
echo "===== run.sh finished (exit=$?), sleeping so logs stay available ====="
sleep infinity
resources:
requests:
cpu: 50m
memory: 256Mi
limits:
memory: 512Mi
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: work
mountPath: /work
volumes:
- name: work
emptyDir: {}
- name: config
configMap:
name: demo-configapiVersion: v1
kind: ConfigMap
metadata:
name: demo-config
data:
run.sh: |
#!/usr/bin/env bash
# Triage detector for CVE-2026-114938 ("Java4Shell").
#
set -u
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
echo "===== Compiling detector ====="
javac Java4ShellCheck.java || { echo "compile failed"; exit 2; }
echo
java Java4ShellCheck
Java4ShellCheck.java: |
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
/** Bounded standalone trigger: every write stays inside a real 4096-byte array. */
public final class Java4ShellCheck {
private static volatile int sink;
public static void main(String[] args) {
Base64.Decoder decoder = Base64.getDecoder();
byte[] valid = "A".repeat(64).getBytes(StandardCharsets.US_ASCII);
byte[] malformed = ("A".repeat(64) + "=").getBytes(StandardCharsets.US_ASCII);
byte[] target = new byte[4096];
for (int i = 0; i < 200_000; i++) {
sink += decoder.decode(valid, target);
}
Arrays.fill(target, (byte) 0x5a);
boolean rejected = false;
try {
decoder.decode(malformed, target);
} catch (IllegalArgumentException expected) {
rejected = true;
}
int changed = 0;
int first = -1;
int last = -1;
for (int i = 50; i < target.length; i++) {
if (target[i] != (byte) 0x5a) {
changed++;
if (first < 0) first = i;
last = i;
}
}
System.out.println("runtime=" + System.getProperty("java.runtime.version"));
System.out.println("vm=" + System.getProperty("java.vm.name"));
System.out.printf("rejected=%s changed=%d first=%d last=%d%n",
rejected, changed, first, last);
if (!rejected || changed != 62 || first != 50 || last != 111) {
System.err.println("NOT REPRODUCED");
System.exit(1);
}
System.out.println("REPRODUCED");
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-app
labels:
app: demo-app
spec:
replicas: 1
selector:
matchLabels:
app: demo-app
template:
metadata:
labels:
app: demo-app
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: karpenter.k8s.aws/instance-family
operator: In
values:
- c8i
- m8i
- m8a
- c7i
- m7i
- c7a
- c6i
- m6i
containers:
- name: app
image: eclipse-temurin:25
command: ["sh", "-c"]
args:
- |
# ConfigMap mounts are read-only and run.sh compiles into its own dir,
# so copy the files to a writable workdir first.
cp /config/run.sh /config/Java4ShellCheck.java /work/
bash /work/run.sh
echo "===== run.sh finished (exit=$?), sleeping so logs stay available ====="
sleep infinity
resources:
requests:
cpu: 50m
memory: 256Mi
limits:
memory: 512Mi
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: work
mountPath: /work
volumes:
- name: work
emptyDir: {}
- name: config
configMap:
name: demo-configReferences
- Calif technical write-up: https://calif.io/java4shell
- SOC Prime summary: https://socprime.com/blog/cve-2026-114938-java4shell-flaw-enables-pre-auth-rce-in-major-java-applications/
- Cloudflare write-up https://blog.cloudflare.com/java4shell-waf-protection/