Shell scripts that audit, mitigate, patch and verify CVE-2026-109518 in APT on Debian/Ubuntu systems, including Proxmox VE hosts, LXC containers and VMs, with tamper checks.
Silly little patch for cve-2026-109518 for Proxmox and apt. Happily fixed now but could be of use. This is how I fixed it while a longer fix was being developer. Tested to work and vibe coded with Claude Opus # CVE-2026-109518 APT patch & audit scripts
Pre-release. Tested on real Ubuntu systems and in simulated Proxmox environments (details below), but not yet on a real Proxmox host with real Debian guests. Run
--auditfirst, then patch one container and one VM before your whole fleet.
Shell scripts that find, mitigate, patch and verify CVE-2026-109518 on Debian, Ubuntu and their derivatives, either on one machine or across a whole Proxmox VE host (the host, every LXC container and every VM) in one run. They also check whether a system may already have been compromised through the bug.
| Script | Use it for |
|---|---|
cve-2026-109518-apt-fix-proxmox.sh | A Proxmox VE host: the host itself, all running containers (pct exec) and all running VMs with the QEMU guest agent (qm guest exec). No SSH needed. |
cve-2026-109518-local.sh | Any single Linux machine: bare metal, VM, container, cloud instance. Proxmox not required. |
Both scripts run the same check logic: the Proxmox script embeds cve-2026-109518-local.sh byte for byte.
CVE-2026-109518 is a flaw in APT, the package manager of Debian, Ubuntu and derivatives, disclosed on 4 November 2026 and credited to Max Justicz. An attacker who can tamper with plain-HTTP package downloads (a malicious mirror, proxy, Wi-Fi network or Tor exit node) can get a package that failed signature verification installed, which means code execution as root.
Exploitation requires that:
Acquire::Retries > 0). The default is 3 from Debian 12 and Ubuntu 22.04 LTS onward, so those releases are exposed out of the box. Older releases default to 0.Setting Acquire::Retries "0" makes the bug unexploitable, which is what lets these scripts download the fix safely even over an untrusted network.
| Release | Fixed apt version |
|---|---|
| Debian 11 bullseye | 2.2.5 |
| Debian 12 bookworm (DLA-4880-1) | 2.6.2 |
| Debian 13 trixie (DSA-6607-1) | 3.0.4 |
| Debian unstable | 3.3.6 (testing/forky: no fix yet at disclosure) |
| Ubuntu 22.04 LTS | 2.4.15ubuntu0.1 |
| Ubuntu 24.04 LTS | 2.8.4ubuntu0.1 |
| Ubuntu 26.04 LTS | 3.2.1ubuntu0.1 |
| Ubuntu 26.10 | 3.3.3ubuntu0.1 |
| Ubuntu 14.04 / 16.04 / 18.04 / 20.04 (ESM, Ubuntu Pro) | 1.0.1ubuntu2.24+esm4 / 1.2.36+esm1 / 1.6.19+esm1 / 2.0.12+esm1 |
Always confirm against your distribution's own advisory (Ubuntu: USN-8996-1).
# 1. Audit everything. Read-only: changes nothing on any system.
sh cve-2026-109518-apt-fix-proxmox.sh --audit
# 2. Patch everything, then audit again to confirm.
sh cve-2026-109518-apt-fix-proxmox.sh && sh cve-2026-109518-apt-fix-proxmox.sh --audit
# 3. Read the full report.
less -S "$(ls -t /root/cve-2026-109518-*-report.txt | head -1)"
Run it inside tmux or screen so a dropped SSH session doesn't interrupt it. Use --out DIR to write reports somewhere other than /root.
sh cve-2026-109518-local.sh --audit # read-only check
sh cve-2026-109518-local.sh # patch (as root)
sh cve-2026-109518-local.sh --csv /root/cve.csv # also append a CSV row
# Remote, without copying the script over:
ssh root@HOST 'sh -s -- --audit' < cve-2026-109518-local.sh
Experimental. Tested in a lab on real Ubuntu systems only, never on production machines. Reverting is optional: leaving the mitigation in place is safe.
Patching leaves one temporary file per system, /etc/apt/apt.conf.d/99-cve-2026-109518, which turns off APT download retries. Once a system runs the fixed apt, you can remove it so APT retries flaky downloads again (useful over Tor or bad links). Reverting never downgrades or unpatches apt: it only removes that one file.
sh cve-2026-109518-apt-fix-proxmox.sh --revert-check # read-only: what would happen
sh cve-2026-109518-apt-fix-proxmox.sh --revert # asks you to type REVERT (--yes to skip)
sh cve-2026-109518-apt-fix-proxmox.sh --restore-mitigation # undo: put the file back everywhere
sh cve-2026-109518-local.sh --revert-check # same, single machine
On each system, --revert refuses (status KEPT) unless all of these hold:
PATCHED. MITIGATED, UNKNOWN, VULNERABLE and even OK-OLD systems keep the file;It also needs root and a writable system, and it keeps a backup in /var/backups/cve-2026-109518/ before removing anything. After removal it confirms APT's config still loads and the system is still PATCHED; if not, it puts the file back. --restore-mitigation restores from that backup (or writes the file fresh), and warns if another APT config sets retries above 0.
| Revert status | Meaning |
|---|---|
REVERT-READY | --revert-check only: safe to revert. |
REVERTED | File removed (backup kept). apt is still patched. |
NOTHING-TO-REVERT | No mitigation file on this system. |
RESTORED | Mitigation is in place again. |
KEPT | Refused for safety; the detail column says why. |
.deb still in /var/cache/apt/archives is hashed and compared with the SHA-256 in the signed package indexes. The attack swaps a package after APT verifies it, so a swapped package left in the cache won't match. Any mismatch stops the run for that system: it is not patched and is reported as INFECTED?./etc/apt/apt.conf.d/99-cve-2026-109518 with Acquire::Retries "0"; and confirms no other config overrides it.apt-get update, then upgrades only the apt package. Locally edited APT config files are kept (--force-confold), and packages someone has put on hold are respected, never overridden.--audit runs step 1 and the verdict only. It writes nothing, runs no apt-get update, and works without root.
The verdict comes from apt's own version and changelog, not from what the distribution calls itself, so it works for derivatives whose os-release is incomplete or misleading:
/usr/share/doc/apt/changelog.Debian.gz) names CVE-2026-109518, it is patched. This catches derivatives that backport the fix under their own version numbers.1.0.x and 3.3.x, which are told apart by the ubuntu/esm suffix), so the right threshold is picked automatically.UNKNOWN, not PATCHED. When the script can't prove the fix is there, it says so.Acquire::Retries is worked out even when it isn't set explicitly: an untouched system doesn't list it in apt-config dump, so the default is derived from apt's version (3 from apt 2.3 on, 0 before).