DevOps

Patch Java4Shell (CVE-2026-114938) on Jenkins Controllers and Agents

A Jenkins controller sitting on a modern cloud VM is one of the clearest Java4Shell targets a team runs. It decodes attacker-supplied Base64 before any login check, starting with the HTTP Basic auth header on every request, and the Calif researchers who found CVE-2026-114938 list Jenkins among the applications where they demonstrated pre-authentication remote code execution in a default configuration. The catch for Jenkins is that the vulnerable code lives in the bundled JDK, not in Jenkins itself, so patching the war or bumping the LTS line doesn’t do anything on its own.

Original content from computingforgeeks.com - post 191981

Below we patch Java4Shell on a Jenkins controller and its agents three ways: the official Docker images, a Debian or Ubuntu package install backed by the OS JDK, and the inbound build agents that run their own JVM. We tested each path in November 2026 on a Google Cloud c3 instance (Intel Sapphire Rapids) whose CPU exposes avx512vbmi, so the vulnerable decode path was live on every controller we checked. The Java4Shell CVE-2026-114938 overview covers the bug itself and the flag that disables it; this guide is about getting that fix onto Jenkins.

Why a Jenkins controller is exposed

Two conditions have to hold at once for Java4Shell to be reachable:

  • An affected OpenJDK line: 17 from 17.0.6, 21, 25 or 27
  • A host CPU that advertises the AVX-512 VBMI instructions the Base64 intrinsic uses

The newer compute tiers on every cloud carry those flags, so a controller on Intel Ice Lake or newer, or AMD Zen 4 or newer (GCP C3, C3D, C4 and M3, AWS C6i, M7i and C7a, Azure Dsv5), clears the hardware bar. Older shapes such as GCP M1 and M2 or AWS M5 lack VBMI. You check it on the host with one grep:

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

Four lines back means the hardware can run the vulnerable path. Our Sapphire Rapids instance returned all four:

avx512bw
avx512f
avx512vbmi
bmi2

Fewer than four flags, or an ARM64 controller such as Graviton, and the host cannot generate the buggy stub. It drops out of scope even on an affected JDK. On the hardware that does qualify, the second condition is the JDK Jenkins is actually running, and that is where the three install methods diverge. Calif published the vulnerability write-up and a self-contained trigger at calif.io/java4shell; we use their verbatim proof-of-concept below only to confirm state, and we do not reproduce trigger code here.

Checking which JDK your controller runs

Jenkins reports its own runtime, so you don’t have to guess. On a container controller, ask the image directly. The build string is what maps onto the affected range:

docker run --rm --entrypoint java jenkins/jenkins:lts-jdk25 -version

Our current lts-jdk25 image reported a Temurin build older than the fixed 25.0.5.1+2:

openjdk version "25.0.5" 2026-10-20 LTS
OpenJDK Runtime Environment Temurin-25.0.5+8 (build 25.0.5+8-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.5+8 (build 25.0.5+8-LTS, mixed mode, sharing)

Read that build string closely, because patching means a version bump and not a flag. The Temurin builds in today’s images read 25.0.5+8 and 21.0.13+9, both affected; the fixed builds are 25.0.5.1+2, 21.0.13.1+2 and 17.0.21.1+2 or newer. A fourth version field on its own proves nothing: Temurin 21.0.12.1 and Debian trixie’s openjdk-21 21.0.12.1 carry one and are still affected, so compare against those minimum builds. One trap we hit in the lab is worth stating before you touch anything: the lts-jdk17 image is pinned to Jenkins 2.541.3 and ships Temurin 17.0.18, a build from January that predates the CVE. It’s affected, and since Jenkins dropped Java 17 after 2.541.3, that tag will never get a fixed build: set the flag now and move the controller to lts-jdk21 or lts-jdk25. Tie your decision to the minimum fixed builds, nothing else.

On a running controller you can confirm the live flag state without restarting anything. The bundled JDK ships jcmd, so query the Jenkins process for the intrinsic. It was PID 7 in our container; docker exec jenkins ps -eo pid,args shows yours:

docker exec jenkins jcmd 7 VM.flags -all | grep UseBASE64Intrinsics

On the unpatched lts-jdk21 controller the intrinsic is on by default, which is the exposed state:

     bool UseBASE64Intrinsics                      = true                                      {product} {default}

We also ran Calif’s published trigger verbatim inside the lts-jdk21 and lts-jdk25 images. On both it printed REPRODUCED, confirming the out-of-bounds write is live, and rerun in the lts-jdk25 image with JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics set it printed NOT REPRODUCED. That’s the proof the mitigation below actually closes the path, not just that a flag flipped.

Mitigating the controller with the JVM flag

Until a fixed JDK is on the box, disable the vulnerable intrinsic and let the JVM fall back to its portable Base64 decoder. The supported flag is -XX:-UseBASE64Intrinsics, and it’ll take a controller restart to apply. Jenkins reads JVM arguments from the JAVA_OPTS environment variable, so the mitigation is the same idea on every install, with a different place to set the variable.

For a Docker controller, pass it as an environment variable when you start the container:

docker run -d --name jenkins -p 8080:8080 -p 50000:50000 \
  -v jenkins_home:/var/jenkins_home \
  -e JAVA_OPTS="-XX:-UseBASE64Intrinsics" \
  jenkins/jenkins:lts-jdk21

Inside the container the process now carries the flag on its command line, visible with ps:

7 java -Duser.home=/var/jenkins_home -XX:-UseBASE64Intrinsics -Djenkins.model.Jenkins.slaveAgentPort=50000 -Dhudson.lifecycle=hudson.lifecycle.ExitLifecycle -jar /usr/share/jenkins/jenkins.war

Your authoritative check is the live VM flag again, and after the restart it reads disabled, sourced from the command line rather than the default:

     bool UseBASE64Intrinsics                      = false                                     {product} {command line}

For a Kubernetes deployment through the official Helm chart, the same flag goes in the controller values and a rollout restarts the pod. The chart renders JAVA_OPTS straight from this value, so append the flag to anything you already set there:

controller:
  javaOpts: "-XX:-UseBASE64Intrinsics"

Whichever way you set it, confirm it landed from inside Jenkins. Manage Jenkins then System Information lists the JAVA_OPTS value under Environment Variables, which confirms the variable reached the process. It doesn’t prove the JVM took the flag, and on Windows the flag travels through jenkins.xml instead, so the definitive check is the live VM flag: jcmd as above, or the Script Console probe in the agents section, which reads it from inside the JVM.

Patching an Ubuntu or Debian package install

A package install is the more common production shape, and it behaves differently from the container in two ways that matter. Jenkins from pkg.jenkins.io does not bundle a JDK. It uses whatever OpenJDK you installed from the distribution, and it manages JVM arguments through systemd. That means the real fix is an OS package upgrade, and the stopgap is a systemd drop-in. On our test server running Jenkins 2.580.2 on Ubuntu 24.04, the controller started on the distribution’s OpenJDK 21:

pgrep -u jenkins -a

Read the running command line. It names the war and the JDK arguments, and there’s no mitigation in place yet:

8462 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

Headless JRE packages ship no jcmd, so you’ll prove exposure a different way than on the container. Ask the java binary itself for the flag with PrintFlagsFinal, and read the build number off java -version:

sudo -u jenkins java -version
sudo -u jenkins java -XX:+PrintFlagsFinal -version | grep UseBASE64Intrinsics

Our box was on OpenJDK 21.0.3, an affected build, with the intrinsic enabled by default:

openjdk version "21.0.3" 2024-04-16
     bool UseBASE64Intrinsics                      = true                                      {product} {default}

The systemd stopgap

To buy time before the JDK upgrade, add the flag to JAVA_OPTS with a systemd override. Open the drop-in editor for the unit:

sudo systemctl edit jenkins

Add the environment override, keeping the headless flag Jenkins already sets. The line replaces the unit’s JAVA_OPTS outright, so copy in any other options you already pass, such as a heap size:

[Service]
Environment="JAVA_OPTS=-XX:-UseBASE64Intrinsics -Djava.awt.headless=true"

Reload the unit files and restart the service so it picks up the new environment:

sudo systemctl daemon-reload
sudo systemctl restart jenkins

Confirm the flag is on the live command line, because a typo in the drop-in fails silently and you’re left exposed:

8956 /usr/bin/java -XX:-UseBASE64Intrinsics -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

The real fix: upgrade the JDK

The stopgap’s a holding action. What closes the hole for good is the patched OpenJDK from your distribution’s security repository. On Ubuntu the fixed builds shipped on 18 November 2026 as USN-9155-1 through USN-9158-1, and our Java4Shell patch guide for Ubuntu covers the per-release detail. Debian is behind: as of 19 November only sid has the fixed builds, and bookworm and trixie have none, so on Debian keep the stopgap in place. On Ubuntu, upgrade the runtime Jenkins uses, and repeat for any other openjdk-21 package dpkg -l 'openjdk-*' lists, such as openjdk-21-jre:

sudo apt-get update
sudo apt-get install --only-upgrade openjdk-21-jre-headless

Check the installed version is the fixed build and that java -version agrees:

dpkg -l openjdk-21-jre-headless | tail -1
sudo -u jenkins java -version

The package moved to the fixed build, and the runtime version string now reads 21.0.13.1:

openjdk-21-jre-headless:amd64 21.0.13.1+2-1~24.04.1
openjdk version "21.0.13.1" 2026-11-17

One detail surprises people here, and we checked it on the patched box: PrintFlagsFinal on the fixed build still reports UseBASE64Intrinsics = true {default}. The patch corrects the intrinsic rather than disabling it, so the flag value doesn’t change. On a patched JDK the version string is your proof, not the flag. Once the fixed runtime is installed, restart Jenkins and remove the systemd stopgap, since the controller doesn’t need the intrinsic switched off any more. Our override held only that one line, so we removed the file; if yours carries other settings, run sudo systemctl edit jenkins and delete just the Environment line instead:

sudo rm /etc/systemd/system/jenkins.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl restart jenkins

Leaving the flag set after the JDK is patched is harmless for security, but it needlessly slows every Base64 decode, which on a busy controller isn’t free. Pull it once the build number confirms the fix.

Patching the build agents

Every build agent runs its own JVM, and an agent on a capable CPU is exposed exactly like the controller. The controller gives you one place to see all of them. Manage Jenkins then Script Console runs Groovy on the controller, and RemotingDiagnostics.executeGroovy runs a snippet on each connected agent over the remoting channel. Paste this probe into the Script Console. It reports each node’s runtime, the UseBASE64Intrinsics value and source, and whether its CPU carries avx512vbmi, and it only reads flags:

import hudson.util.RemotingDiagnostics
import jenkins.model.Jenkins

def probe = '''
def f = java.lang.management.ManagementFactory.getPlatformMXBean(com.sun.management.HotSpotDiagnosticMXBean).getVMOption("UseBASE64Intrinsics")
def cpu = new File("/proc/cpuinfo")
def vbmi = cpu.exists() ? cpu.text.contains("avx512vbmi") : "n/a"
println "java ${System.getProperty('java.runtime.version')}, UseBASE64Intrinsics=${f.value} (${f.origin}), avx512vbmi=${vbmi}"
'''
Jenkins.get().computers.each { c ->
    def name = c.name ?: "built-in"
    if (c.channel == null) { println "${name}: offline"; return }
    print "${name}: " + RemotingDiagnostics.executeGroovy(probe, c.channel)
}
null

On a mixed estate it returns one line per node:

built-in: java 21.0.13+9-LTS, UseBASE64Intrinsics=false (VM_CREATION), avx512vbmi=true
agent-1: java 21.0.13.1+2-LTS, UseBASE64Intrinsics=true (DEFAULT), avx512vbmi=true

That output reads cleanly once you know the two valid safe states. The built-in node runs an older build but has the intrinsic disabled from the command line, so it is mitigated by the flag. The agent runs the fixed 21.0.13.1+2 build, so it’s patched outright and doesn’t need the flag at all. A node that showed an affected build with UseBASE64Intrinsics=true (DEFAULT) is the one you’d fix.

Agents got lucky here. Jenkins rebuilt the official agent images on 19 November 2026 and already carry the fixed JDK, well ahead of the controller image. We pulled the current tags and read the runtime inside each:

docker run --rm --entrypoint java jenkins/inbound-agent:latest-jdk21 -version

The glibc-based agent images we ran all reported the fixed builds, and the release notes confirm the same for agent and ssh-agent on JDK 25:

jenkins/inbound-agent:latest-jdk21   Temurin-21.0.13.1+2 (build 21.0.13.1+2-LTS)
jenkins/inbound-agent:latest-jdk25   Temurin-25.0.5.1+2 (build 25.0.5.1+2-LTS)
jenkins/agent:latest-jdk21           Temurin-21.0.13.1+2 (build 21.0.13.1+2-LTS)
jenkins/ssh-agent:latest-jdk21       Temurin-21.0.13.1+2 (build 21.0.13.1+2-LTS)

The Jenkins agent release notes scope the fix to the platforms that have a fixed Temurin build: JDK 21 on Linux amd64 (glibc and musl) and ppc64le, and JDK 25 on Linux amd64 glibc only, so the Alpine JDK 25 agent tags are still on an affected build. Windows agent images are affected too and wait on a fixed Temurin Windows x64 build, while ARM64 agents never run the vulnerable code. The JDK 17 agent tags stopped updating in July and won’t be fixed, and the official Helm chart pins its agent image tag, so Helm users have to raise agent.image.tag to the 3396.ve02b_5cde31b_2-1 build rather than wait for a repull. Repull your agent images, confirm the build number, and for any agent you can’t rebuild yet, pass the flag through JAVA_TOOL_OPTIONS, which every HotSpot JVM reads at startup (the inbound agent launcher prefers JENKINS_JAVA_OPTS over JAVA_OPTS, so JAVA_TOOL_OPTIONS is the safer route).

Where the official images stand today

As of 19 November 2026 the split between the controller and agent images is the one thing to carry away: the agent images are fixed, the controller image isn’t published yet. No jenkins/jenkins controller tag on Docker Hub carries a fixed JDK yet: the newest push was 2.591 on 17 November, a day before Temurin published its fixed builds, and the lts-jdk21 tag we pulled on 19 November still reports Temurin 21.0.13+9. The pull request that bumps the controller to 21.0.13.1+2 and 25.0.5.1+2 merged on the morning of 19 November, so a fixed controller image is close, but it wasn’t on Docker Hub when we checked. Until it lands, run your controller image with the JVM flag.

Jenkins installWhat is affectedAction on 2026-11-19
Docker controller (jenkins/jenkins)Bundled JDK; newest tags still 21.0.13+9 / 25.0.5+8, and lts-jdk17 frozen on 17.0.18Set JAVA_OPTS=-XX:-UseBASE64Intrinsics; swap to the fixed image when published
Docker agents (inbound-agent, agent, ssh-agent)Bundled JDK; fixed for Linux glibc JDK 21/25 (not Alpine JDK 25 or Windows yet)Repull latest-jdk21 / latest-jdk25; confirm the minimum fixed build
Ubuntu packageDistribution OpenJDKapt-get upgrade to the fixed JRE (USN-9155-1 to 9158-1)
Debian packageDistribution OpenJDKNo fixed bookworm or trixie package yet (sid only); keep the systemd stopgap
RHEL packageDistribution OpenJDKdnf upgrade to the java-*-openjdk .1.2 builds from the 19 November RHSAs
Rocky / AlmaLinux packageDistribution OpenJDKFixed RPMs not on the mirrors yet; systemd stopgap until they land
Windows serviceConfigured JDK in jenkins.xmlAdd the flag before -jar in the arguments tag; restart the service; confirm with Get-CimInstance Win32_Process

One pattern sits under all of it, the same one that makes Jenkins awkward and makes this post necessary: the fix follows the JDK, not the Jenkins version. A controller upgrade doesn’t touch the runtime, an agent can be patched while the controller isn’t, and the runtime build, checked against the minimum fixed versions, is the only thing that tells you a node is actually safe. Our guides for installing Jenkins on Ubuntu and on Rocky Linux and AlmaLinux use the same package model, so the same upgrade-the-JDK rule applies to them.

Keeping the controller patched

Java4Shell isn’t a one-time fix on a CI system, because Jenkins pulls new agent images and the controller image updates on its own LTS cadence. Three checks keep it honest after today:

  • The Script Console probe across all nodes, after any agent fleet change or JDK bump
  • The runtime build on every node against 17.0.21.1+2, 21.0.13.1+2 and 25.0.5.1+2
  • The published jenkins/jenkins controller image, so you can drop the JVM flag once the fixed tag ships

Run the probe, read the build strings, and mitigate anything still on an affected JDK with the flag until its package or image catches up. Once every node reports one of those builds or newer, the controller’s patched for real and the JAVA_OPTS workaround can come back out.

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 Fix GitLab Local Network Requests Blocked Error Automation Fix GitLab Local Network Requests Blocked Error

Leave a Comment

Press ESC to close