Skip to content

About

Check and mitigate CVE-2026-114938 (java4shell), the Java AVX-512 Base64 RCE: osquery queries, Linux and Windows check scripts, optional JVM-flag mitigation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CVE-2026-114938 (java4shell): check and mitigate

Scripts and queries to find Java processes affected by CVE-2026-114938, and an optional temporary mitigation until you can patch.

  • What it is: a reported unauthenticated remote code execution flaw in Java's hardware-accelerated (AVX-512) Base64 code.
  • Affected: Java SE 8, 11, 17, 21, 25 and 27 (Oracle November 2026 update). Early reports focus on 17.0.6 and later.
  • At risk: a host running an affected Java version, on a CPU with AVX-512 (avx512f, avx512bw, avx512vbmi, bmi2), with a Java service reachable over the network. Linux and Windows are both affected.
  • The fix: install the Java update and restart the Java services. For the fixed version of each Java line and each vendor build, see the Oracle Critical Patch Update, November 2026 and your Java vendor's advisory (Adoptium, Amazon Corretto, Azul, Red Hat, Microsoft, ...). This repo doesn't repeat the version matrix.

References: calif.io/java4shell · Oracle Critical Patch Update, November 2026

What's in this repo

Path What it does
queries/linux.sql, queries/windows.sql osquery queries for a fleet-wide first pass (Insight or any osquery tool)
scripts/linux/check-java4shell.sh Confirms the result on one Linux host. Read-only.
scripts/windows/Check-Java4Shell.ps1 Confirms the result on one Windows host. Read-only.
scripts/linux/mitigate-java4shell.sh Optional: adds the mitigation flag to a systemd service
scripts/windows/Mitigate-Java4Shell.ps1 Optional: adds the mitigation flag to a Windows service

How to use

1. Find candidate hosts (whole fleet)

Run queries/linux.sql on Linux hosts and queries/windows.sql on Windows hosts (in Insight, set the OS filter). You get one row per Java process with a verdict, the Java version, CPU flags and exposed ports.

The queries are a first pass: they can only see two of the four CPU flags, and they miss mitigation flags set through environment variables or the Tomcat service registry. Use the check scripts below to confirm hosts the query flags.

2. Confirm on a host

Linux (run as root so every process is visible):

sudo bash scripts/linux/check-java4shell.sh

Windows (run in an elevated PowerShell):

powershell -ExecutionPolicy Bypass -File .\scripts\windows\Check-Java4Shell.ps1

On Windows PowerShell 5.1 the script can confirm avx512f only. For a full CPU check, either run it with PowerShell 7.4+ (pwsh), or put Sysinternals coreinfo64.exe on the PATH or pass -CoreinfoPath C:\Tools\coreinfo64.exe.

Example output:

java4shell (CVE-2026-114938) check - host app01 - 2026-11-18T10:11:56Z
CPU         : x86_64  avx512f=yes avx512bw=yes avx512vbmi=yes bmi2=yes
              -> AFFECTED - all four required features present

[POTENTIALLY VULNERABLE - EXPOSED on network]
  pid 2512 (tomcat)  java
  java        : 17.0.6 (Eclipse Adoptium)  at /opt/java/jdk-17.0.6
  mitigation  : none
  jvm default : UseAVX=3 UseBASE64Intrinsics=true
  ports       : 8080,8443
  cmdline     : /opt/java/jdk-17.0.6/bin/java -Xmx2g ... org.apache.catalina.startup.Bootstrap start

Summary: 1 JVM process(es): 1 exposed, 0 not listening, 0 mitigated, 0 patched, 0 not vulnerable

Useful options (same on both scripts):

Linux Windows Purpose
--csv -Csv One CSV row per process, to collect results from many hosts
--patched LIST -Patched LIST Optional. Mark processes at or above these versions as PATCHED. LIST is the first fixed version for each Java line you run, comma-separated (for example 17.0.N,21.0.N), taken from the Oracle advisory or your Java vendor. Without it, no process is reported as PATCHED.
--no-exec -NoExec Don't run java to read the version and default flags. Even without it, the scripts only run a java that other users can't modify: root-owned on Linux, under Program Files or Windows on Windows.
-PassThru Return PowerShell objects instead of text

Exit codes, for automation: 0 nothing at risk · 1 potentially vulnerable, not listening · 2 potentially vulnerable and exposed · 3 error.

3. Read the verdict

Verdict Meaning Action
POTENTIALLY VULNERABLE - EXPOSED on network Affected CPU, no mitigation, listening on a non-loopback port Patch first. Until then, restrict network access or mitigate.
POTENTIALLY VULNERABLE - not listening on network Affected, but only reachable locally Patch in the normal cycle
MITIGATED - JVM flag set A mitigation flag is set (the output says where) Patch when you can, then remove the flag
PATCHED - <version> >= <fixed> Version is at or above what you passed to --patched None
NOT VULNERABLE - CPU lacks required flags CPU has no AVX-512 (or is not x86-64) None
NOT VULNERABLE - JVM does not enable ... This Java build does not use AVX-512 / Base64 intrinsics on this CPU None
No JVMs found No Java running right now Patch installed Java in the normal cycle

What the scripts check that the queries can't: all four CPU flags, flags set in JAVA_TOOL_OPTIONS / JDK_JAVA_OPTIONS / _JAVA_OPTIONS, Tomcat (Procrun) service options on Windows, the Java version actually loaded by the process, the JVM's own AVX-512 default, and ports inside container network namespaces on Linux. On Linux they also flag JVMs still running an old Java that was upgraded on disk (restart needed).

On Windows, the environment of a running process can't be read. The script counts flags set on the service (including wrapper services such as nssm) and in Tomcat's Procrun options. A flag in the machine-wide JAVA_TOOL_OPTIONS is reported in a note line but not counted, because it can't be confirmed for that process.

4. Optional: mitigate until you can patch

Patching is the fix. If you can't patch yet, turn off the affected code with one JVM flag and restart the Java service:

Flag Effect Notes
-XX:-UseBASE64Intrinsics Turns off hardware-accelerated Base64 Default in the scripts
-XX:UseAVX=2 Turns off AVX-512 entirely x86-64 only. On ARM the JVM won't start.

Both flags can slow Base64-heavy or vector-heavy workloads. A flag only takes effect after the Java process restarts. Also restrict network access to exposed Java services.

The mitigation scripts are dry-run by default: they show what they would change and change nothing until you add --apply / -Apply. Before changing anything they check that the service's Java accepts the flag, because a JVM that doesn't recognize an -XX flag refuses to start.

Linux (systemd service):

# 1. See what would change
sudo bash scripts/linux/mitigate-java4shell.sh --unit tomcat

# 2. Apply, restart, and verify the new JVM has the flag
sudo bash scripts/linux/mitigate-java4shell.sh --unit tomcat --apply --restart

# Use -XX:UseAVX=2 instead
sudo bash scripts/linux/mitigate-java4shell.sh --unit tomcat --flag avx2 --apply --restart

# Undo after patching
sudo bash scripts/linux/mitigate-java4shell.sh --unit tomcat --undo --apply --restart

This adds /etc/systemd/system/<unit>.d/90-java4shell-mitigation.conf, which appends the flag to the service's JAVA_TOOL_OPTIONS (any existing value is kept). Undo deletes that file.

Windows (service):

# 1. See what would change
.\scripts\windows\Mitigate-Java4Shell.ps1 -ServiceName Tomcat9

# 2. Apply, restart, and verify
.\scripts\windows\Mitigate-Java4Shell.ps1 -ServiceName Tomcat9 -Apply -Restart

# Use -XX:UseAVX=2 instead
.\scripts\windows\Mitigate-Java4Shell.ps1 -ServiceName Tomcat9 -Flag Avx2 -Apply -Restart

# Undo after patching
.\scripts\windows\Mitigate-Java4Shell.ps1 -ServiceName Tomcat9 -Undo -Apply -Restart

For Tomcat and other Procrun services this adds the flag to the service's JVM options in the registry. For other services it adds it to JAVA_TOOL_OPTIONS in the service's environment. The original values are saved to %ProgramData%\java4shell-mitigation\<service>.json and put back by -Undo.

Other ways Java is started (not covered by the scripts), add the flag where the JVM options live:

  • Tomcat started with catalina.sh: CATALINA_OPTS="$CATALINA_OPTS -XX:-UseBASE64Intrinsics" in bin/setenv.sh
  • Docker / Kubernetes: set JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics on the container, then redeploy. Run the check script on the node; it sees processes inside containers.
  • Plain java -jar: add the flag before -jar.

Then run the check script again: the process should show MITIGATED - JVM flag set.

Manual CPU check

To check the CPU by hand:

  • Linux: grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$' Affected only if all four are listed.
  • Windows: coreinfo64 -accepteula -f (Sysinternals) and look for the AVX-512 and BMI2 entries.

About

Check and mitigate CVE-2026-114938 (java4shell), the Java AVX-512 Base64 RCE: osquery queries, Linux and Windows check scripts, optional JVM-flag mitigation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages