---
id: blog/en/apt-verified-package-replacement-2026
type: blog
language: en
title: "APT: how a verified package can be replaced before installation"
description: CVE-2026-109518 lets an on-path attacker replace a verified APT package when HTTP redirects and download retries meet.
summary: CVE-2026-109518 lets an on-path attacker replace a verified APT package when HTTP redirects and download retries meet.
url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/
markdown_url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/index.md
author: rootzero
published: 2026-11-09T00:00:00.000Z
updated: null
tags:
  - Linux
  - APT
  - Supply Chain
  - RCE
topics:
  - id: vulnerabilities
    name: Vulnerabilities
    url: https://rootzero.eu/en/research/topics/vulnerabilities/
  - id: systems-networks
    name: Systems and networks
    url: https://rootzero.eu/en/research/topics/systems-networks/
  - id: supply-chain
    name: Supply chain
    url: https://rootzero.eu/en/research/topics/supply-chain/
translations:
  en: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/
  fr: https://rootzero.eu/research/apt-paquet-verifie-remplace-2026/
reading_minutes: 4
content_origin: source-analysis
research_reference: null
research_status: null
vulnerabilities: []
references:
  - label: CVE-2026-109518
    url: https://security-tracker.debian.org/tracker/CVE-2026-109518
  - label: Debian describes
    url: https://lists.debian.org/debian-security-announce/2026/msg00526.html
  - label: APT fix referenced by Debian
    url: https://salsa.debian.org/apt-team/apt/-/commit/5af16a8ad0f155233dfb10b7c92ad1903112ef79
  - label: Ubuntu
    url: https://ubuntu.com/blog/apt-vulnerability-fixes-available
  - label: AWS recommends
    url: https://aws.amazon.com/security/security-bulletins/2026-172-aws/
  - label: APT team’s technical note
    url: https://lists.debian.org/deity/2026/11/msg00005.html
sections:
  - title: Two downloads come to reference the same object
    level: 2
    url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/#two-downloads-come-to-reference-the-same-object
  - title: The fix recreates the destination before resuming
    level: 2
    url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/#the-fix-recreates-the-destination-before-resuming
  - title: The conditions rule out arbitrary Internet compromise
    level: 2
    url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/#the-conditions-rule-out-arbitrary-internet-compromise
  - title: Classify a host without reproducing the attack
    level: 2
    url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/#classify-a-host-without-reproducing-the-attack
  - title: Fix APT before asking it to fix itself
    level: 2
    url: https://rootzero.eu/en/research/apt-verified-package-replacement-2026/#fix-apt-before-asking-it-to-fix-itself
---

# APT: how a verified package can be replaced before installation

> CVE-2026-109518 lets an on-path attacker replace a verified APT package when HTTP redirects and download retries meet.

**Debian and Ubuntu fixes were published on 4 November 2026.** [CVE-2026-109518](https://security-tracker.debian.org/tracker/CVE-2026-109518) lets an attacker between an APT client and a repository reached over HTTP cause installation of a package that APT did not verify. Exploitation also requires a redirect and a retry after a failed download. Retries are enabled by default on Debian 12 and Ubuntu 22.04 or later. A substituted package can contain maintainer scripts executed as `root`.

The repository signature is not broken. The flaw appears when the trust decision and the file ultimately installed become detached during download.

## Two downloads come to reference the same object

APT downloads repository metadata, verifies the expected package information, then retrieves the `.deb` file. Its HTTP backend follows redirects and resumes downloads to tolerate network errors. [Debian describes](https://lists.debian.org/debian-security-announce/2026/msg00526.html) a flaw where redirects can give two distinct downloads the same URI and cause APT to merge them. During a retry, incorrect file handling then lets an on-path attacker replace the package after verification.

The [Debian tracker](https://security-tracker.debian.org/tracker/CVE-2026-109518) specifies that hard-link reuse is involved. A hard link is not a copy: two names can reference the same inode. If code treats those names as independent files while they share storage, a write intended for one can change the object that another stage considers verified.

```text
expected and verified package
             │
             ├── HTTP redirect and retry
             │
file object reused on disk
             │
             └── content replaced, then installed
```

This diagram explains the mechanism; it is not an independent reproduction. Public advisories do not provide a universal sequence that works against every APT configuration.

## The fix recreates the destination before resuming

The [APT fix referenced by Debian](https://salsa.debian.org/apt-team/apt/-/commit/5af16a8ad0f155233dfb10b7c92ad1903112ef79) removes neither redirects nor retries. It changes how the destination is reopened. For a resumed download, APT first retains the old content through a read descriptor, creates the new destination exclusively, then copies the received bytes into that new object before resuming the calculation.

```text
old partial ── open for reading ─────┐
                                     ├── copy into a new inode ── resume
destination ── exclusive creation ──┘
```

Exclusive creation prevents a write from silently following an existing hard or symbolic link. Tests added with the fix verify that the file targeted by a link remains unchanged. The security property is that the resumed file becomes a newly created object, separate from the shared inode behind the confusion.

This patch reading is not an exploit PoC. It explains why the fix closes the replacement primitive without publishing a malicious mirror or an executable package.

## The conditions rule out arbitrary Internet compromise

The attacker must be able to modify HTTP traffic between the machine and the mirror. The sources cite a hostile local network, a compromised proxy or a malicious mirror. The redirect and retry path must also be reached, with `Acquire::Retries` greater than zero. Its default is `3` from Debian 12 and Ubuntu 22.04; earlier releases are normally exposed only if that setting was changed.

[Ubuntu](https://ubuntu.com/blog/apt-vulnerability-fixes-available) says HTTPS APT sources prevent this network attack and Snap packages do not use the affected backend. HTTPS is still not a fix for the software defect: an estate may contain several sources, an internal proxy or a configuration that reverted to HTTP. The installed APT version remains the decisive control.

User interaction is required in the CVSS sense because an install or update must trigger the download. Once accepted, package maintainer scripts run with elevated privileges. The transition to `root` comes from the package manager’s normal function, not from a documented second privilege escalation.

## Classify a host without reproducing the attack

Three local checks establish the main conditions: APT version, effective `Acquire::Retries` and at least one HTTP source. They change neither repositories nor cache state:

```sh
apt list --installed '?source-package(^apt$)'
apt-config dump | grep -E '^Acquire::Retries'
grep -RhsE '^(deb |URIs:)[[:space:]]*http://' \
  /etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null
```

An absent retries value must be interpreted using the installed version’s default, not as an implicit zero. Likewise, no current HTTP source does not describe a historical configuration used for an earlier installation. This check classifies present exposure; it does not find a past compromise.

## Fix APT before asking it to fix itself

The operational paradox is that updating the package manager uses the vulnerable package manager. [AWS recommends](https://aws.amazon.com/security/security-bulletins/2026-172-aws/) running the upgrade with `Acquire::Retries=0`, which removes the retry condition during that operation. Fixed versions include APT `2.6.2` for Debian 12, `3.0.4` for Debian 13, `2.4.15ubuntu0.1` for Ubuntu 22.04 and `2.8.4ubuntu0.1` for Ubuntu 24.04. Distribution tracking remains authoritative for other branches.

Updating only future images leaves running machines unchanged. Debian- or Ubuntu-based container images need to be rebuilt and redeployed with the fixed package. Updating a local layer without replacing active instances creates version drift that is difficult to inventory.

After remediation, an investigation cannot stop at the current fixed version. Review installations made during the exposure window, repository and proxy provenance, and whether installed packages match expected releases. APT logs can document an operation, but they do not independently prove the integrity of the content executed.

The case exposes a property of update chains that is easy to miss: a signature protects an identified object only while the installed object remains the same until execution. Redirects, resumes and temporary files belong to that security boundary. The [APT team’s technical note](https://lists.debian.org/deity/2026/11/msg00005.html) confirms that the attack replaced existing hard links through redirects and transient HTTP errors, and separates this CVE from memory fixes shipped in the same package.

**Primary sources:** [Debian DSA-6607-1](https://lists.debian.org/debian-security-announce/2026/msg00526.html), [APT team technical note](https://lists.debian.org/deity/2026/11/msg00005.html), [Debian tracker for CVE-2026-109518 and the fix](https://security-tracker.debian.org/tracker/CVE-2026-109518), [Ubuntu analysis and versions](https://ubuntu.com/blog/apt-vulnerability-fixes-available), [AWS bulletin](https://aws.amazon.com/security/security-bulletins/2026-172-aws/).
