OpenAI is partnering with Hacktron to find vulnerabilities in its systems. Read the announcement.

Skip to content Hacktron Sign in [S]
Hacktron Sign in [S] Customers Blog Docs Contact Sign in

Java4Shell: OpenJDK Base64 RCE


Hacktron Team

, , X, LinkedIn

Share

Java4Shell: OpenJDK Base64 RCE

XLinkedIn
7 min

Java4Shell is CVE-2026-114938, a heap overflow in OpenJDK’s Base64 decoder. Malformed Base64 can corrupt memory, leak heap contents and, in some applications, let an unauthenticated attacker run code. Oracle, OpenJDK and Amazon Corretto released fixes on 17 November 2026. Until you can update, a JVM option turns off the vulnerable accelerated code.

Who is affected

A system is exposed when all three of these are true, unless the accelerated decoder has been turned off (see What to do):

  • It runs an unpatched Java 17 build from 17.0.6 onward, an affected Java 21, 25 or 27 build, or any release of Java 18 to 20, 22 to 24 or 26. Those releases no longer get updates, so they have no fix.
  • Its CPU is x86-64 with AVX-512 VBMI, such as Intel Xeon Ice Lake and newer, or AMD Zen 4 and newer.
  • An application on it decodes attacker-controlled Base64 with java.util.Base64. Red Hat’s examples include HTTP Basic credentials, SAML artifacts, CSRF tokens and MIME encoded words, which are often decoded before login.

This covers builds from Oracle, Corretto, Temurin, Microsoft, Zulu, Liberica, SapMachine, Red Hat and GraalVM. ARM64 systems are not affected. Standard Java 8 and Java 11 are not affected either, with one exception: Oracle’s Java 8 Enterprise Performance Pack build 8u511b33-perf.

In the cloud, check the CPU flags inside the running VM. Red Hat names these instance families as the most likely to be affected. They are examples, not a complete list:

  • AWS: C6i, M6i, R6i, C7i, M7i and R7a
  • Google Cloud: C3, C3D, C4, C4D, N4, N4D, M3 and M4
  • Azure: D-series v5 to v7

Whether an attacker can then run code depends on the application. Calif demonstrated pre-auth RCE in default installs of Keycloak, Jira, Confluence, JFrog Artifactory, Jenkins and PingFederate, and post-auth RCE in Kafka, Solr, Elasticsearch, Gerrit and Spinnaker. A Java client connecting to a malicious TLS server can also be compromised.

How to check

  1. Check the CPU features inside the host or VM. All four flags must be present:

    Terminal window
    grep -m1 '^flags' /proc/cpuinfo | tr ' ' '\n' | grep -E '^(avx512f|avx512bw|avx512vbmi|bmi2)$'
  2. Check the Java build serving traffic with jcmd <pid> VM.version. Containers, app servers and appliances often bundle their own JDK. Compare the build with your vendor’s advisory, not the upstream version number alone: distributions such as Red Hat backport fixes, so a patched package can keep an older version string.

  3. Start with internet-facing services and identity providers that decode Base64 from requests before login.

  4. To test, run Calif’s safe test program on a non-production host with the same JDK and instance type. It uses the input for Java 21 and later and checks for exact overwrite offsets, so it can miss a vulnerable Java 17 build. For Java 17, check the build against your vendor’s list of fixed builds or packages instead. A negative result doesn’t prove you’re patched.

What to do

  • Update to a Java build that lists CVE-2026-114938 as fixed (see Fixed versions), restart every JVM and confirm the running version. On Java 18 to 20, 22 to 24 or 26, move to a supported release that has a fix.

  • If you build your own container images, rebuild them on a patched base image or runtime and redeploy.

  • For products and appliances that ship their own JVM, follow the vendor’s supported update procedure rather than replacing the JVM yourself.

  • If you can’t update yet, start every JVM with -XX:-UseBASE64Intrinsics. It turns off only the hardware-accelerated Base64 code, so Base64 decoding keeps working without it and other AVX-512 optimisations stay on. Calif published it, and Red Hat recommends it until you can update. -XX:UseAVX=2 also works but disables all AVX-512 code, and stops the JVM starting on ARM. Test performance first if your service decodes a lot of Base64.

  • Confirm the option is active in every running JVM, including replicas, failover nodes and pods replaced during rolling updates. Checking the environment variable is not enough. Red Hat’s check:

    Terminal window
    jcmd <pid> VM.flags -all | grep -F UseBASE64Intrinsics
    # expected: bool UseBASE64Intrinsics = false

    For UseAVX, the same command with grep -w UseAVX should show 2. Remove the option once you have updated.

Fixed versions

Vendor Status
Oracle Java SE Fixed in 17.0.21.1, 21.0.13.1, 25.0.5.1, 27.0.1.1
Oracle Java 8 Enterprise Performance Pack Fixed in 8u513-perf
Oracle GraalVM Patch guidance: see Oracle’s advisory
Amazon Corretto Fixed in 17.0.21.1.2, 21.0.13.1.2, 25.0.5.1.2, 27.0.1.1.4
Red Hat No fixed packages listed as of 18 November 2026, 20:34 UTC. Track CVE-2026-114938 for errata
Java 18 to 20, 22 to 24, 26 No fix: these releases no longer get updates. Move to a supported release
Others Check your vendor’s advisory

What to monitor

  • Cisco Talos lists Snort rules for subscribers (Snort 2: 1:67502–1:67513; Snort 3: 1:301754, 1:67502–1:67513) that detect malformed Base64 in specific HTTP request fields. Talos notes the bug is implementation-specific, so the rules cover common applications rather than every path.
  • A failed attempt can crash the JVM, according to Calif, and the malformed input makes Java throw a decoding error, although both may happen for other reasons.
  • Investigate unexpected shell processes launched by Java and unusual outbound connections from Java processes. Neither is specific to Java4Shell.
  • Patching does not tell you whether a system was compromised before the update.

Timeline

  1. OpenJDK publishes its advisory; Oracle and Corretto ship fixes

  2. Calif publishes its write-up and a safe test program

As of 18 November, GreyNoise had reported exploitation attempts but had not confirmed successful exploitation against its sensors, according to Tenable. Java4Shell is not in CISA’s Known Exploited Vulnerabilities catalog. Calif is withholding its application exploits, and VulnCheck says a full exploit is available to its paying customers.

Technical summary

OpenJDK’s fast Base64 decoder, used on CPUs with AVX-512 VBMI, writes its output 64 bytes at a time. A mask limits the last write to the bytes that are left.

Some malformed inputs that end in padding make that count go negative. The mask then lets all 64 bytes through, and the write runs past the end of the output array. Correctly padded input is not affected. Calif’s analysis lists the exact inputs.

With 64 A characters and =, the output array is 50 bytes and 62 bytes land past it. Java rejects the input afterwards, but by then the memory is overwritten:

01632486480969a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a112 0816243240485664728088969a9a9a9a9a9a9a9a1049a9a9a9a9a9a9a9a112120
Decoded normallyFaulty store, inside the arrayFaulty store, past the endUntouchedEnd of the 50-byte array

The overwritten bytes are fixed, not chosen by the attacker. Calif uses them to enlarge a neighbouring array, the writer. Bytes written into the writer then spill into a second array, the reader, and enlarge it too.

The application copies the reader into a response, which returns heap memory beyond it. Calif calls this JavaBleed. From there it repairs the damage and escalates to code execution:

Warm upValid Base64 until C2compiles the fastdecoderRehearse (optional)Calibrate timing, nocorruptionGroom the heapLine up decoderoutput, writer andreaderTriggerMalformed tail spillsinto the writer'slengthWiden the readerWriter sets thereader's lengthJavaBleedReader returns heapmemory in theresponseRepairRestore damagedobjects so the JVMsurvivesEscalateArbitrary writes reachthe code cache and JVMhooksCode executionApplication-specificfinal step Warm upValid Base64 until C2 compiles the fastdecoderRehearse (optional)Calibrate timing, no corruptionGroom the heapLine up decoder output, writer and readerTriggerMalformed tail spills into the writer'slengthWiden the readerWriter sets the reader's lengthJavaBleedReader returns heap memory in theresponseRepairRestore damaged objects so the JVMsurvivesEscalateArbitrary writes reach the code cache andJVM hooksCode executionApplication-specific final step

There is no universal exploit. Each application needs its own chain, and remote heap grooming is sensitive to network latency. Calif’s write-up has the full details.

References

Credits, from Oracle’s advisory: Quang Luong of Calif.io and Albert Yang.

[↓] [↑] [enter] to visit
Menu
[M]
Next in menu
[J]
Previous in menu
[K]
Find
[F]
Ask
[A]
Sign in
[S]
Copy page
[C]
Listen
[L]
Justification
[R]
Language
[G]
Dark mode
[D]
High contrast
[H]
Shortcuts
[I]
Close
[Esc]