Java4Shell: a memory bug in OpenJDK’s Base64 decoder
⏱️ Reading time: 7 min
With nothing more than 64 “A” characters followed by an equals sign, a remote attacker with no username or password can corrupt memory inside the most widely used Java virtual machine on the planet. That is what security firm Calif documented when it published Java4Shell, tracked as CVE-2026-114938, a memory-corruption flaw in OpenJDK’s Base64 decoder (source). Under CVSS 4.0 the vulnerability scores 9.2 out of 10, a critical rating (source).
📑 En este artículo
- Java4Shell: a memory bug in OpenJDK’s Base64 decoder
- Why it matters: the blast radius reaches half the Java ecosystem
- How the memory gets corrupted: an optimization that backfired
- No testing of our own: what to check before trusting a patch
- Not all Java code decodes Base64 the same way
- What the report leaves out: the limits of the finding
- What this means for you if you run Java in production
- The number that didn’t make the headline: what it costs today to find an RCE like this
- References
OpenJDK is the most popular Java runtime and runs at 90% of Fortune 500 companies, according to Calif (source). Java is the third most used programming language in the world and underpins banks, airlines, telecom networks and even national security systems (source). Base64 is the encoding that turns binary data into text: it shows up in authentication protocols, file uploads and network messages, so nearly every Java application uses it somewhere (source).
Why it matters: the blast radius reaches half the Java ecosystem
The scope is not theoretical. Calif confirmed pre-authentication remote code execution in Keycloak, Atlassian Jira and Confluence, JFrog Artifactory, Jenkins and PingFederate, all in default configuration (source). Past authentication, the list grows to include Apache Kafka Broker, Apache Solr, Elasticsearch, Gerrit and Spinnaker (source). The team also reproduced the flaw in sample apps built on Apache Struts and Spring Boot, suggesting that any endpoint that receives, authenticates or uploads Base64-encoded files could end up exposed (source).
Researcher samczsun also contributed a client-side exploit: a Java program that merely opens a TLS connection to a malicious server can be compromised, even if it exposes no service of its own (source).
⚠️ Heads up: Keycloak, Jira, Confluence, Artifactory, Jenkins and PingFederate are vulnerable without the attacker needing an existing account, according to Calif.
How the memory gets corrupted: an optimization that backfired
The root cause is an optimization. To decode Base64 faster, OpenJDK uses AVX-512 VBMI instructions, specific to x86-64 processors, inside a hand-written assembly routine (source). The bug lives in how that routine handles the final characters of the input. With a 65-character string (64 “A” characters plus one “=”), OpenJDK allocates a 50-byte output array; after decoding the first 64 characters, the routine mishandles the trailing “=” and computes a negative output length, which gets turned into a 64-byte write, 62 bytes past the end of the array (source). Java eventually rejects the input, but by then neighboring objects on the heap may already be corrupted (source). On older OpenJDK 17 builds the trigger differs: it takes 128 “A” characters before the “=” (source).
flowchart TD
A["Base64 input"] --> B{"CPU with AVX-512 VBMI?"}
B -- "Yes" --> C["Vectorized decoder in assembly"]
B -- "No" --> D["Scalar decoder in Java"]
C --> E["Output length calculation"]
E --> F{"Trailing padding mishandled?"}
F -- "Yes" --> G["Negative length: write 62 bytes past the buffer"]
F -- "No" --> H["Correct decoding"]
No testing of our own: what to check before trusting a patch
For this article we did not run Java4Shell in our own lab or reproduce the exploit: everything described here comes from Calif’s technical report and the official CVE record (source, NVD). If you manage any of the products listed above, the first step is to confirm the exact OpenJDK version and build running in production (Temurin, Corretto, Zulu or another), and to check the project’s own security changelog, not just your vendor’s press release. Calif also published a dedicated “Recommendations” section on its site for exactly this kind of check (source).
Not all Java code decodes Base64 the same way
The bug lives specifically in HotSpot’s vectorized intrinsic, not in Base64 as a concept. That changes depending on which piece of software decodes the data:
| Implementation | Where decoding runs | Exposed to the described mechanism |
|---|---|---|
| java.util.Base64 in OpenJDK (HotSpot, x86-64 with AVX-512 VBMI) | JIT-generated assembly | Yes, via the mechanism Calif documents |
| Apache Commons Codec | Pure Java, no native intrinsics | Not through this path: it does not use the vectorized routine the report describes |
| Eclipse OpenJ9 / IBM Semeru | Its own JIT, separate from HotSpot | Not documented by Calif; the failing intrinsic is HotSpot-specific |
The middle row matters in practice: any application that decodes Base64 with a pure-Java library instead of relying on the JDK’s standard class falls outside the corruption mechanism Calif describes. That does not protect it from other bugs specific to those libraries, but it does rule out this particular one.
What the report leaves out: the limits of the finding
Calif is explicit on one point: there is no universal exploit. Depending on how each application uses Base64 and how it is put together, exploitation requires different steps; the team sped up the work by first building a pipeline and then letting AI agents construct most of the attack chains afterward, almost autonomously (source). That means the list of confirmed products (Keycloak, Jira, Confluence, Artifactory, Jenkins, PingFederate, Kafka, Solr, Elasticsearch, Gerrit, Spinnaker) is not exhaustive, but it also does not mean any Java service falls just by using Base64 somewhere: the runtime has to take the vectorized path, and the data has to reach the decoder unfiltered. The published report also does not detail the full CVSS vector breakdown beyond the 9.2 score, so a formal risk assessment should check the CVE record directly (NVD).
What this means for you if you run Java in production
If you work on the platform or SRE team of a company running Keycloak for single sign-on, or Jira and Confluence as an internal suite, this finding is directly relevant: those are exactly the products with pre-authentication RCE. The immediate priority has two steps: confirm the OpenJDK version (or the build you use) in each deployment, and check whether your vendor has already shipped an update for that specific product, not just for the JDK itself.
If instead you run Kafka, Solr or Elasticsearch on an internal network with no direct internet exposure, the risk is lower because Calif describes those cases as post-authentication. It is still worth patching, just not with the same urgency as a public-facing Keycloak endpoint. And if your stack decodes Base64 with Apache Commons Codec or an equivalent library instead of the JDK’s standard class, this particular mechanism does not affect you, though it is worth confirming by checking which part of your code actually calls java.util.Base64.
The number that didn’t make the headline: what it costs today to find an RCE like this
Calif describes the finding as “centaur” work: neither AI alone nor a human alone, but both combined. Researcher Quang Luong took one hour to find the bug and two more hours to build the first working exploit; total AI token cost came to under $200 (source). That figure changes the math for any security team: finding an RCE of this caliber in a runtime as heavily audited as OpenJDK used to take weeks of specialized work.
In the Hacker News thread about the finding, discussion did not stop at the patch. User apolo64 argued that security through obscurity stops working precisely when AI tools lower the cost of auditing low-level code that nobody used to scrutinize closely (comment on HN). Another comment, from jeffbee, points to a possible design fix: compiling that routine ahead-of-time (AOT) directly from source instead of maintaining it as hand-written assembly, which would shrink the attack surface for this kind of bug in future runtimes (comment on HN).
References
- Calif: Java4Shell, Write once, RCE everywhere: original technical report with the CVE, the CVSS score and the list of affected applications.
- NVD: CVE-2026-114938: official vulnerability record in the US National Vulnerability Database.
- Hacker News thread on Java4Shell: community discussion on the scope and implications of the finding.
- Comment by apolo64 on Hacker News: argument on security through obscurity versus AI tooling.
Featured image: Foto de Markus Spiske en Unsplash
How each article is made (sources, testing and editorial criteria): How we work.
Did it work for you? Got a different error? Say so below: questions get answered and help the next reader.
Leave a comment
0 Comments