Debian

Patch Java4Shell (CVE-2026-114938) on Debian 13 and 12

Debian stable has no fix for Java4Shell yet. Java4Shell on Debian, tracked as CVE-2026-114938, is fixed in sid only, and the openjdk-17, openjdk-21 and openjdk-25 packages that bookworm and trixie hosts pull from the security archive today are all in the affected range, so apt upgrade leaves you exactly where you are. A thread on Hacker News claimed Debian patched it immediately. That’s true for unstable, and for nothing you’d run a production JVM on.

Original content from computingforgeeks.com - post 192027

Until the DSA arrives, you can turn the vulnerable intrinsic off for every Java service, or run a fixed Temurin build from Adoptium’s apt repository and roll it back once Debian ships. We do both below, show where the usual stopgap silently fails, and set up a check that turns positive the day the fix lands. The Java4Shell CVE-2026-114938 overview covers the bug itself. Every command below was run on Debian 13 and Debian 12 on Google Cloud c3 instances (Sapphire Rapids, AVX-512 VBMI present) in November 2026.

Debian builds and fix status

The fixed upstream builds are 17.0.21.1, 21.0.13.1 and 25.0.5.1 or later. Every build Debian ships to bookworm, trixie and forky sits below them, and the security tracker marks all of them vulnerable. This is the state we read from security-tracker.debian.org on 19 November 2026, and the security archive builds match what apt-cache policy showed on the lab hosts:

ReleasePackageNewest buildStatus
Debian 12 bookwormopenjdk-1717.0.21+9-1~deb12u1 (security)Vulnerable, no DSA
Debian 13 trixieopenjdk-2121.0.13+9-1~deb13u2 (security)Vulnerable, no DSA
Debian 13 trixieopenjdk-2525.0.5+8-1~deb13u1 (security)Vulnerable, no DSA
forky (testing)openjdk-21, openjdk-2521.0.13.0.3+1-1, 25.0.5+8-1Vulnerable
sid (unstable)openjdk-17, 21, 25, 2717.0.21.1+2-1, 21.0.13.1+2-1, 25.0.5.1+2-1, 27.0.1.1+4-1Fixed

Two rows deserve a second look. Trixie’s base suite still carries openjdk-21 21.0.12.1, which has a fourth version field like the fixed builds and is still vulnerable, so don’t judge a host by the shape of its version string. Forky is no shortcut either, because it holds 21.0.13.0.3, which is the last affected upstream build. Bookworm ships only Java 17 and trixie only 21 and 25, so the line you patch depends on the release.

Check the host and its packages

Start with the hardware, because the bug only fires on x86-64 CPUs that expose all four of these instruction set flags. ARM64 hosts and older x86 instances without AVX-512 VBMI never run the vulnerable code, so they can wait:

grep -oE '(avx512f|avx512bw|avx512vbmi|bmi2)' /proc/cpuinfo | sort -u

Both lab hosts, an Intel Xeon Platinum 8481C under Debian 12 and Debian 13, print all four. Fewer than four lines means the host is out of scope even on an affected JDK:

avx512bw
avx512f
avx512vbmi
bmi2

Next, ask apt what is installed and what it would install. On a trixie host with both Java lines, query both runtime packages:

apt-cache policy openjdk-21-jre-headless openjdk-25-jre-headless

Installed and candidate are the same security archive build, so there’s nothing newer to take, and apt list --upgradable showed no openjdk line on either host. The older build under each comes from the base suite:

openjdk-21-jre-headless:
  Installed: 21.0.13+9-1~deb13u2
  Candidate: 21.0.13+9-1~deb13u2
  Version table:
 *** 21.0.13+9-1~deb13u2 500
        500 mirror+file:/etc/apt/mirrors/debian-security.list trixie-security/main amd64 Packages
        100 /var/lib/dpkg/status
     21.0.12.1+1-1~deb13u1 500
        500 mirror+file:/etc/apt/mirrors/debian.list trixie/main amd64 Packages
openjdk-25-jre-headless:
  Installed: 25.0.5+8-1~deb13u1
  Candidate: 25.0.5+8-1~deb13u1
  Version table:
 *** 25.0.5+8-1~deb13u1 500
        500 mirror+file:/etc/apt/mirrors/debian-security.list trixie-security/main amd64 Packages
        100 /var/lib/dpkg/status
     25.0.3+9-2~deb13u1 500
        500 mirror+file:/etc/apt/mirrors/debian.list trixie/main amd64 Packages

On bookworm the same check is apt-cache policy openjdk-17-jre-headless, and it showed 17.0.21+9-1~deb12u1 installed and as the candidate. The JVM agrees with the package, and it reports the Base64 intrinsic switched on by default, which is the vulnerable path:

java -version
java -XX:+PrintFlagsFinal -version 2>/dev/null | grep UseBASE64Intrinsics

That’s the bookworm host below. Keep both lines for each JVM you check, because the build string plus that flag is the evidence your change record needs:

openjdk version "17.0.21" 2026-10-20
OpenJDK Runtime Environment (build 17.0.21+9-1-deb12u1-Debian)
OpenJDK 64-Bit Server VM (build 17.0.21+9-1-deb12u1-Debian, mixed mode, sharing)
     bool UseBASE64Intrinsics                      = true                                      {product} {default}

A JVM in your PATH is only one of them. Services that ship their own runtime, such as Elasticsearch or the Jira installer, need the same check against their bundled java, and the overview covers how to find every running JVM through /proc/<pid>/exe.

Confirm the exposure on trixie

Calif, who found the bug, published a bounded test program with its Java4Shell write-up. It warms the decoder until the JIT compiles the AVX-512 stub, decodes one malformed string into a larger array, and prints REPRODUCED if bytes past the decoded output were overwritten. We ran it unmodified, three times against each Debian 13 build:

JVM on Debian 13BuildCalif trigger, 3 runs
Debian openjdk-2121.0.13+9-1-deb13u2REPRODUCED 3 of 3
Debian openjdk-2525.0.5+8-1-deb13u1REPRODUCED 3 of 3
Debian openjdk-25 with the stopgap flag25.0.5+8-1-deb13u1NOT REPRODUCED 3 of 3
Temurin from Adoptium’s apt repository21.0.13.1+2, 25.0.5.1+2NOT REPRODUCED 3 of 3

Read a REPRODUCED as proof and a quiet run as nothing. The same program missed on vulnerable builds in some runs on Rocky Linux and AlmaLinux (see our RHEL, Rocky and AlmaLinux Java4Shell guide), and its published input is sized for Java 21 and 25, so it cannot see Java 17 at all. That is why the bookworm host above is judged on its build string and the intrinsic flag, not on this test.

Turn the intrinsic off for services

One JVM flag, -XX:-UseBASE64Intrinsics, sends Base64 decoding back to the portable Java code. The usual way to reach every JVM is the JAVA_TOOL_OPTIONS environment variable, and the obvious place to set it system-wide on Debian is /etc/environment. Don’t stop there, because it misses services. We ran a test service, demoapp, that starts /usr/bin/java from a plain systemd unit, and checked the flag inside its running JVM before changing anything:

sudo jcmd $(systemctl show -p MainPID --value demoapp) VM.flags -all | grep UseBASE64Intrinsics

As expected, the service runs with the intrinsic on by default:

     bool UseBASE64Intrinsics                      = true                                      {product} {default}

Now add the variable to /etc/environment and open a fresh SSH session, which reads that file through PAM:

echo 'JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics' | sudo tee -a /etc/environment
java -XX:+PrintFlagsFinal -version 2>&1 | grep -E 'Picked up|UseBASE64Intrinsics'

Your login shell picks it up, and the flag source changes to {environment}:

JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics
Picked up JAVA_TOOL_OPTIONS: -XX:-UseBASE64Intrinsics
     bool UseBASE64Intrinsics                      = false                                     {product} {environment}

Restart the service and check its JVM again with the same jcmd line. It still reads true from {default}. Systemd starts services without a PAM session unless the unit sets PAMName=, so /etc/environment never reaches them, and the JVMs that face the network are exactly the ones this file misses. Use it for interactive shells if you like, but protect services one unit at a time with a drop-in:

sudo mkdir -p /etc/systemd/system/demoapp.service.d
sudo vim /etc/systemd/system/demoapp.service.d/java4shell.conf

Put the variable in the drop-in. If the unit already sets JAVA_TOOL_OPTIONS, merge the flag into that value instead, because a later Environment= line for the same variable replaces the earlier one:

[Service]
Environment="JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics"

Reload systemd, restart the service and read the flag from the live JVM:

sudo systemctl daemon-reload
sudo systemctl restart demoapp
sudo jcmd $(systemctl show -p MainPID --value demoapp) VM.flags -all | grep UseBASE64Intrinsics

Now the service JVM reports the intrinsic off, set from its environment:

     bool UseBASE64Intrinsics                      = false                                     {product} {environment}

Each JVM also logs a Picked up JAVA_TOOL_OPTIONS line at start, so journalctl -u demoapp | grep 'Picked up' is the quickest fleet-wide check. Repeat the drop-in for every Java service on the host, and check each one with jcmd after the restart rather than trusting the file. jcmd ships in the JDK package, so install openjdk-17-jdk-headless or the matching JDK on a host that only has the JRE.

Install a fixed Temurin build

A flag costs some Base64 throughput and leaves the bug in place. If you’d rather run a patched JVM now, Adoptium’s apt repository already carries Temurin 17.0.21.1, 21.0.13.1 and 25.0.5.1 for both bookworm and trixie. Add the repository with its signing key:

sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo tee /etc/apt/keyrings/adoptium.asc >/dev/null
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(. /etc/os-release; echo $VERSION_CODENAME) main" | sudo tee /etc/apt/sources.list.d/adoptium.list

Refresh the index and confirm the candidate is the fixed build before you install anything. On bookworm, for Java 17:

sudo apt-get update
apt-cache policy temurin-17-jdk | head -4

Look for the .1 fix release as the candidate:

temurin-17-jdk:
  Installed: (none)
  Candidate: 17.0.21.1.0+2-0
  Version table:

Install the line your services use. On trixie that is temurin-21-jdk, temurin-25-jdk or both; we installed both there and got 21.0.13.1.0+2-0 and 25.0.5.1.0+2-0:

sudo apt-get install -y temurin-17-jdk

Check where /usr/bin/java points once the install finishes:

update-alternatives --display java | head -3

Be ready for what you see. Temurin registers its java one priority above Debian’s package for the same major version (2112 against 2111 for Java 21), so in auto mode /usr/bin/java moves to Temurin the moment the package installs, for every program on the host that calls it, as long as no higher Java version is installed. On trixie with Debian’s openjdk-25 present, installing only temurin-21-jdk leaves /usr/bin/java on Debian’s 25 (priority 2511), so pick the target yourself with update-alternatives --set:

java - auto mode
  link best version is /usr/lib/jvm/temurin-17-jdk-amd64/bin/java
  link currently points to /usr/lib/jvm/temurin-17-jdk-amd64/bin/java

For this fix that’s what you want, but pin it explicitly so a later package install can’t move it again. Then restart each Java service and confirm the running JVM is the new one:

sudo update-alternatives --set java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java
sudo systemctl restart demoapp
sudo jcmd $(systemctl show -p MainPID --value demoapp) VM.version

After the restart the service runs the fixed 17.0.21.1 build. Before it, the same check printed Debian’s 17.0.21+9, because a running JVM keeps the binary it started with:

3313:
OpenJDK 64-Bit Server VM version 17.0.21.1+2
JDK 17.0.21.1

Only programs that go through /usr/bin/java see the swap. A service that hardcodes JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 keeps running Debian’s vulnerable build, so grep your unit files and /etc/default for that path and keep the stopgap drop-in on anything you cannot move. Amazon’s Corretto apt repository also lists fixed 17.0.21.1.2, 21.0.13.1.2 and 25.0.5.1.2 packages; we checked its index but did not lab it. For a fuller walk through the Temurin packages themselves, our guide to installing Temurin OpenJDK on Debian covers the repository, and setting the default Java version on Debian explains alternatives in more depth.

Roll back to Debian’s OpenJDK

Once the DSA ships and the fixed Debian package is installed, remove the bridge so the host goes back to one JDK that Debian’s security team patches. Install needrestart first, because it is what tells you which services are still running a deleted JVM afterwards:

sudo apt-get install -y needrestart

Then purge the Temurin package and check the alternative again:

sudo apt-get purge -y temurin-17-jdk
update-alternatives --display java | head -3

Purging the package drops its alternative, so /usr/bin/java falls back to Debian’s JDK in auto mode, even though we had set it manually:

java - auto mode
  link best version is /usr/lib/jvm/java-17-openjdk-amd64/bin/java
  link currently points to /usr/lib/jvm/java-17-openjdk-amd64/bin/java

Meanwhile the running service didn’t notice. Its JVM still maps the Temurin library that the purge just deleted, and needrestart in batch mode names the unit that needs a restart:

sudo needrestart -b

Look for the NEEDRESTART-SVC lines; each one is a service still running old code:

NEEDRESTART-VER: 3.6
NEEDRESTART-KCUR: 6.1.0-56-cloud-amd64
NEEDRESTART-KEXP: 6.1.0-56-cloud-amd64
NEEDRESTART-KSTA: 1
NEEDRESTART-SVC: demoapp.service

Restart each service it names, then remove the repository and its key so the host stops pulling from Adoptium:

sudo systemctl restart demoapp
sudo rm /etc/apt/sources.list.d/adoptium.list /etc/apt/keyrings/adoptium.asc
sudo apt-get update

Run the same needrestart -b check after the Debian security upgrade itself, since an upgraded openjdk package leaves every running JVM on the old library until its service restarts. Remove the stopgap drop-in at that point too, with sudo rm /etc/systemd/system/demoapp.service.d/java4shell.conf, a daemon-reload and a restart, so the intrinsic comes back on the fixed build.

Watch for the Debian fix

There’s no need to refresh the tracker page every hour. debsecan reads Debian’s security tracker data and compares it with what the host has installed. Its --only-fixed mode lists only vulnerabilities that already have a fixed package for your suite, so it stays silent until Debian has a fixed package for your suite, normally through a DSA:

sudo apt-get install -y debsecan

Ask it about this CVE twice, once for every affected package and once for fixes only:

debsecan --suite bookworm | grep CVE-2026-114938
debsecan --suite bookworm --only-fixed | grep CVE-2026-114938 || echo 'no fixed package for CVE-2026-114938 yet'

On our bookworm host the first command named both installed JDK packages, and the second found nothing:

CVE-2026-114938 openjdk-17-jdk-headless
CVE-2026-114938 openjdk-17-jre-headless
no fixed package for CVE-2026-114938 yet

Use --suite trixie on Debian 13, and put the second command in a daily cron job that mails you so you hear the same day. Once it prints the CVE, check that apt list --upgradable already shows the fixed build for your architecture, then upgrade:

  1. sudo apt-get update
  2. apt list --upgradable shows openjdk at or above 17.0.21.1, 21.0.13.1 or 25.0.5.1
  3. sudo apt-get upgrade
  4. restart every unit sudo needrestart -b lists
  5. sudo jcmd $(systemctl show -p MainPID --value <unit>) VM.version on each service

Until then, the drop-in or the Temurin bridge is your patch, because nothing in Debian’s archive will fix the JVM for you. If you run Ubuntu as well, its fixed packages are already out and our Ubuntu Java4Shell patch guide walks through them.

Keep reading

Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs Security Java4Shell (CVE-2026-114938): Find and Patch Vulnerable JVMs UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 Security UFW Firewall Commands with Examples on Ubuntu 26.04 / 24.04 nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch Security nginx HTTP/2 RCE CVE-2026-123007: Check, Disable HTTP/2, Patch GL.iNet Security Notice: Check Your Router for Malware and Update Networking GL.iNet Security Notice: Check Your Router for Malware and Update Flatpak 1.18.6 Sandbox Escape CVEs: Check Version and Patch Security Flatpak 1.18.6 Sandbox Escape CVEs: Check Version and Patch How To Install Apache CouchDB on Debian 11/10 Databases How To Install Apache CouchDB on Debian 11/10

Leave a Comment

Press ESC to close