I patched four Ubuntu machines for Java4Shell a couple of hours after Canonical’s OpenJDK notices went out. The package upgrade turned out to be the easy half. Apt was done in about eleven seconds. The part that bit me came later. With needrestart in list-only mode, a Java service I’d left running kept the vulnerable build mapped in memory, and apt’s one-line hint was all that said it was still running the old code.
The Java4Shell explainer covers what CVE-2026-114938 corrupts and why only certain CPUs are in scope, so I won’t repeat it here. These are my Ubuntu notes: the fixed builds per release, the commands that install them, the checks that prove they landed, and a stopgap for hosts you can’t touch this week. I ran everything in November 2026 on four Google Cloud c3 VMs with Sapphire Rapids CPUs: box1 on Ubuntu 26.04, box2 on 24.04, scratch on 22.04 and box3 on 20.04 attached to Ubuntu Pro.
Matching your release to the fixed build
Ubuntu shipped fixed OpenJDK packages for every supported release on 18 November 2026, for each major the release carries, in four notices published within a few minutes of each other. If your installed version is lower than the one in your row, you’re on a vulnerable build.
| Ubuntu release | OpenJDK 17 | OpenJDK 21 | OpenJDK 25 | Where it comes from |
|---|---|---|---|---|
| 26.10 | 17.0.21.1+2-1~26.10.1 | 21.0.13.1+2-1~26.10.1 | 25.0.5.1+2-1~26.10.1 | security pocket (OpenJDK 27 too: 27.0.1.1+4-1~26.10.1) |
| 26.04 LTS | 17.0.21.1+2-1~26.04.1 | 21.0.13.1+2-1~26.04.1 | 25.0.5.1+2-1~26.04.1 | resolute-security |
| 24.04 LTS | 17.0.21.1+2-1~24.04.1 | 21.0.13.1+2-1~24.04.1 | 25.0.5.1+2-1~24.04.1 | noble-security |
| 22.04 LTS | 17.0.21.1+2-1~22.04.1 | 21.0.13.1+2-1~22.04.1 | 25.0.5.1+2-1~22.04.1 | jammy-security |
| 20.04 LTS | 17.0.21.1+2-1~20.04.1 | 21.0.13.1+2-1~20.04.1 | not packaged | Ubuntu Pro, ESM Apps |
| 18.04 LTS | 17.0.21.1+2-1~18.04.1 | not packaged | not packaged | Ubuntu Pro, ESM Apps |
The versions come from USN-9155-1 (17), USN-9156-1 (21), USN-9157-1 (25) and USN-9158-1 (27, on 26.10 only). Watch the fourth number. On 22.04 and newer the vulnerable builds end in .0.3 and the fixed ones in .1, and the two sit side by side in your apt sources, so a quick glance at a version string is easy to misread. I lab-tested the 26.04, 24.04, 22.04 and 20.04 rows; the 26.10 and 18.04 rows come straight from the notices.
Checking whether the CPU can hit the bug
Before touching packages I wanted to know whether these hosts could reach the vulnerable code path at all. The bug lives in an AVX-512 Base64 stub, so a CPU without all four of these flags never runs it. One grep answers it:
grep -oE '(avx512f|avx512bw|avx512vbmi|bmi2)' /proc/cpuinfo | sort -u
All four came back on every c3 machine I used, which is the worst case. This is box1.

Fewer than four lines means the host cannot take the vulnerable path and you can schedule it with your normal patching. I’d still patch it, though. VMs migrate, autoscaling groups change instance families, and a container image built on an old laptop ends up on a Sapphire Rapids node next quarter. Treat the flag check as a way to order the work, not as a reason to skip it.
Finding every OpenJDK build on the box
Ubuntu lets several OpenJDK majors sit side by side, and java -version only reports the one update-alternatives points at. So I list every runtime package dpkg knows about. The grep drops the empty rows dpkg prints for majors that were never installed:
dpkg-query -W -f='${Package} ${Version}\n' 'openjdk-*-jre-headless' | grep -v ' $'
On box2 that showed all three majors on the vulnerable .0.3 builds dated 2026-10-24, and apt list --upgradable already offered the fixes from noble-security:

Next I asked the archive what it actually carries. This matters more than the tracker page, because apt installs from the archive, not from a web page:
apt-cache madison openjdk-17-jre-headless openjdk-21-jre-headless openjdk-25-jre-headless
Each package gets three rows on 26.04: the fixed build in resolute-security, the vulnerable build in resolute-updates and the original release build. Only the pocket and the version matter here:

The vulnerable build stays listed in the updates pocket after you patch, which looked wrong to me at first. Is apt going to pick the old one? It is not. Apt picks the highest version and the security build wins. The apt-cache policy on box2 after the upgrade makes that plain, with the installed line marked ***:
openjdk-21-jre-headless:
Installed: 21.0.13.1+2-1~24.04.1
Candidate: 21.0.13.1+2-1~24.04.1
Version table:
*** 21.0.13.1+2-1~24.04.1 500
500 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages
100 /var/lib/dpkg/status
21.0.13.0.3+1-1~24.04.1 500
500 http://europe-west1.gce.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
21.0.3+9-1ubuntu1 500
500 http://europe-west1.gce.archive.ubuntu.com/ubuntu noble/main amd64 Packages
If a host pins OpenJDK to the updates pocket, or uses a mirror that skips security, this is where you’d see it: the candidate would be the .0.3 build and the upgrade would quietly do nothing.
Asking pro fix what it thinks
The pro client comes preinstalled on Ubuntu’s server and cloud images, attached or not, and pro fix will tell you which notices touch your installed packages. I ran it with --dry-run first on box2, which wasn’t attached to Pro:
sudo pro fix CVE-2026-114938 --dry-run
Two things in the output surprised me:
- Heading says “OpenJDK 25 vulnerabilities”, then lists all three source packages
- Last line says the CVE is resolved, in a dry run, before anything was installed
The full run from box2, unattached to Pro:
WARNING: The option --dry-run is being used.
No packages will be installed when running this command.
CVE-2026-114938: OpenJDK 25 vulnerabilities
- https://ubuntu.com/security/CVE-2026-114938
3 affected source packages are installed: openjdk-17, openjdk-21, openjdk-25
(1/3, 2/3, 3/3) openjdk-17, openjdk-21, openjdk-25:
A fix is available in Ubuntu standard updates.
{
apt update && apt install --only-upgrade -y openjdk-17-jre-headless \
openjdk-21-jdk-headless openjdk-21-jre-headless openjdk-25-jre-headless
}
✔ CVE-2026-114938 is resolved.
The heading just borrows the title of one of the notices that list the CVE, so ignore it. The “resolved” line is the dangerous one. Dry run reports what would be true after the command runs, so do not paste it into a change ticket as evidence. The useful part is the middle: the affected packages and the exact apt line. Asking by notice instead of by CVE gives more context, because it lists every CVE in the notice and the related notices for the other majors:

USN-9156-1 carries nine CVEs, so this upgrade fixes more than Java4Shell. That’s worth saying in the change request if someone asks why you’re touching a JDK nobody reported a problem with.
Installing the patched packages
On 26.04, 24.04 and 22.04 the fix is in the normal security pocket, so no Pro attach is needed. I prefer --only-upgrade with globs over a full apt upgrade, because it touches OpenJDK and nothing else, which keeps the change small enough to roll back in your head:
sudo apt update
sudo apt-get install --only-upgrade 'openjdk-17-*' 'openjdk-21-*' 'openjdk-25-*'
Run it as is on 26.04, 24.04 and 22.04. On 26.10 add 'openjdk-27-*' if you have 27 installed, because USN-9158-1 fixes it there too. Apt-get rejects the whole command when a glob matches nothing in the archive, which is why 20.04 and 18.04 get their own line further down.
Expect a long run of “Skipping openjdk-NN-…, it is not installed and only upgrades are requested.” lines first. They’re harmless. The globs match every subpackage in the archive and apt is telling you it won’t install the ones you don’t have. Box2 with those lines trimmed:

What I measured with time on each lab host; box1, box2 and box3 also had the 21 JDK installed, scratch only runtimes:
| Host | Release | Packages upgraded | Downloaded | Wall time |
|---|---|---|---|---|
| box1 | 26.04 | 4 | 238 MB | 11.1 s |
| box2 | 24.04 | 4 | 237 MB | 10.8 s |
| scratch | 22.04 | 3 | 155 MB | 8.9 s |
| box3 | 20.04 (Pro) | 3 | 169 MB | 22.4 s |
The downloads themselves took one to three seconds from Google Cloud’s regional mirror; most of the wall time went to unpacking, config files and triggers. The 20.04 run was the slowest on both counts: seven seconds to fetch from esm.ubuntu.com, and about three times the CPU time of the others for the install itself. A fleet behind a slow proxy will take longer.
Proving the fix landed
I check two things after the upgrade: what each JVM binary reports, and whether the package changelog names the CVE. The second is the one I’d keep for an audit, because it ties the installed package to the advisory rather than to a version string you have to compare by eye:
for d in /usr/lib/jvm/java-??-openjdk-amd64; do echo "== $d"; $d/bin/java -version 2>&1 | head -1; done
for n in 17 21 25; do echo -n "openjdk-$n: "; zgrep -c CVE-2026-114938 /usr/share/doc/openjdk-$n-jre-headless/changelog.Debian.gz; done
On 20.04 and 18.04 drop the 25 from the second loop, as there’s no changelog for it. Before the patch the same grep on the openjdk-21 changelog printed 0. After it, box1 shows the 2026-11-17 builds and a 1 for all three:

The top of the 21 changelog on box1 shows where the fix came from. It’s an Ubuntu upload of the upstream release, and its CVE list starts with Java4Shell and runs on past this excerpt, in line with the OpenJDK advisory of 17 November:
openjdk-21 (21.0.13.1+2-1~26.04.1) resolute-security; urgency=medium
* Upload to Ubuntu 26.04.
-- Vladimir Petko <[email protected]> Wed, 18 Nov 2026 18:03:39 +1300
openjdk-21 (21.0.13.1+2-1) unstable; urgency=medium
* OpenJDK 21.0.13.1 release, build2.
+ CVEs:
+ CVE-2026-114938
+ CVE-2026-114939
Both checks only look at files on disk. They say nothing about the JVMs that were already running when apt replaced those files, and that’s the gap the next section is about.
Restarting the JVMs apt left running
Every one of the four notices ends with the same line: after a standard system update you need to restart any running Java applications. A JVM loads its libraries and class data once at start, so swapping the files underneath it changes nothing for that process. To see this I ran a small Java service called java4demo on each box during the upgrade.
On 26.04 and 24.04 the default needrestart setup restarted it for me during the apt run. I ran apt with DEBIAN_FRONTEND=noninteractive and -y, as an automation job would, and you can see “systemctl restart java4demo.service” at the bottom of the upgrade screenshot above. That’s convenient, and it’s also why I almost missed the problem. Plenty of fleets set needrestart to list-only so apt never bounces a production service on its own. So on box2 I rolled back to the vulnerable build and upgraded again with NEEDRESTART_MODE=l. Apt printed “Services to be restarted: systemctl restart java4demo.service” and moved on. The service stayed up, on the old code:

Three signals in that capture agree, and any one of them is enough to put a service on your restart list:
jcmdon the live PID: still the.0.3build/proc/PID/maps: 33 maps to deleted files,bin/javaandclasses.jsaamong themneedrestart -b: namesjava4demo.service
Meanwhile a fresh java -version on the same disk already said .1, which is exactly why a version check alone is not proof. The batch mode is the easiest to script across a fleet:
sudo needrestart -b -r l | grep NEEDRESTART-SVC
One catch: jcmd ships with the JDK, so on a runtime-only server it isn’t there. The maps check works anywhere. For a single service, take the PID that systemd tracks rather than searching by name, count deleted files under /usr/lib/jvm, then restart it. I limit the grep to that path because a ZGC heap shows up as a deleted memfd mapping even on a freshly started JVM. Replace java4demo with your unit:
P=$(systemctl show -p MainPID --value java4demo)
sudo grep -c '/usr/lib/jvm/.*(deleted)' /proc/$P/maps
sudo systemctl restart java4demo
On box1, where needrestart had restarted the service inside the apt run, jcmd reported the .1 build and the deleted map count was 0. On scratch, the 22.04 box, needrestart printed “No services need to be restarted” because nothing Java was running there, which is the answer you want on a build host and a red flag on an app server. Its needrestart is older and, as far as I know, prompts interactively by default instead of restarting on its own. I couldn’t confirm that with no service running. Check needrestart -b after patching a 22.04 app server. Two errors cost me time on the way.
AttachNotSupportedException: Unable to open socket file
My first try used pgrep -f "[j]ava -cp /home/philip Sleeper" to find the JVM. It matched the shell wrapper whose command line contained the class name as well as the JVM, and jcmd took the first PID, the shell. So it tried to attach to bash, waited 10 seconds and gave up with “target process doesn’t respond within 10500ms or HotSpot VM not loaded”. Getting the PID from systemctl show -p MainPID --value fixed it, because systemd knows exactly which process is the service.
Unit java4demo.service was already loaded or has a fragment file
My demo ran as a transient unit from systemd-run. Stopping it ends the JVM with SIGTERM, exit status 143, and systemd keeps the unit around in the failed state, so starting it again under the same name failed with this message on box2, the 24.04 machine. Box1 on 26.04 reused the name without complaint. Clearing the failed state lets the name be reused:
sudo systemctl reset-failed java4demo
Services with a real unit file in /etc/systemd/system do not hit this; systemctl restart is all they need.
Patching 20.04 and 18.04 through Ubuntu Pro
Standard support for 20.04 has ended, so the fixed OpenJDK builds there are only in ESM Apps, which needs an attached Ubuntu Pro subscription (free for personal use). My box3 came from Google’s Ubuntu Pro image with esm-apps already enabled. Madison showed the split clearly: the fix in focal-apps-security on esm.ubuntu.com, and nothing newer than the vulnerable builds anywhere else.

On an unattached 20.04 host, then, apt will tell you everything is up to date while the JVM is still vulnerable. Check whether ESM Apps is on before you trust that:
pro status
If esm-apps is not listed as enabled, attach the machine with sudo pro attach and your token, then upgrade 17 and 21. The 25 glob has to go, since 25 was never packaged for focal:
sudo apt-get install --only-upgrade 'openjdk-17-*' 'openjdk-21-*'
After the upgrade box3 reported the ~20.04.1 builds for both majors. That matches what pro fix CVE-2026-114938 had said: “A fix is available in Ubuntu Pro: ESM Apps.” Per USN-9155-1, 18.04 gets only the 17 fix, also through ESM Apps, so the command there is sudo apt-get install --only-upgrade 'openjdk-17-*'. I did not have an 18.04 box in this lab, so that row is from the notice alone.
Reading the tracker against the archive
Which source should you believe when a scanner and apt disagree? Ubuntu publishes the status of a bug like this in three places, and they don’t update at the same moment:
- The notices (USNs): published with the packages
- The CVE tracker page: updated separately, can trail the notices
- The archive itself: what
apt-cache madisonprints on the host
Scanners and dashboards often read the tracker, but apt reads the archive. When they disagree I go with madison on the host itself, because that is what will actually install. A tracker row that still says Vulnerable does not mean there’s nothing to install, and a row that says Fixed does not mean your mirror has the build yet.
When I checked the tracker on 19 November it agreed with the notices for 17, 21 and 25. Three rows still need watching:
- openjdk-17-crac, 21-crac and 25-crac: Vulnerable on 26.04 and 26.10, no fix yet
- openjdk-26 on 26.04: Needs evaluation
- openjdk-27 on 26.04: not in release; madison on box1 printed nothing
If you run the CRaC builds for fast startup on 26.04, the normal upgrade won’t help you yet. Those hosts need the stopgap below until a rebuild shows up in madison. The tracker marks openjdk-8 and the openjdk-lts source as not affected, so there’s nothing to upgrade for those.
Holding the line where you can’t update yet
For the CRaC packages, a vendor JDK bundled inside an application, or a host frozen until next week’s window, turn the vulnerable intrinsic off. The JVM then uses its portable Base64 code. The flag is -XX:-UseBASE64Intrinsics, and JAVA_TOOL_OPTIONS gets it into a JVM without editing the launcher. I checked it on box2 with PrintFlagsFinal, which shows the value and where it came from:
JAVA_TOOL_OPTIONS=-XX:-UseBASE64Intrinsics /usr/lib/jvm/java-21-openjdk-amd64/bin/java -XX:+PrintFlagsFinal -version 2>&1 | grep -E "Picked up|UseBASE64Intrinsics"
Without the variable the flag reads true from {default}. With it, the JVM echoes the “Picked up” line and the flag flips to false from {environment}:

For a service, put the variable in a systemd drop-in and restart; the explainer has the drop-in and its checks. Like the patch, it only applies at JVM start, so it costs the same restart. Remove it once the host is on a fixed build, since the intrinsic is there for speed. The Amazon Linux Corretto notes and the Alpine container write-up use the same flag for the runtimes their repos haven’t rebuilt yet.
Desktops count too. If you’re running IntelliJ, Minecraft or anything else on a Java runtime on an Ubuntu workstation, the same apt line covers the distro JDK, but apps that ship their own JRE need their own update. My guide to installing OpenJDK 21 on Ubuntu shows how update-alternatives picks between majors, and Ubuntu Desktop 26.04: The Lab-Tested Guide covers a full desktop build with Java, Node.js, Docker and KVM set up the same tested way.
What I still don’t know
A few things I couldn’t settle in this lab, and I’d rather list them than guess:
- When the CRaC packages get their rebuild; the tracker gives no date
- Whether openjdk-26 on 26.04 is affected at all; it’s still “Needs evaluation”
- How the 18.04 and 26.10 upgrades behave; I had no box on either
- Whether needrestart’s auto mode catches JVMs started outside systemd, such as a jar in tmux
The last one is the one I’d test next. needrestart maps processes back to services, and a JVM someone started by hand in a tmux session has no service to restart. On a shared box I’d run the deleted-maps check across every Java PID, not just the ones systemd knows about, before calling the host patched. Have you seen needrestart catch one of those? I’d like to know.