
Bash script that checks Ubuntu LXD and MicroCloud Snap versions against CVE-2026-112816 safe thresholds and applies channel-preserving snap refresh remediation.
A Bash script that checks Canonical LXD and MicroCloud Snap installations on Ubuntu for CVE-2026-112816 and applies the necessary security updates.
[!WARNING] Critical security vulnerability (CVSS v4.0: 10.0). In production environments, take a backup first and plan an appropriate maintenance window. The script's success only confirms that the installed version has reached the announced remediation threshold; it does not prove that no attack has occurred in the past.
CVE-2026-112816 is an authentication bypass vulnerability in Canonical LXD's HTTPS interface arising from the way the client TLS certificate chain is verified. An attacker who can access the LXD API can impersonate a trusted client by using a crafted chain that leverages that client's public certificate. Depending on the privileges obtained, this can have serious effects on the cluster, managed containers/virtual machines, and the host system. Canonical has also released a fix for MicroCloud.
The following versions are the minimum safe versions included in Canonical's remediation list dated October 29, 2026.
| Snap package | Snap channel (track) | Minimum safe version |
|---|---|---|
lxd | 4.0/stable | 4.0.15 |
lxd | 5.0/stable | 5.0.11 |
lxd | 5.21/stable | 5.21.9 |
lxd | 6/stable | 6.10.1 |
microcloud | 2/stable | 2.1.5 |
microcloud | 3/stable | 3.4.1 |
When the script encounters a risky installation of these tracks other than stable, it compares it against the same safe version threshold without switching channels. If a recognized version family is in use, it can also evaluate the latest track. An unknown track/version is not automatically considered safe.
[!NOTE] Canonical has stated that, on the announcement date, the LXD fixes were rolled out gradually from the
candidatechannel to thestablechannel. Even ifsnap refreshsucceeds, the script returns a failure result if a sufficiently new version is not delivered. The script does not switch tocandidateor a different channel on its own to obtain the fix.
dpkg version comparison tool available on Ubuntu).lxd and/or microcloud installed via Snap.lxc client for cluster detection (used if present); failure of access or the command does not prove that there is no cluster.This tool does not update LXD installed via APT/DEB, compiled from source, or installed by other means. If LXD is not installed, the script does not perform a new installation.
Keep the script and this README in the same directory:
.
├── README.md
└── fix-cve-2026-112816.sh
bash -n fix-cve-2026-112816.sh
bash fix-cve-2026-112816.sh --check
--check is the default mode. It makes no updates. It shows the current Snap version, the tracked channel, and the minimum safe version.
sudo bash fix-cve-2026-112816.sh --apply
This command runs snap refresh <paket> only for the lxd/microcloud Snap packages that remain below the threshold, while preserving the currently tracked channel.
bash fix-cve-2026-112816.sh --check
snap list lxd microcloud
On some versions, the second command may fail if one of the packages is not installed. In that case, run
snap list lxdandsnap list microcloudseparately.
A successful result means that the detected package versions have reached the thresholds above. Verify service health separately using lxc list, lxc cluster list (if a cluster exists), and your application monitoring systems.
| Parameter | Description |
|---|---|
--check | Read-only version and security threshold check; default. |
--apply | Applies a security update from the current channel if needed. Requires sudo. |
--cluster-ok | Explicitly overrides the protection only when Cluster/MicroCloud maintenance has been planned separately. |
-h, --help | Displays usage help. |
Examples
# Salt okunur kontrol (parametresiz de çalışır)
bash fix-cve-2026-112816.sh
# Tek sunucuda düzeltme
sudo bash fix-cve-2026-112816.sh --apply
# YALNIZCA koordineli cluster bakımı onaylandıysa
sudo bash fix-cve-2026-112816.sh --apply --cluster-ok
# Çıktıyı bir dosyada sakla
sudo bash fix-cve-2026-112816.sh --check > lxd-cve-check.log 2>&1
--cluster-ok mean in a cluster?This parameter does not perform an automatic, sequential, or uninterrupted cluster update. It only removes the script's cluster/MicroCloud protection. The compatible upgrade and operational process for each member must be planned separately by the administrator.
snap list to look for the lxd and microcloud packages.dpkg --compare-versions.--check mode, it only reports the result.--apply mode, if an update is required, it checks the MicroCloud/cluster safety protection.snap refresh only to the relevant package; it does not change the Snap channel.Re-runnable: If the version is already at the safe threshold, the script reports that no update is required.
| Code | Meaning | Action to take |
|---|---|---|
0 | The detected supported Snap packages meet the thresholds or no package was found. | Check whether the package is actually installed; verify service health. |
2 | Parameter error, missing requirement, or no root privileges for the update. | Fix the invalid parameter; use sudo if necessary. |
4 | Coordinated maintenance approval is required for the cluster/MicroCloud. | Complete the cluster plan and use --cluster-ok only when appropriate. |
10 | At least one package remained below the minimum safe version. | Check the Snap distribution status and follow the update process. |
11 | The version/channel of at least one installation could not be verified, or a non-Snap LXD was detected. | Manual verification and vendor documentation are required. |
Important: Exit code
0does not indicate that LXD never had a vulnerability, that all components are safe, or that no exploitation occurred in the past.0may also be returned on a server where no Snap package is detected.
Example automation: