# Aikido's Deep Review finds Java4Shell in the PR that introduced it

Integer underflow in OpenJDK's AVX-512 Base64 decoder on invalid padding yields an all-ones BZHI mask, writing 64 bytes past the destination buffer and enabling RCE.

- Payout: Research
- Severity: critical
- Program: OpenJDK
- Write-up by: Aikido Security
- Disclosed: 2026-11-18
- CVE: CVE-2026-114938
- Write-up quality: 7/10
- Original: https://www.aikido.dev/blog/deep-review-finds-java4shell-in-pr
- Library page: https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-deep-review-finds-java4shell-in-pr
- Tags: area:oss domain:oss impact:integrity impact:rce kind:research platform:threat-intel sev:critical tech:java technique:regression technique:source-review vuln:memory-corruption vuln:rce

**Target:** OpenJDK hardware-accelerated Base64 decoder (AVX-512 VBMI path)
**Root cause:** Non-MIME input ending in invalid padding causes a negative subtraction when stripping padding; BZHI turns the negative value into an all-64-bits-set mask, so the decoder writes a full 64-byte block past the allocated destination buffer.
**Steps:**
1. Target x86-64 CPU with AVX-512 VBMI support running vulnerable OpenJDK (17.0.21.1/21.0.13.1/25.0.5.1/27.0.1.1).
2. Feed the Base64 decoder 128 valid Base64 characters followed by a single `=` (padding on an already-complete group).
3. Decoder strips padding; subtraction goes negative; BZHI produces a mask with all 64 bits set.
4. Decoder writes a 64-byte block at the end of the destination buffer instead of zero bytes, corrupting Java heap memory.
**How found:** Traced the vulnerable Base64 implementation back to OpenJDK PR #4368 (June 2021 AVX-512 optimization), forked OpenJDK at that commit, reconstructed the PR, and ran Aikido Deep Review on it; the tool flagged the padding edge case as an integer underflow in the AVX-512 path.
**Exploitation:** Heap memory corruption past the destination buffer; text states it could allow remote code execution on affected systems but does not detail a full exploit chain.
**Insight:** Hardware-accelerated SIMD decoders that strip padding before computing output lengths are prime integer-underflow targets: test inputs where padding appears on already-complete 4-char groups, since the length math goes negative and mask-generating instructions (BZHI) saturate to all-ones.

## Write-ups of the same bug (oldest first)
- 2026-11-17: [Java4Shell: Write once, RCE everywhere](https://bugbountylibrary.com/r/blog%3Acalif-io-java4shell) — @calif_io
- 2026-11-18: [Aikido's Deep Review finds Java4Shell in the PR that introduced it](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-deep-review-finds-java4shell-in-pr) — Aikido Security (this one)
- 2026-11-18: [CVE-2026-114938 | Oracle Java SE and OpenJDK Base64 Decoder Heap Buffer Overflow Vulnerability (Java4Shell)](https://bugbountylibrary.com/r/blog%3Ahorizon3-ai-attack-research-vulnerabilities-cve-2026-114938) — Horizon3

