Skip to content

About

Scanner, Nuclei template, and remediation guide for CVE-2026-114938 (Java4Shell)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Java4Shell (CVE-2026-114938) scanner and fix guide

Java4Shell is a heap out-of-bounds write in OpenJDK HotSpot's AVX-512 VBMI Base64 decoder. A malformed 65-byte input ("A" * 64 + "=") underflows the output mask calculation and writes 62 bytes past the decoded buffer.

This repository contains:

  • A network scanner that checks common JVM version disclosure endpoints.
  • A local host checker for the installed java binary, JVM flags, and CPU requirements.
  • A Nuclei template for the same version and exposure checks.
  • A remediation guide with upgrade targets, restart verification, and interim mitigations.

The tools detect affected JVM versions. They do not send the exploit trigger and cannot confirm exploitability.

Affected versions

JDK Affected Fixed
17 17.0.6 through 17.0.21 17.0.21.1
21 before 21.0.13.1 21.0.13.1
25 before 25.0.5.1 25.0.5.1
27 before 27.0.1.1 27.0.1.1

The OpenJDK risk matrix lists JDK 17, 21, 25, and 27 for CVE-2026-114938. Java 8 and 11 are not in that matrix for this CVE, but Oracle's November 2026 CPU also ships 8u513 and 11.0.33.1, so keep those lines on their normal patch cadence.

Exploitation also requires an x86-64 CPU with all four flags: avx512f, avx512bw, avx512vbmi, and bmi2. Intel Ice Lake and newer, and AMD Zen 4 and newer, are the relevant generations. ARM64 is not affected by this bug.

CVSS: 9.2 critical under CVSS 4.0, 8.1 high under CVSS 3.1. CWE-191 and CWE-122.

Quick start

git clone https://github.com/Ademking/java4shell.git
cd java4shell

# Scan one target
python3 scanner/java4shell_scan.py --target https://app.example.com

# Run the Nuclei template
nuclei -u https://app.example.com -t nuclei/CVE-2026-114938.yaml

# Check the local java binary
python3 scanner/java4shell_host_check.py

Network scanner

The scanner probes these sources:

Source Endpoint Field
Apache Solr /solr/admin/info/system?wt=json jvm.version
Spring Boot Actuator /actuator/env, /env, /actuator;/env; java.runtime.version
Elasticsearch / OpenSearch /_nodes/_local nodes.*.jvm.version
Hadoop / JMX /jmx?qry=java.lang:type=Runtime VmVersion
Jolokia /jolokia/read/..., /actuator/jolokia/..., /api/jolokia/... value
HTTP headers / Server, X-Powered-By
# Single target
python3 scanner/java4shell_scan.py --target https://app.example.com

# Target file, JSON output
python3 scanner/java4shell_scan.py --targets examples/targets.txt --json -o results.json

# CIDR range with a custom port list
python3 scanner/java4shell_scan.py --cidr 10.0.0.0/24 --ports 443,8443 --threads 50

# Self-signed TLS and extra header
python3 scanner/java4shell_scan.py --target https://10.0.0.10:8443 --insecure --header "X-Env: prod"

# Fail a CI job when an affected build is found
python3 scanner/java4shell_scan.py --targets hosts.txt --fail-on-affected

Useful flags:

Flag Purpose
--json / --jsonl Machine-readable output
--insecure Skip TLS certificate verification
--auth user:pass HTTP Basic authentication
--header "Name: Value" Extra request header, repeatable
--ports Ports for targets without an explicit port
--timeout Per-request timeout, default 5 seconds
--threads Concurrent targets, default 20
--max-hosts Guard for CIDR expansion
--fail-on-affected Exit 1 when any target is affected

Reading the result

Assessment Meaning
AFFECTED A management endpoint reported a JVM build inside a published affected range.
CANDIDATE Only an HTTP header reported an affected version. Headers can be spoofed or describe a different runtime.
NOT_AFFECTED A management endpoint reported a build outside the affected ranges. This is not proof of safety.
UNKNOWN A JVM-related endpoint responded, but no usable version was found.
NO_DATA No scanned endpoint disclosed a JVM version.
ERROR The scan failed before a result was produced.

AFFECTED is a triage lead, not proof of exploitability. The scanner cannot verify the CPU flags, JIT state, vendor backports, or hidden JVMs.

Nuclei template

nuclei -u https://app.example.com -t nuclei/CVE-2026-114938.yaml

The template uses the same five management endpoints and stops at the first match. It is a version and exposure check, not a POC. metadata.verified is false because no live vulnerable JVM was available for testing. Upstream nuclei-templates generally asks for a complete POC, so this template may not be accepted there; it remains useful for local triage.

Validate the template:

nuclei -validate -t nuclei/CVE-2026-114938.yaml

Local host check

# Find and check every reachable JDK on this host
python3 scanner/java4shell_host_check.py

# Check specific binaries
python3 scanner/java4shell_host_check.py --java /opt/java/bin/java --java /usr/lib/jvm/temurin-17/bin/java

# JSON for automation
python3 scanner/java4shell_host_check.py --json

Discovery covers JAVA_HOME, PATH, /usr/lib/jvm, /usr/java, /opt/java, /opt/jdk, SDKMAN, Gradle JDKs, and the usual Windows install roots. Symlinks are resolved and duplicates skipped. Passing --java replaces discovery.

The checker reads the java version, effective UseBASE64Intrinsics and UseAVX values, and the CPU flags. Exit codes: 0 no affected runtime, 1 at least one affected runtime, 2 execution error. It checks java binaries on this host. It does not inspect running JVMs, containers, or other hosts.

How to fix

The short version:

  1. Upgrade to 17.0.21.1, 21.0.13.1, 25.0.5.1, or 27.0.1.1, or the vendor's fixed build.
  2. Restart every JVM and container. A package upgrade alone does not replace a running process.
  3. Verify the running build with jcmd <pid> VM.version.
  4. If you cannot patch immediately, start the JVM with -XX:-UseBASE64Intrinsics or -XX:UseAVX=2 on x86-64.

See docs/FIX.md for vendor notes, restart commands, verification steps, interim mitigations, and detection guidance.

Detection limitations

  • The scanner is unauthenticated unless you pass --auth. Protected endpoints will not disclose versions.
  • A version match does not confirm AVX-512 VBMI hardware or a JIT-compiled intrinsic.
  • A fixed version does not rule out a second, hidden JVM.
  • Vendor backports can report an older upstream version while already being patched.
  • HTTP headers can be spoofed and often describe the application server, not the JDK.
  • The scanner does not test the vulnerability and does not send the trigger.

Repository layout

scanner/java4shell_scan.py        network scanner
scanner/java4shell_host_check.py  local java binary check
nuclei/CVE-2026-114938.yaml       Nuclei version and exposure template
docs/FIX.md                       remediation guide
tests/                            mock endpoints and unit tests
examples/targets.txt              sample target list

References

Legal

Use these tools only on systems you own or have written permission to test. Scanning third-party systems without authorization may violate law and contracts.

License

MIT. See LICENSE.

About

Scanner, Nuclei template, and remediation guide for CVE-2026-114938 (Java4Shell)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages