Technology1 min read

Java4Shell: when base64 decoding leads to remote code execution?

By · Published by Everything Blog

In short

The vulnerability activates when the decoding routine processes specific invalid inputs, such as 128 "A" characters ending with a single padding character. Because Java allocates a 98-byte output array prior to input validation, an integer calculation error yields a negative length value during the final padding phase. This miscalculation causes an AVX-512 masked store instruction to execute an unmasked 64-byte write, spilling 62 bytes past the memory boundary before an exception is thrown. Unlike modern SIMD implementations in browsers and runtimes that handle whitespace gracefully, Java's fast-path decoder still halts on spaces or line breaks.

Key points

  • Claims that the OpenJDK Base64 decoding vulnerability permits remote code execution remai…: Claims that the OpenJDK Base64 decoding vulnerability permits remote code execution remain unverified.
  • Flawed length calculations cause an AVX-512 masked store instruction to perform an uninte…: Flawed length calculations cause an AVX-512 masked store instruction to perform an unintended unmasked write.
  • Java's fast-path Base64 implementation fails to process spaces or line breaks without hal…: Java's fast-path Base64 implementation fails to process spaces or line breaks without halting execution.

Sources checked by our analysis pipeline: 1

18 November 2026 · 4 min

Let us start with an example that triggers the issue.

byte[] src = ("A".repeat(128) + "=").getBytes(StandardCharsets.US_ASCII);

Base64.getDecoder().decode(src);

One hundred and twenty-eight letters A and one =

. The string is not valid base64, and a correct decoder rejects it. OpenJDK writes past the end of the array anyway. The bug is CVE-2026-114938. It has been in the JDK since 17.0.6. The bad write is in hand-written assembly.

There are claims that it leads to a major security vulnerability. I have not checked. But I care about the issue because I am indirectly involved.

Base64 turns three bytes into four ASCII characters. Email attachments are base64, and a string often ends with =

. Java sizes the output before it checks the input. One trailing =

counts as one byte of padding, so the allocated length is

3 × ((129 + 3) / 4) − 1 = 98.

So decode

allocates 98 bytes, then calls the decoding routine.

On an x86-64 machine with AVX-512 VBMI, the routine takes the first 128 characters as two blocks…

Technology