Share:

[ADVISORY] Apache CloudStack mitigation for Java4Shell (CVE-2026-114938)

On 17 November 2026, a vulnerability in the OpenJDK Base64 decoder, known as Java4Shell, was publicly disclosed. Apache CloudStack runs on Java, so several CloudStack components are exposed when they run on an affected JDK and CPU. This advisory explains how to apply the immediate mitigation to all CloudStack components.

  • CVE-2026-114938: OpenJDK Base64 decoder heap overflow (Java4Shell), severity High (CVSS 8.1)

Who is affected

Your CloudStack environment is affected if both of the following are true:

  • Java: the servers run OpenJDK or Oracle JDK 17.0.6 or later, and have not yet been updated to a fixed Java build.
  • CPU: the servers use Intel Ice Lake or newer or AMD Zen 4 or newer processors (x86-64 with AVX-512 VBMI).

This applies to the management server, the usage server, KVM hosts, and the system VMs (Console Proxy VM and Secondary Storage VM). Virtual routers are not affected. VMware and XCP-ng hosts don’t run CloudStack Java services, so in those environments only the system VMs need the mitigation.

CVE-2026-114938: Java4Shell

See the CVE record for full technical details.

The immediate mitigation is to start every CloudStack Java process with the JVM option -XX:-UseBASE64Intrinsics. We recommend applying it on all CloudStack nodes.

Mitigation

Apply the three steps below in order. Steps 1 and 2 cover the system VMs (CPVM and SSVM), and Step 3 covers the management, usage and KVM agent services.

Step 1: Update the system VM agent package (agent.zip)

The CPVM and SSVM start their Java agent from _run.sh, which is shipped inside /usr/share/cloudstack-common/vms/agent.zip. Run this script as root on each management server. It keeps one backup of the original, adds the flag to the AgentShell java line, and stops with an error if the change did not apply.

cat << 'EOF' > java4shell-agentzip.sh
#!/bin/bash
# Java4Shell (CVE-2026-114938): add -XX:-UseBASE64Intrinsics to the system VM agent
set -euo pipefail
command -v zip >/dev/null && command -v unzip >/dev/null
V=/usr/share/cloudstack-common/vms
W=$(mktemp -d); O=$(mktemp -d); OUT="$O/agent.zip"
trap 'rm -rf "$W" "$O"' EXIT

# keep the pristine original only once
[ -e "$V/agent.zip.orig-java4shell" ] || cp -p "$V/agent.zip" "$V/agent.zip.orig-java4shell"

cd "$W"
unzip -q "$V/agent.zip"
if ! grep -q -- '-UseBASE64Intrinsics' _run.sh; then
  sed -i -E '/com\.cloud\.agent\.AgentShell/ s#^([[:space:]]*(exec[[:space:]]+)?)java #\1java -XX:-UseBASE64Intrinsics #' _run.sh
fi

# fail if the flag is not on the AgentShell launch line
if ! grep 'com\.cloud\.agent\.AgentShell' _run.sh | grep -q -- '-XX:-UseBASE64Intrinsics'; then
  echo "ERROR: flag not applied to AgentShell java line:"; grep -n AgentShell _run.sh; exit 1
fi

zip -qr -X "$OUT" .
unzip -l "$OUT" | grep -qE ' _run\.sh$' || { echo "ERROR: _run.sh not at zip root"; exit 1; }
install -m 0644 "$OUT" "$V/agent.zip"
echo "Patched: $(sha256sum "$V/agent.zip")"
EOF

chmod +x java4shell-agentzip.sh
./java4shell-agentzip.sh

KVM only: each KVM host has its own copy of agent.zip, and system VMs pick it up from that host. Copy the patched file from the management server to every KVM host:

for h in kvm-host1 kvm-host2 kvm-host3; do
  scp /usr/share/cloudstack-common/vms/agent.zip root@$h:/usr/share/cloudstack-common/vms/agent.zip
done

Step 2: Apply the update to the running CPVM and SSVM

Running system VMs keep using the old _run.sh until you refresh them. Do the CPVM first. Either destroy each system VM, or live patch them with CloudMonkey:

for svm in $(cmk -o json list systemvms filter=id | jq -r '.systemvm[].id'); do
  echo "patching $svm"; cmk patch systemvm id=$svm forced=true
done

You can also patch each system VM from the UI.

Step 3: Patch the management, usage and KVM agent services

Run this script as root on every management server, usage server and KVM host. It only touches the CloudStack services installed on that node, keeps a backup of each file, and restarts only the services that are running.

cat << 'EOF' > java4shell-services.sh
#!/bin/bash
# Java4Shell (CVE-2026-114938): add -XX:-UseBASE64Intrinsics to CloudStack service JVMs
for f in /etc/default/cloudstack-management /etc/default/cloudstack-usage /etc/default/cloudstack-agent; do
  [ -f "$f" ] || continue
  if grep -q -- '-UseBASE64Intrinsics' "$f"; then
    echo "$f: already patched"; continue
  fi
  [ -e "$f.bak-java4shell" ] || cp -p "$f" "$f.bak-java4shell"
  sed -i -E 's/^(JAVA_OPTS="[^"]*)"/\1 -XX:-UseBASE64Intrinsics"/' "$f"
  grep -q -- '-UseBASE64Intrinsics' "$f" && echo "$f: patched" || echo "$f: WARNING - JAVA_OPTS line not matched, edit manually"
done

for s in cloudstack-management cloudstack-usage cloudstack-agent; do
  systemctl is-active --quiet $s 2>/dev/null && systemctl restart $s && echo "restarted $s"
done
EOF

chmod +x java4shell-services.sh
./java4shell-services.sh

Notes:

  • Multiple management servers: run the script on one node at a time, and wait until each one is back up before moving to the next. A restart interrupts async jobs that are in progress on that node.
  • KVM hosts: restarting cloudstack-agent does not affect running guest VMs. The host may show as Disconnected briefly while the agent reconnects.
  • If you see a WARNING: your /etc/default file doesn’t have a single-line JAVA_OPTS="..." entry. Add -XX:-UseBASE64Intrinsics to the JVM options by hand, then restart the service.

If you have questions or need help applying the mitigation, contact the ShapeBlue support team.

Share:

Related Posts: