**CVE-2026-114938 — "Java4Shell"** — was disclosed on **2026-11-17** (Oracle's November Critical
Security Patch Update and the matching OpenJDK advisory, following a write-up by the finder
"Calif"). It is a heap buffer overflow in the Java runtime itself, and the name is a nod to
Log4Shell: like that bug, it sits in ubiquitous, trusted code and is reachable through data that
The surprising part is "memory corruption **in Java**." Java is memory-safe, so the flaw is not
in Java code — it is in the **native machine code the JDK ships and runs on your behalf**. For
speed, HotSpot replaces `java.util.Base64.Decoder.decode()` with a hand-written AVX-512 assembly
routine when the CPU supports it. That routine is not bounds-checked the way the Java method is,
and it mishandles a short, padded Base64 tail — writing past the end of the output array. Because
Base64 is decoded all over the stack before authentication (HTTP Basic headers, JWTs, SAML
assertions), the finder frames it as a pre-auth issue.
Two things are worth stating up front, and this lab keeps them distinct throughout:
- **Confirmed:** the out-of-bounds **write** is real and has been reproduced independently (and
here). It fires only on a narrow set of preconditions — see [Scope reminder](#scope-reminder).
- **A claim, not confirmed:** the finder reports unauthenticated **remote code execution**. That
has *not* been independently demonstrated, and this lab does **not** achieve it. How common a
genuinely exploitable app is in the real world is an open question.
The rest of this README is the hands-on lab: it reproduces the overflow, shows why it only fires
on specific hardware, and proves the shipped two-line fix rejects it — all on hosts you control.
On an affected JVM, a short malformed Base64 tail drives the intrinsic's output-length arithmetic
**negative**; the negative value is turned into an all-ones store mask, and a full 64-byte vector
store lands **62 bytes past the output array**.
The cause is a single missing floor: the 1–63-byte tail handler computes `output_len =
(len/4)*3` and decrements it once per trailing `=`, with no guard against going below zero. That
negative length reaches an x86 `BZHI` instruction, which reads only the **low 8 bits** of its
index — so `-1` becomes `0xFF = 255`, `255 ≥ 64`, and the mask is left all-ones instead of
This repo proves the overflow, shows why it only fires on specific hardware, and proves the
shipped two-line guard rejects it — all on hosts you control.
Keep this picture in mind; every demo below is one of these four lines made concrete.
| 1 | Tail handler computes `output_len = (tail_len/4)*3` for a 1–3-byte fragment | `0` |
| 2 | It subtracts 1 for the trailing `=` — **with no floor** | `-1` ← the bug |
| 3 | `-1` feeds `BZHI`, which reads only the **low 8 bits** of the index: `0xFF = 255 ≥ 64` → mask left untouched | `0xFFFF…FF` (all-ones) |
| 4 | The all-ones mask lets a full **64-byte** vector store write every lane — **starting at offset 48** — into a 50-byte array, so it runs to offset 111 | **62 bytes out of bounds** (offsets 50–111) |
The entire fix is to refuse step 1 for tails shorter than one 4-char block — a two-line guard
(`cmpl length,4` / `jcc less,L_bruteForce`) that sends them to the safe scalar decoder before any
Pick the path that fits you — each builds on the one before:
1. **Just show me the bug.** `make show` — an animated memory map of the overflow (a few seconds;
add `--fast` to skip the delays). Then `make crash` for the AddressSanitizer proof.
2. **Teach me the mechanism.** Read [WRITEUP.md](docs/WRITEUP.md) — start with §2 ("why memory
corruption in Java") for the native/intrinsic-boundary framing, then §3 for the defect — and
[docs/DEMO-ASAN-MODEL.md](docs/DEMO-ASAN-MODEL.md) (what the proof demo establishes and why).
3. **Why is my fleet (not) exposed?** [DEFAULT-VS-VULNERABLE.md](docs/DEFAULT-VS-VULNERABLE.md) — the
four preconditions and the hardware gate, with `make qemu-control` as empirical proof.
4. **How would I catch it in production?** [DETECTION.md](docs/DETECTION.md) — hunt the decoder
*crashing*, not the payload, with `make detect-demo` to watch the hunts fire.
Every demo's exact captured output is in [docs/DEMO-OUTPUTS.md](docs/DEMO-OUTPUTS.md) if you want
to read the results without running anything.
> **On the canonical `64×'A'+'='` case:** that literal 65-char string is *not* a working wire
> payload — `java.util.Base64` rejects it as malformed (`wrong 4-byte ending unit`) before the
> intrinsic runs. The lab uses its geometry to illustrate the tail-handler *arithmetic*; a real
> trigger is a well-formed padded string whose final 1–3-byte fragment hits the tail handler
> (see `repro/Trigger2.java` and [DEFAULT-VS-VULNERABLE.md](docs/DEFAULT-VS-VULNERABLE.md)).
The real crash requires the **AVX-512 VBMI Base64 decode intrinsic**
(`generate_base64_decodeBlock()` in `stubGenerator_x86_64.cpp`) to *execute*. HotSpot enables it
only when `UseAVX > 2` and the CPU reports AVX-512 VL/BW/VBMI — real Ice Lake / Tiger Lake /
Zen 4-class x86-64 silicon. **ARM is not affected, and QEMU on ARM exposes no AVX-512**, so a
faithful *intrinsic-level* crash cannot run on an Apple Silicon host.
This lab therefore proves the defect two ways:
1. a **logic-level reproduction** of the exact vulnerable arithmetic in C, caught by
AddressSanitizer — runs natively on ARM; and
2. a **negative control**: an affected x86-64 JDK under Docker QEMU that does *not* crash,
demonstrating empirically that the hardware precondition is required.
This is **defensive security education**. The C model is a standalone arithmetic reproduction —
it corrupts only its own heap allocation and is caught by ASan; it contains no exploit, no
payload, and touches no external system. The Docker control runs a stock, affected JDK against
input you generate locally. Nothing here scans or attacks anything you do not own. See
- A C compiler with AddressSanitizer (`cc`/`clang`; Apple clang is fine) and `make`.
- Optional, for the negative control only: Docker with x86-64 emulation (`--platform
linux/amd64`). Pulls `eclipse-temurin:21-jdk` (~450 MB).
make show # ** watch it ** — animated color memory-map of the 62-byte overflow
make crash # the lab: fixed control (SURVIVES) then vuln (ASan heap-buffer-overflow)
make fixed # shipped guard applied -> no overflow, exit 0
make vuln # the defect -> AddressSanitizer aborts on the OOB write
make detect-demo # run the crash/exception hunts against synthetic fixtures (see docs/DETECTION.md)
make proof # regenerate repro/CRASH_PROOF.txt (the committed crash transcript)
make smoke # non-TTY CI check: asserts fixed=exit0, vuln=OOB, hunts fire
make qemu-control # affected x86-64 JDK under QEMU -> scalar path, no crash (needs Docker)
make clean # remove build artifacts
`make show` is the one to run first if you want to *see* the bug: it draws the output array
filling green, then the masked store spilling red bytes past offset 50, lane by lane, while
narrating the `output_len = -1 → all-ones mask` arithmetic. Add `--fixed` (or `make show-fixed`)
to watch the guarded path refuse to overflow.
> **If `make show` is for a non-color terminal** (a piped log, a bare SSH session, `NO_COLOR`):
> it detects that and prints a pointer instead of garbled escapes. Read the captured final frame
> at [`repro/VISUAL_VULN_FRAME.txt`](repro/VISUAL_VULN_FRAME.txt) (or
> [docs/DEMO-OUTPUTS.md](docs/DEMO-OUTPUTS.md)), or pass `--force` to emit the raw stream anyway.
> **Expect `make crash` and `make vuln` to exit non-zero — that is success, not breakage.** The
> `vuln` run deliberately triggers an AddressSanitizer *abort* (SIGABRT), so `make` reports a
> failed target. The abort, with `heap-buffer-overflow … 0 bytes after 50-byte region`, **is** the
> proof. `make fixed` is the one that exits 0. (For garbled `make show` output on a non-color
> terminal, see the note just above — the demo detects that case and points you at the captured
> frame; `--force` emits the raw stream.)
The committed crash transcript is at [`repro/CRASH_PROOF.txt`](repro/CRASH_PROOF.txt) if you want
the evidence without a toolchain; every target's captured output is in
[docs/DEMO-OUTPUTS.md](docs/DEMO-OUTPUTS.md).
| `make` target | What it demonstrates | Result |
| `show` | animated color memory-map of the masked store spilling 62 bytes OOB | visual |
| `show-fixed` | the same demo with the guard applied | no overflow |
| `vuln` | the negative-length → all-ones-mask → 64-byte store (`base64_tail_model.c`) | **heap-buffer-overflow** (ASan) |
| `fixed` | the shipped guard (`tail no crash)
DETECT_DEMO.txt detection-hunt transcript (HIGH + BURST)
VISUAL_VULN_FRAME.txt final frame of `make show` (62 bytes OOB)
VISUAL_FIXED_FRAME.txt final frame of `make show-fixed` (no store)
README.md repro-specific notes
Affected only: HotSpot Java 17.0.6+ / 21 / 25 / 27 on x86-64 with AVX-512 VBMI and the intrinsic
active. Java 8, 11, 17.0.0–17.0.5 and ARM are not affected. The overflow is confirmed and
independently reproduced; the unauthenticated-RCE claim is the finder's and was **not**
independently confirmed at the alert's cut-off.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
