TL;DR: Catching Java4Shell and how to fix it
Java4Shell (CVE-2026-114938) is a critical memory corruption vulnerability in OpenJDK's Base64 decoder that can lead to remote code execution. The vulnerable code only runs on x86-64 CPUs that support AVX-512 VBMI, so ARM systems aren’t affected.
If you're affected, upgrade to a patched Java version. Oracle's fixed releases are 17.0.21.1, 21.0.13.1, 25.0.5.1, and 27.0.1.1.
If you can’t upgrade yet, Aikido has patched Java images for Temurin 17 and 21, in both JDK and JRE variants. To check your exposure, click “Am I affected?” on the Aikido dashboard, or onboard to Attack Surface to find potentially affected hosts from the outside.
For affected versions, exposure checks, and detailed remediation instructions, see our Java4Shell security advisory.
Five years before it became a critical CVE, Java4Shell was just another code change in a PR
On November 17, 2026, Java4Shell (CVE-2026-114938) was publicly disclosed. It’s a memory corruption vulnerability in OpenJDK's hardware-accelerated Base64 decoder that could allow attackers to achieve remote code execution on affected systems.
But the vulnerable code isn’t new. This bug originated in a performance optimization introduced into OpenJDK back in June 2021.
That got us thinking. What if we could go back to the original code change and review it with today's security tooling? Could we have caught Java4Shell before it shipped?
We decided to find out.
Going back to 2021
We traced the vulnerable Base64 implementation back to OpenJDK PR #4368, part of the original AVX-512 optimization work. Then, we forked OpenJDK exactly at that point and reconstructed the same pull request with the same changes and description.
The recreated PR contains changes across 12 files. Those were merged into OpenJDK on June 25, 2021, through commit c37988d.
Then we ran Aikido Deep Review against the reconstructed pull request, which you can explore on GitHub along with Deep Review’s findings. We replaced the original authors’ and reviewers’ names with placeholders, and the commit count includes unrelated upstream commits from the fork.
Deep Review caught Java4Shell
Deep Review added three comments to the pull request, each with a high-severity finding. One of them identified the exact bug behind Java4Shell:

The finding describes how a non-MIME input ending in invalid padding could cause an integer underflow in the AVX-512 decoding path. The underflow produces a bad output mask, which lets the decoder write past the allocated destination buffer and corrupt Java heap memory.
Valid Base64 input comes in groups of 4 characters, each decoding to 3 bytes, with = padding filling out the last group. Deep Review’s example uses 128 valid characters followed by a single =. Those 128 characters already form complete groups, so the extra = shouldn’t be there. When the decoder strips the padding, a subtraction goes negative, and the BZHI instruction turns that value into a mask with all 64 bits set. The decoder then writes a full 64-byte block at the end of the destination, past its allocated buffer, when it should write zero bytes.
Mitigation
Not only was this edge case detected and reported, Deep Review also suggested the correct mitigation!
It recommended checking whether the remaining input was shorter than four bytes and falling back to the safer decoding implementation.
Compare that with the actual upstream fix:

It’s the exact same fix (only replacing Assembler::below with Assembler::less, which behave identically for this bug). It shows this whole situation could nowadays be resolved without ever going into the main branch.
And that wasn't the only finding
Deep Review also reported two other significant defects in the original implementation:
- An oversized vectorized write: A 64-byte store could write beyond a destination region intended to hold only 48 decoded bytes.
- Incomplete invalid-character validation: One of the four AVX-512 input lanes was omitted from the translated-value error check, allowing certain invalid characters to escape validation.
Both of these have since also been corrected in upstream OpenJDK (PR #4 and PR #4601). The first is character-for-character identical to Deep Review's suggested fix, and the second practically does the same too.
Deep Review is isolated from the internet, so it came up with all of these on its own (instead of cheating and looking up the answers)!
Low-level performance work is difficult to review by hand, which is how three memory corruption issues ended up in a single PR.
What this means for proactive security
Java4Shell spent five years in OpenJDK before it was reported. Aikido has tools for both ends of that timeline, from the pull request that introduces a bug to the runtime you need to patch after disclosure.
Deep Review reviews each pull request against the rest of your codebase and posts its findings as comments on the PR, so the developer who wrote the change can fix it before it merges. If you reply to a comment asking for a fix, Aikido opens a new pull request with that fix built on top of yours. With the Aikido MCP server, your coding agent can also run Deep Review on your local branch before you open a pull request.
For code that merged years ago, like the 2021 change behind Java4Shell, AI Code Analysis reasons across your whole codebase to find vulnerabilities in what you’ve already shipped. Deep Review then checks each new change as it comes in.
For Java4Shell itself, click “Am I affected?” on the Aikido dashboard to find vulnerable Java runtimes in your environment. If you can’t upgrade yet, Aikido’s patched Java images cover Temurin 17 and 21, in both JDK and JRE variants. Our Java4Shell security advisory lists the affected and fixed versions for each Java line.
Given the original vulnerability-introducing code changes, Deep Review identified the defect, explained its memory corruption mechanism, and recommended essentially the same mitigation later adopted upstream. If only that had happened five years ago.



