Illustration einer tropischen Insel mit Palmen und einem hohen Berg

Java Blog für Programmierer

Java4Shell (CVE-2026-114938): A Critical Java Vulnerability with a Surprisingly Small Fix

· Christian Ullenboom

A critical vulnerability in OpenJDK's optimized Base64 decoder can cause memory corruption and potentially lead to remote code execution.

CVE-2026-114938 (CVSS 9.2) affects several Java versions, including Java 17, 21, and 25. The issue occurs in the JVM's native AVX-512 Base64 decoding implementation on x86-64 systems.

Malformed Base64 input can cause a negative output length calculation. This results in an incorrect write mask, allowing the decoder to write beyond the bounds of a Java array. Even if Java throws an exception afterward, the memory corruption has already happened.

Exploitation requires a vulnerable Java runtime, a CPU supporting AVX-512 VBMI, and attacker-controlled input reaching the affected decoder. A denial of service is more straightforward than reliable remote code execution.

The surprising part: The fix is essentially two lines of code.

The Amazon Corretto patch adds a simple length check, redirecting Base64 fragments shorter than four bytes to the Java implementation instead of processing them through the optimized native path:

__ cmpl(length, 4);
__ jcc(Assembler::less, L_bruteForce);

A small boundary check prevents a potentially critical memory corruption issue.

How can you check whether your Java runtime is affected?

Semgrep provides a useful set of open source detection scripts:

https://github.com/semgrep/detection-scripts/tree/main/CVE-2026-114938

These scripts go beyond checking java -version. They inspect the JVM version, CPU architecture, AVX-512 support, and relevant JVM flags to determine whether the vulnerable code path can actually execute.

For example, on Linux:

sudo ./linux/detect-jdk-8392044.sh

The detector reports impacted, not impacted, or unknown. It also supports Windows, containers, Kubernetes, and cloud environments.

What should you do?

Check your running JVMs, update to a patched JDK when available, and consider -XX:-UseBASE64Intrinsics as a temporary mitigation.

The takeaway: A four-line patch can prevent a critical vulnerability, but identifying affected Java runtimes across an infrastructure is the bigger operational challenge.

← Alle Beiträge