Wednesday, November 18, 2026

java4shell Hallucination

It's obvious that the author(s) of calif.io/java4shell (CVE-2026-114938) has credited using AI to generate this report. AI still can already sound very confident, but it buried a few details that make the vulnerability not so exploitable as it claimed.

First, the vulnerability exists in the X86-64 AVX-512 implementation of the Base64 decoder. AVX-512 is supported by some higher end Intel Xeon and Core and AMD Zen CPUs. As it turns out, I don't actually have such a CPU. Look for the string avx512 in /proc/cpuinfo on Linux. The article incorrectly included the "bmi2" string in the detection signature.

The article claims that the trigger input is 'A' * 64 + '=' but the input has an invalid padding (the alternative OpenJDK 17 trigger 'A' * 128 + '=' also has an invalid padding). Java can decode a string with no padding, but it will reject any string with an invalid padding. The padding is first checked by the Java function decode calling decodedOutLength, before it calls decode0 which calls decodeBlock.

The vulnerability does not exist in the Java implementation of decodeBlock, but the AVX-512 intrinsic implementation of it. The JIT compiler would detect that the bytecode is calling an @IntrinsicCandidate and dispatches code generation to a stub generator. The StubGenerator::generate_base64_decodeBlock is the generator that emits inlined assembly, which makes human analysis very hard.

Before the exploit can reach the vulnerable AVX-512 decodeBlock, it must first pass the padding check in Java, which means your code is not vulnerable if it just uses the public method in java.util.Base64. The vulnerability in the AVX-512 decodeBlock was fixed in commit 5177a70, which adds the short tail handling in assembly, something that decode0 already handled in Java. The decodeBlock is a private method so no outside code can call this directly.

This is what makes AI generated bug report weird. The code when looked at in isolation is arguably buggy, but the precondition for triggering the bug has been eliminated elsewhere.

But what I really hate about the AI generated report is that they try to write a Lord of the Rings trilogy out of a few lines of vulnerability. Who has the damn time to read it? Bring back the tl;dr please.