~/f4n6 $ grep -r "apt CVE-2026-109518 allows root code execution via package swap" ./investigations/ --include="*.md"

apt CVE-2026-109518 allows root code execution via package swap

Jeff Davies 05 Nov 2026 7 min read

1. Executive summary

Debian and Ubuntu shipped fixes on 2026-11-04 for CVE-2026-109518, a time-of-check to time-of-use flaw in apt's HTTP download code that lets an attacker who controls traffic between a host and its package mirror replace a package after apt has verified its hash. The swapped package installs as root, so the attacker's maintainer script runs with full control of the machine. NVD scores the flaw CVSS 7.7 HIGH (CWE-62, CWE-367); it is not in CISA KEV and EPSS stands at 1%. Exposure requires an on-path position (compromised network, malicious or compromised mirror, or a proxy or package cache in the path) plus a non-zero Acquire::Retries, which is the default from apt 2.3.2 (Debian 12, Ubuntu 22.04). For EMEA financial services the risk concentrates in CI/CD: self-hosted runners on flat networks, build hosts that run apt-get install behind corporate egress proxies, and container base images built from unpatched Debian or Ubuntu.

2. Regulatory framing

Article Trigger (the fact in this item) Practical impact
DORA Art. 28: ICT third-party risk — general principles Exploitation depends on the integrity of package mirrors, caches and proxies in the path between the client and its package source, including third-party mirror operators Mirror, proxy and cache providers that supply packages to build and production hosts fall inside the ICT third-party risk register and need contractual integrity commitments
NIS2 Art. 21(2)(d): supply chain security measures A compromised or malicious package mirror can deliver root-level code into the client's build pipeline Entities in scope must treat the package supply chain (mirrors, base images, build hosts) as a security measure to be assessed and controlled

3. Technical analysis & attack chain

apt does not rely on transport security to protect packages. Each repository publishes a signed Release or InRelease file listing every package index and its expected hash; apt verifies the PGP signature, then checks each downloaded file against the expected hash. CVE-2026-109518 leaves both checks working. The file that gets installed is no longer the file that was checked.

The bug sits in the code that resumes interrupted downloads. Since apt 2.3.2, shipped in Debian 12 and Ubuntu 22.04, apt retries failed downloads three times by default (Acquire::Retries "3"). Per the Debian and Ubuntu advisories, an attacker in the middle abuses this in three steps:

  1. Merge two downloads. The attacker answers two different package requests with HTTP redirects pointing to the same URL, and apt treats the two downloads as one file.
  2. Force a retry. The attacker returns ordinary temporary HTTP server errors so apt retries and resumes the download. Because the attacker controls the traffic, the retry can be triggered at will.
  3. Swap the file after the check. apt mishandles the hard links used for the merged download. After the hash check passes, the resumed transfer overwrites the hard-linked file with the attacker's payload, and apt installs that file.

The flaw is in apt's HTTP download code, so it affects every front end: apt, apt-get, aptitude and the graphical tools. Snap packages and FTP sources are not affected.

Impact is root code execution because packages install as root. sudo apt install runs dpkg as root, and dpkg runs the package's maintainer scripts such as postinst as root. A swapped package therefore executes the attacker's postinst with full control of the host. On a CI runner that reaches the source code, the GITHUB_TOKEN, cloud credentials, signing keys and every secret passed to the job. In a Docker build the attacker's code is baked into an image that is then shipped and run elsewhere. On a developer workstation it is a full host compromise including stored credentials.

The attacker needs three things: control of HTTP traffic between the machine and its package source (compromised network, malicious or compromised mirror, or a proxy or package cache in the path); a non-zero Acquire::Retries value; and a package install or upgrade that downloads packages. Ubuntu 20.04 and older LTS releases set Acquire::Retries to zero by default and receive fixes through Ubuntu Pro, so they are exposed only where someone raised the value, which CI scripts and Dockerfiles commonly do to cope with flaky mirrors.

The flaw was found by Max Justicz, who also found CVE-2019-3462, a similar apt bug in 2019. Both involve apt's HTTP download handling. CVE-2019-3462 is scored separately at CVSS 8.1 HIGH in NVD, is not in CISA KEV, and has EPSS 15%; that score belongs to the 2019 bug, not to this one.

No exploitation of CVE-2026-109518 in the wild is reported in the sources, and no actor is named. The attack is described from the Debian and Ubuntu advisories, not from an observed intrusion.

4. Mitigation & containment

P1 (within 24h)

  • Upgrade apt on every self-hosted runner, build VM and build container. The source gives the commands but does not list the fixed version numbers; obtain them from the Debian and Ubuntu advisories. To upgrade only apt: sudo apt-get update sudo apt-get install -y -o Acquire::Retries=0 --only-upgrade apt For a full upgrade: sudo apt-get upgrade -y -o Acquire::Retries=0.
  • Rebuild runner images and roll out new pods or VMs. Patching a running runner is not enough if new runners still boot from the old image.
  • Where a host cannot be patched yet, disable retries before any package install by writing Acquire::Retries "0"; to /etc/apt/apt.conf.d/99-no-retries. On GitHub-hosted runners whose image is not yet patched, add a workflow step: ```yaml
  • name: Disable apt retries (CVE-2026-109518) run: echo 'Acquire::Retries "0";' | sudo tee /etc/apt/apt.conf.d/99-no-retries ``` The trade-off is that a flaky mirror fails the job instead of retrying.
  • In Dockerfiles built on an unpatched base image, disable retries before the first apt-get and upgrade apt: RUN echo 'Acquire::Retries "0";' > /etc/apt/apt.conf.d/99-no-retries \ && apt-get update \ && apt-get install --only-upgrade -y apt
  • Verify the installed version and retry setting rather than assuming: apt list --installed '?source-package(^apt$)' apt-config dump | grep -i 'Acquire::Retries'

P2 (within 72h)

  • Patch apt on every runner, build container and other client that installs packages through your mirrors and proxies. Updating apt only on the proxy host does not patch its clients.
  • Rebuild container images from fresh debian and ubuntu base images once those include the fixed apt, using docker build --pull --no-cache so a cached layer with the old apt is not reused. Check the installed apt version in the resulting image; a recent tag or build date is not a substitute.
  • Review both runner-to-cache and cache-to-upstream paths. Use HTTPS for upstream and downstream connections where supported, keep proxy software current, and review TLS termination points. A malicious mirror or a TLS-terminating proxy is still a reason to patch apt itself.

P3 (within 7 days)

  • Move apt sources to HTTPS. Canonical states HTTPS blocks an on-path attacker from exploiting this bug, but it does not protect against a malicious mirror or a proxy that terminates TLS. Some community mirrors do not support HTTPS, so run apt update after switching and check for errors. If you use Harden-Runner block mode, update allowed-endpoints from port 80 to 443 for each mirror, for example deb.debian.org:80 becomes deb.debian.org:443.
  • Update developer laptops and workstations running Debian or Ubuntu, and verify the installed version rather than assuming automatic updates have run.
  • Rebuild runner and container base images on a schedule so future fixes land without a fire drill.

5. Indicators of compromise

No indicators of compromise available in the source material.

The sources describe no atomic indicators (no hashes, domains, IPs or file paths belonging to an attacker). The observable behaviours below are hunt guidance from the source, not confirmed exploitation artefacts.

Behavioural indicators

behaviour where to observe confidence
apt processes making outbound HTTP (port 80) connections to Debian or Ubuntu mirror hostnames during package-install steps Harden-Runner outbound network telemetry, correlated with APT processes and workflow steps; include custom mirrors, proxies and nonstandard HTTP ports Medium; HTTP traffic alone does not prove a job is vulnerable or compromised
package maintainer scripts (postinst, preinst) under dpkg launching curl, wget, bash or base64 Harden-Runner process events during apt steps Medium; some legitimate packages call these tools, so focus on scripts that download and run code or decode data
new outbound destinations appearing during an apt step Harden-Runner network telemetry Medium

6. Detection

The sources give no artefact strings from a malicious package, so no YARA rule is warranted. The behaviour below is loggable and is expressed as a Sigma rule.

title: APT Maintainer Script Spawns Download or Decode Utility
id: 8f3c2a71-5d64-4b0e-9c1a-7e2d4f6b9a03
status: experimental
description: Detects dpkg running a package maintainer script that launches curl, wget, bash or base64, a pattern consistent with a swapped package executing its payload from postinst or preinst (CVE-2026-109518). Some legitimate packages call these tools; triage against new outbound destinations seen during the apt step.
author: Adverse Trace
date: 2026-11-05
references:

  - https://www.stepsecurity.io/blog/cve-2026-109518-apt-package-swap-root
logsource:
  category: process_creation
  product: linux
detection:
  parent:
    ParentImage|endswith:

      - '/dpkg'
      - '/dpkg-deb'
  script:
    CommandLine|contains:

      - 'postinst'
      - 'preinst'
  utility:
    Image|endswith:

      - '/curl'
      - '/wget'
      - '/bash'
      - '/base64'
  condition: parent and script and utility
falsepositives:

  - Legitimate packages whose maintainer scripts fetch or decode data during install
level: medium

CVE assessment

2 referenced CVEs

CVE CVSS Exploited EPSS Summary
CVE-2019-3462 8.1 High — 15% Incorrect sanitation of the 302 redirect field in HTTP transport method of apt versions 1.4.8 and earlier can lead to content i…
CVE-2026-109518 7.7 High — 1% On Debian, Ubuntu, and derivative Linux distributions, an on-path attacker who can manipulate the HTTP traffic (including a mal…

7. Sources

  • StepSecurity, "CVE-2026-109518: apt Flaw Lets Attackers Swap Packages After Verification and Run Code as Root", https://www.stepsecurity.io/blog/cve-2026-109518-apt-package-swap-root, 2026-11-05
  • The Hacker News, "Debian and Ubuntu APT Flaw Lets MitM Attackers Swap Verified Packages and Run Code as Root", https://thehackernews.com/2026/11/debian-and-ubuntu-apt-flaw-lets-mitm.html
  • NVD, EPSS and CISA KEV records for CVE-2026-109518 and CVE-2019-3462 (CVSS, CWE, KEV state and EPSS values as cited in this advisory)

8. Adverse Trace position

Adverse Trace assesses CVE-2026-109518 as CVSS 7.7 HIGH per NVD, not in CISA KEV, with EPSS at 1% and no reported exploitation in the wild. The severity for a given client turns on position, not on the score: a host that fetches packages over plain HTTP with retries enabled and sits behind a shared network, a proxy or a mirror outside its control carries root-level compromise risk, while an isolated host on HTTPS with retries disabled carries little. The technical detail here rests on the StepSecurity write-up and the Debian and Ubuntu advisories it cites; the Hacker News item is a short summary of the same event and adds no independent detail, so treat the attack mechanics as single-sourced until the vendor advisories are read directly. No actor is named and no attribution is made. We will track the Debian and Ubuntu advisories for fixed version numbers, which the sources do not list, and update this note when they are published. Clients should start with the P1 apt upgrade and retry-setting check on self-hosted runners and build hosts, since those combine root execution with access to pipeline secrets.


Read the original source →

Published via PulseTrace — Adverse Trace threat intelligence.

Post this to LinkedIn
Formatting is converted automatically — headings, bullets, a link back & hashtags. Paste straight in.
J
Jeff Davies