Yaamlabs
Vulnerabilities

An APT retry lets attackers swap your packages

CVE-2026-109518 lets a network attacker or rogue mirror replace a verified package during an apt retry and run code as root. What to patch, and the one-line stopgap.

By Yaali. November 18, 2026, 5 min read, Vulnerabilities, Patching.

Navy cover with the Yaamlabs logo and the text: An APT retry lets attackers swap your packages, 7.7 CVSS, root during apt install

On November 4, 2026, Debian and Ubuntu published fixes for CVE-2026-109518, a flaw in APT (Advanced Package Tool), the program that installs and updates software on Debian, Ubuntu and the many Linux systems built on them. An attacker who can tamper with your package downloads can use it to replace a package that APT has already verified with a file of their own, and have that file run as root, the system's most powerful account, during a routine apt install or apt upgrade.

This is not a remote drive-by. The attacker needs to sit on the network path between your machine and its package mirror, or run a mirror you already trust, which limits who is at immediate risk. What is uncomfortable is that the triggering condition is a default. The flaw only fires when APT retries a download, and retries have been on by default since APT 2.3.2, which covers Debian 12, Ubuntu 22.04 and everything newer. Ubuntu scored it 7.7 out of 10. No vendor has reported it being used in an attack, and it was reported privately by security researcher Max Justicz, who also helped build the fix.

Three-step diagram of the APT package swap: APT verifies a package, a redirect or server error forces a retry, APT reuses a hard link that now points at the attacker's file, and the file installs as root

How it works

APT's entire safety story is verification before install. It downloads a package index that is signed by the distribution's key, and that index lists the exact cryptographic hash (a fingerprint of the file's contents) of every package. When APT downloads a .deb package, it checks the file's hash against the signed index, and only unpacks and installs it once the hash matches. That chain is the reason you can install software over an untrusted network at all: a mirror can serve you the bytes, but it cannot forge a package that matches a hash it does not control.

The retry path breaks that chain. A redirect, or a transient server error such as an HTTP 503, makes APT retry the download instead of failing. On retry, APT can end up handling two downloads that share the same URI, and rather than fetching cleanly it reuses a file already on disk through a hard link, a second filename that points at the exact same data on the filesystem. An attacker who controls the responses can steer that reuse so the verified filename, the one tied to the hash APT already approved, ends up pointing at the attacker's content. APT then installs whatever that trusted name points to. Because installing a Debian package runs as root and can run maintainer scripts packaged alongside it, the attacker's code runs as root.

The whole attack hinges on one setting: Acquire::Retries. If it is zero, APT never retries, and the bug never gets a chance to fire. It defaults to 3 on current releases, so a stock Debian 12 or Ubuntu 22.04 and later is exposed out of the box. Older releases are not vulnerable in their default configuration, but they can be if a script or a configuration file turned retries on.

Who is realistically exposed

The vendors report no exploitation in the wild, so the work here is preventive rather than cleaning up after a known campaign. A MITM (man-in-the-middle, an attacker who sits between two parties and alters the traffic passing between them) or a hostile mirror is the precondition, which rules out the open internet at large and points at a few specific situations.

  • Machines that fetch packages over plain HTTP rather than HTTPS, where anyone on the path can rewrite the traffic.
  • Anything installing or upgrading over a shared or untrusted network: a conference, hotel or cafe connection, or a co-working space.
  • Systems pointed at a third-party or community mirror you do not run and cannot fully vouch for.
  • CI (continuous integration, the automated build systems that compile and test code on every change) runners and container builds that run apt-get on every build, often over whatever network the build host happens to be on, and often with no human watching.

Build pipelines deserve the most attention, because a single poisoned package baked into a base image gets copied into every container built from it, so the blast radius is far larger than one host.

What to do

Patch APT itself before anything else, because the tool you would use to fix other packages is the vulnerable one. Run apt update, then apt install --only-upgrade apt, then confirm the result with apt policy apt or apt --version.

The fixed versions published so far:

  • Debian 13 "trixie": apt 3.0.4, from trixie-security.
  • Debian 12 "bookworm": apt 2.6.2, from bookworm-security.
  • Ubuntu, per USN-8996-1: 2.4.15ubuntu0.1 on 22.04 LTS, 2.8.4ubuntu0.1 on 24.04 LTS, 3.2.1ubuntu0.1 on 26.04 LTS and 3.3.3ubuntu0.1 on 26.10. Older Ubuntu releases are fixed through Ubuntu Pro.

Sources disagree on the Debian unstable version: the fix commit is referenced as 3.3.6, while the tracker lists sid at 3.3.8 and forky at 3.3.7. Confirm against the Debian Security Tracker for your exact suite before relying on a number.

If you cannot patch today, set the retry count to zero so the flaw cannot trigger. Create /etc/apt/apt.conf.d/99mitigate-cve-2026-109518 containing Acquire::Retries "0";. This disables download retries, so installs over a flaky connection will fail rather than retry, which is the point. Remove the file once APT is patched so normal retry behaviour comes back.

Beyond patching, make sure your mirror lines in /etc/apt/sources.list and /etc/apt/sources.list.d/ use https:// and a mirror you trust, rather than plain http://. And after you have updated APT, rebuild or re-pull your container base images so the fixed APT is actually in the images your pipelines produce, not just on the build host.

Getting the fixed version onto every host, and keeping untrusted mirrors and plain HTTP out of build pipelines, is exactly the kind of baseline work our safeguarding and hardening team does, and designing CI and container builds so one swapped package cannot reach production is part of our platform and cloud engineering work. If you want a hand sizing the exposure across your estate, open the chat and Yaali, our AI agent, will pass the question to the engineer who would do the work.


Sources: Debian Security Tracker: CVE-2026-109518, Ubuntu Security Notice USN-8996-1, CSO Online, Phoronix, Cybernews.

Read next

Back to the blog, or tell us about your system in the chat. Yaali, our AI agent, answers first and brings in an engineer.