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.


Update Nov 25, 2026: on Nov 19, calif.io shared a timeline showing that adoptium/adoptium-support#1480 hit the bug back in June 9, reproduced the crash on Sep 8, and a fix openjdk/jdk#32781 was proposed on Sep 9 but ignored by Oracle. They also shared a proof of concept trigger that appears to "prime" the decoder 200,000 times with valid input before feeding the malformed base64.

This suggests that the padding check in decodedOutLength is buggy, since decodeBlock javadoc says "Given the parameters, no length check is possible on dst, so dst is assumed to be large enough to store the decoded bytes" and the commit only fixed the AVX-512 code but did not fix decodedOutLength. The bug might still exist in other intrinsic implementations.

Friday, November 6, 2026

Raspberry Pi Kiosk Mode on Trixie Wayland

The default Raspberry Pi OS Trixie now runs Wayland as the default display server using rpd-labwc, a modified labwc window compositor. The difference is that rpd-labwc runs labwc with the --merge-config option so autostart will run both the user and system wide desktop programs.

  • User autostart: $HOME/.config/labwc/autostart
  • System autostart: /etc/xdg/labwc/autostart

This behavior differs from the vanilla labwc which lets the user autostart replace the system autostart.

The rpd-labwc merge-config will always start the default desktop environment in the system autostart and then run the user autostart. This is undesirable for kiosks. If the kiosk program crashes, the default desktop environment is exposed, and anyone can control the kiosk and run arbitrary programs.

Since Raspberry Pi OS starts the autologin using lightdm, here is the cleanest way to configure autologin without the desktop environment:

  • Default Raspberry Pi OS already autologin to desktop; if not, configure it using "sudo raspi-config"
  • Edit /etc/lightdm/lightdm.conf and replace autologin-session=rpd-labwc with autologin-session=labwc
  • Place your kiosk script into $HOME/.config/labwc/autostart

Here is a minimal user autostart:

/usr/bin/swaybg -c 000000 &
/usr/bin/kanshi &

Swaybg sets the background to black, and kanshi reconfigures the display on monitor changes. If necessary, use wlr-randr to rotate display as well. The display names reflect the physical ports, e.g. on a Raspberry Pi, the two HDMI outputs are HDMI-A-1 (left) and HDMI-A-2 (right).

The autostart does not need the shebang line, and it does not need to be executable.

In my case, I am playing the video remotely over ssh using a script like this:

#!/bin/bash

unset DISPLAY
export WAYLAND_DISPLAY=wayland-0

trap 'exit 0' INT TERM
trap 'kill 0; killall mpv' EXIT

wlr-randr --output HDMI-A-1 --transform flipped-270
wlr-randr --output HDMI-A-2 --transform flipped-90

MPV='mpv --vo=dmabuf-wayland --hwdec=v4l2m2m'
$MPV -fs --fs-screen=1 --loop=inf left.mp4 &
$MPV -fs --fs-screen=2 --loop=inf right.mp4 &

while true; do
  sleep 3600
done

This executable shell script remotely starts two videos on the two kiosk display in a loop. They are flipped because the kiosk uses rear projection. Projector on the left is rotated left (clockwise 270 degrees), and the projector on the right is rotated right (clockwise 90 degrees). The videos are H.264 in the vertical format (720x1280), which is hardware accelerated on Raspberry Pi 4 model B.

Allegedly, Raspberry Pi 5 only supported hardware decoding of HEVC (H.265) but dropped H.264 (see this Hacker News post). If hardware decoding is desired, the video codec has to be adjusted to match.