/en/articles/java4shell-a-malformed-base64-string-can-take-over-java-servers-patch-before-you-trust-your-waf
Java4Shell: a malformed Base64 string can take over Java servers; patch before you trust your WAF

On November 17, 2026, the research firm Calif disclosed Java4Shell (CVE-2026-114938): a memory corruption bug in the Base64 decoder of OpenJDK, the Java runtime that almost everyone uses. An unauthenticated attacker can send a malformed Base64 string and write past the end of the array where Java stores the result. Calif took it all the way to unauthenticated remote code execution on Keycloak, Jira, Confluence, Artifactory, Jenkins, and PingFederate in their out-of-the-box configuration. OpenJDK published its advisory and Oracle its patches that same day. A day later, Cloudflare shipped WAF rules to block the attack at the edge, but made it clear: the WAF helps, the patch is what fixes it. If you run Java servers, this week you've got an inventory to do.
What happened and who's saying so
According to Calif, the bug lives in an optimization: to decode Base64 faster, HotSpot (OpenJDK's virtual machine) swaps the Java code for hand-written assembly that uses AVX-512 VBMI instructions and processes 64 bytes in one go. The problem is in how that code handles the last characters of the input.
When the end of the input has a padding = in a spot where valid Base64 would never put one, the routine computes a negative output length. That invalid length gets turned into a mask that allows writing all 64 bytes of the block. With 64 A characters followed by an =, Java allocates a 50-byte array and the routine writes 62 bytes past its end. In older versions of OpenJDK 17, the trigger needs 128 A characters before the =.
The worst part, according to Cloudflare's explanation: Java does reject the input with an exception, but by then the neighboring memory has already been trampled. Your application's validation is useless, because the corruption happens inside the decoder, before your code gets a chance to say "this isn't valid."

It's not a push-button exploit, but don't fall asleep either
The bytes that get written are almost always the same; the attacker only controls where they land. Calif says it arranged the Java heap so that the overflow would enlarge neighboring arrays. With that it first managed to read heap memory, Heartbleed-style (keys, tokens, personal data), and then write whatever it wanted until it achieved code execution. Each application needs its own attack chain, and the remote attack is sensitive to network latency.
That sounds comforting, but there's one fact that changes everything: Calif says its researcher found the flaw in an hour and had the first working exploit two hours later, with the help of AI agents and less than 200 dollars in tokens. Cloudflare draws the obvious conclusion and expects other attackers to build their chains "quickly." Calif is holding back the per-product exploits for now, but it has already published a proof of concept that shows the overflow.
The list of RCEs Calif demonstrated:
- Unauthenticated: Keycloak, Atlassian Jira, Atlassian Confluence, JFrog Artifactory, Jenkins, and PingFederate.
- Authenticated: Apache Kafka (broker), Apache Solr, Elasticsearch, Gerrit, and Spinnaker.
Calif also demonstrated it on sample applications with Apache Struts and Spring Boot, and shared a client-side exploit: a Java program that opens a TLS connection to a malicious server can be compromised even if it doesn't expose any service.
The four conditions for being exposed
Here's the useful part: not all Java is vulnerable. According to the Red Hat bulletin and Calif, all four have to be met at once:
| Condition | Detail |
|---|---|
| Runtime | Unpatched OpenJDK 17.0.6 or newer, including the 21, 25, and 27 lines, and every distribution built from it: Temurin, Corretto, Zulu, Liberica, SapMachine, Microsoft, Red Hat, Oracle Java SE, and GraalVM for JDK |
| Processor | x86-64 with AVX-512 VBMI: Intel Xeon Ice Lake, Sapphire Rapids, Emerald Rapids, and Granite Rapids; AMD EPYC and Ryzen Zen 4 or later. ARM64 is not affected |
| JVM flags | The JVM was not started with -XX:-UseBASE64Intrinsics or -XX:UseAVX=2 |
| Input | The application passes attacker-controlled Base64 to java.util.Base64 |
The fourth condition is easier to meet than it looks. Red Hat mentions HTTP Basic credentials, SAML artifacts, CSRF tokens, and MIME-encoded words, which many applications decode before they've finished authenticating anyone. Cloudflare's rules add JWT and WebAuthn values.
According to the OpenJDK advisory, the flaw doesn't touch the 8 and 11 lines, and Red Hat confirms those versions don't carry the vulnerable path. The exception: Calif cites Oracle as listing a special Java SE 8 build (8u511b33-perf) as affected.
Watch out for the severity, because it depends on who's measuring. Calif rates it 9.2 out of 10 (critical) under CVSS 4.0, and Red Hat also classifies it as critical. OpenJDK's matrix gives it 8.1 under CVSS 3.1.
For the cloud, Red Hat points to the AWS C6i, M6i, R6i, C7i, M7i, and R7a instances; Google Cloud C3, C3D, C4, C4D, N4, N4D, M3, and M4; and Azure D v5 through v7 series as the families most likely to be affected. My take: if your provider doesn't publish the CPU model, don't guess. Run grep -o avx512vbmi /proc/cpuinfo | head -1 on the host or on the node where the container runs. If it prints nothing, that CPU doesn't have the instruction.

What to do, in order
1. Update the runtime and restart. It's the only complete fix. Oracle's Critical Security Patch Update for November 2026 has the patches. The Keycloak team lists 17.0.21.1, 21.0.13.1, and 25.0.5.1 as fixed versions, and has already updated its 26.8 images (including latest) to Red Hat OpenJDK 21.0.13.1. Temurin is releasing per platform: its status board shows which builds are already out.
Here's the trap that's going to hurt the most. Many applications ship with their own Java, and container images freeze a JDK. Updating the system java package doesn't touch those copies or replace a JVM that's already running. Cloudflare sums it up like this: every updated service needs a restart. Your own images have to be rebuilt on top of the new base.
2. If you can't patch today, shut off the vulnerable path. Start the JVM with -XX:-UseBASE64Intrinsics, which is the option Red Hat prefers because it only disables accelerated Base64 and leaves the other AVX-512 optimizations intact. The alternative, -XX:UseAVX=2, turns off AVX-512 entirely. Only use it on x86-64: on ARM the JVM doesn't recognize the flag and won't start. Both require a restart and can cost performance if you decode a lot of Base64.
Keycloak insists on a detail that applies to any service: seeing the variable in the environment proves nothing. Ask the live JVM with jcmd <pid> VM.flags -all | grep -F UseBASE64Intrinsics and confirm it says false.
3. Treat the WAF as an extra layer, not the solution. Cloudflare published six new rules in its Managed Ruleset, for Pro, Business, and Enterprise plans. They detect malformed Base64 in headers, query strings, bodies, path segments, JWT components, and WebAuthn values. They ship in Log mode rather than Block, because some legitimate token formats look like the attack. The idea is to review the events and switch them to Block once you confirm they don't break real traffic. For the free plan, Cloudflare says it's working on a rule. Microsoft also published guidance and mitigations for Azure WAF.
Cloudflare itself lists what its WAF can't see:
- Base64 wrapped in another encoding or compressed.
- Non-HTTP protocols, like Kafka's.
- Outbound connections, like the TLS exploit.
- Internal traffic between services that doesn't go through its network.
Cloudflare says it hasn't seen signs of exploitation in its own infrastructure. An hour after the patches landed, it began rolling out the flag that disables accelerated Base64 across all its Java workloads, regardless of hardware.
What this means
My take: Java4Shell is Calif's second hit in a few weeks, after PHP2Shell, and it repeats the same lesson. "Memory-safe" code rests on C, C++, and assembly, and an optimization that few applications need ended up shipping to every server. Calif calls it vibe-uncoding: checking which parts of a system are actually used and deleting the rest.
For whoever runs servers, the task is less philosophical. Take inventory of every JVM: the system one, the ones that come bundled inside products, and the ones in every container image. Check each host's CPU, patch, restart, and verify on the live JVM. Start with whatever is exposed to the internet and everything that authenticates (SSO, CI/CD, artifact repositories), because that's where Base64 shows up before the login. With exploits built in hours, the time the WAF buys you is for patching, not for forgetting about the issue.
Sources
- OpenJDK Vulnerability Advisory, November 17, 2026
- Calif: Java4Shell, Write once, RCE everywhere
- Oracle Critical Security Patch Update Advisory, November 2026
- Cloudflare: How Cloudflare WAF helps protect against Java4Shell
- Red Hat Security Bulletin RHSB-2026-018
- Keycloak: Java4Shell, what Keycloak admins need to do
- Adoptium: Temurin build status, November 2026
- Microsoft: upgrade guidance and Azure WAF mitigations for Java4Shell