Java4Shell (CVE-2026-114938) is a memory-corruption vulnerability in OpenJDK’s Base64 decoding intrinsic. It only affects Java 17 and later versions running on x86-64 CPUs with AVX-512 VBMI support.
What Happened
It allows remote code execution when untrusted Base64 data is processed by a JVM.
The vulnerability is triggered during Base64 decoding when input ends with padding. The JVM incorrectly calculates a store mask, leading to a 64-byte write regardless of available memory. This can overflow arrays by up to 62 bytes.
Why It Matters
Unlike typical software vulnerabilities, Java4Shell’s impact depends on the underlying CPU architecture. A service running on a safe node today could move to an affected one after a hardware refresh or autoscaling event.
This makes patching difficult. The same container image may be secure on one machine and vulnerable on another. The CPU configuration is not visible in code or configuration files—it’s determined at runtime by infrastructure decisions like instance type or autoscaling groups.
How It Works
OpenJDK uses hand-tuned machine code intrinsics for performance. Base64 decoding is one such intrinsic, optimized for modern x86-64 processors with AVX-512 VBMI.
When the JVM starts, it selects the appropriate intrinsic path based on available CPU features. The vulnerable path is used only when AVX-512 VBMI is present. This means the vulnerability is not present in all Java versions or on all hardware.
Standard OpenJDK 8 and 11 do not include the vulnerable intrinsic. However, Oracle’s 8u511 Performance Pack build does, making it a potential risk in specific environments.
How to Find Affected Systems
Organizations must scan their repositories and infrastructure to identify all Java runtime instances. The following queries help locate vulnerable components:
- Dockerfile or Containerfile: Find base images using OpenJDK variants like Temurin, Corretto, Zulu, or Oracle.
- Package managers: Detect installations of openjdk, temurin, or corretto via apt-get, yum, dnf, or apk.
- CI/CD workflows: Identify Java version pins in GitHub Actions using
actions/setup-java. - Build tooling: Search for Java version references in
build.gradle,pom.xml, or.java-versionfiles. - Off-the-shelf tools: Look for services like Keycloak, Jenkins, or Artifactory in Helm charts or configuration files.
Deep Search: A Practical Approach
If regex-based scanning feels overwhelming, use plain English prompts in a code search tool. For example:
Which services run on a JDK 17 or later image, and where is the Java version pinned for each one?
This query spans repositories and links results to source files, providing a clear view of all Java runtime dependencies.
Immediate Mitigation Steps
Organizations should assume exposure until proven otherwise. Services running on affected JDKs and exposed to the internet are considered compromised.
Start with services on AVX-512 VBMI hosts. Then expand to all Java 17+ services.
Stopgap Measures
Use the JVM flag -XX:-UseBASE64Intrinsics to disable the vulnerable path. This works across all architectures and does not require hardware changes.
Do not use -XX:UseAVX=2. It prevents the JVM from starting on ARM-based systems. If present, report it without modifying it.

Apply the flag in shared environment variables like JAVA_TOOL_OPTIONS to ensure all Java processes inherit it.
Do not rely on nginx request buffering. It does not prevent exploitation in client-side TLS handshakes or WebSocket upgrades.
Vendor Bundled JDKs
Some vendor appliances and self-hosted tools ship their own Java runtime. A host-level update won’t affect these.
Check each vendor’s security advisory. Apply the JVM flag in their configuration files until a fixed version is released.
If a vendor has no response, move the host to an older CPU family or an ARM-based system. Alternatively, disconnect it from the internet.
Rebuilding vs. Hotfixing
Once a vendor releases a patched build, update all base images and configuration files. Do not apply fixes at runtime without restarting the JVM.
After patching, rebuild all services. This ensures consistency across environments.
Use tools like Agentic Batch Changes to automate this process. One prompt can generate a PR per repository, applying the fix consistently.
Agentic Batch Changes Prompt
Scope: repositories matching github.com/ /*. Skip forks, mirrors, and archived repos.
Task: add -XX:-UseBASE64Intrinsics to the JVM options of every service that runs on a Java 17+ image.
- Find services using Dockerfiles, Jib configs, or Helm charts that produce Java workloads.
- Determine the runtime Java version: check Dockerfile stages, Helm tags, or build configs. Include only services with Java 17+.
- Add the flag where JVM options are already set (JAVA_TOOL_OPTIONS, JAVA_OPTS, etc.). Append to existing values.
- Include a comment: Disable BASE64 intrinsics: https://nvd.nist.gov/vuln/detail/CVE-2026-114938.
- Never add -XX:UseAVX=2. Search for existing uses and report them.
Output includes a table of changes, a ‘needs review’ list, and a ‘skipped’ list of services below Java 17.
Limitations and Challenges
Java4Shell introduces a new layer of complexity: hardware-dependent exposure. This makes it harder to detect and mitigate than traditional software vulnerabilities.
Many Java installations are not visible in code. They are embedded in vendor appliances, build tools, or base images. These require vendor coordination or manual discovery.
Some services may not have visible configuration files. The JVM version may be set via build arguments or environment variables, making version pinning difficult.
Infrastructure changes—like instance type swaps or autoscaling—can shift a service from safe to vulnerable hardware overnight.
What to Watch Next
Security researchers expect the next vulnerability to involve a specific library, kernel feature, or GPU driver. These would add another layer of hardware or system-level dependency.
Organizations must now treat runtime environments as dynamic and unpredictable. Finding every Java instance is not optional—it’s essential for security.
For more details, see the original source: Java4Shell (CVE-2026-114938): how to find every vulnerable JDK across your repos and servers.
Sources & further reading
Featured image: Java4Shell (CVE-2026-114938): how to find every vulnerable JDK across your repos and servers. Via original publisher. Image source

