Cloudanix VulnDB

CVE-2024-47174

Medium · 5.9

CVSS

5.9

EPSS

0.3%

Published

Sep 26, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A widely used package manager for Linux and Unix systems skipped basic security checks on encrypted downloads, letting network attackers potentially steal login details or insert harmful code into software builds.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Moderate
Impact
Data Exposure
Component
Application
Class
Cryptographic Weakness
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Missing TLS certificate verification in the builtin:fetchurl derivation builder allows man-in-the-middle interception of HTTPS connections, exposing full URLs and credentials from netrc or impureEnvVars while also permitting injection of arbitrary store objects during TOFU hash retrieval or impure derivations.

Why it matters to the business

Organizations relying on Nix for reproducible builds risk credential theft or supply-chain compromise through network attacks, potentially leading to unauthorized access, tampered dependencies, and disrupted package management workflows across Linux and Unix environments.

How an attack unfolds

An attacker on the same network positions themselves to intercept traffic, waits for Nix to perform an HTTPS fetch via fetchurl.nix or affected Nixpkgs mechanisms, presents a fraudulent certificate that is accepted due to missing validation, and either extracts authentication material or supplies malicious store objects that the client accepts as valid.

How to fix it

Upgrade nixos/nix to version containing commit 501a805fcd4a90e2bc112e9547417cfc4e04ca66 (equivalent to 2.18.8 or 2.24.8) and github.com/argoproj/argo-workflows/v3 to 3.0.9. As a workaround, switch to pkgs.fetchurl from Nixpkgs configured with impureEnvVars and curlOpts for authenticated fetches.

How to confirm the fix worked

Confirm Nix version is at least 2.18.8 or 2.24.8, test fetchurl derivations against known-good HTTPS endpoints with invalid certificates to ensure rejection, and review netrc/impureEnvVars usage for continued exposure.

Typical attack path

  1. Establish network position for traffic interception
  2. Trigger or observe Nix fetch operations using builtin:fetchurl or TOFU workflows
  3. Present spoofed TLS certificate during HTTPS handshake
  4. Extract credentials from netrc files or environment variables
  5. Inject arbitrary or malicious store objects accepted by the client

How to detect it

Review build logs for fetchurl operations lacking certificate validation warnings, inspect netrc access timestamps during package fetches, and correlate unexpected store object additions with network MITM indicators such as anomalous TLS handshakes.

What your security team should do

  • Immediately upgrade all Nix installations to the fixed versions
  • Audit and restrict use of netrc files and impureEnvVars in derivations
  • Prefer pkgs.fetchurl from Nixpkgs for new dependency fetching
  • Monitor network paths used by build agents for unexpected certificate errors or store injections

The record

Nix is a package manager for Linux and other Unix systems. Starting in version 1.11 and prior to versions 2.18.8 and 2.24.8, `<nix/fetchurl.nix>` did not verify TLS certificates on HTTPS connections. This could lead to connection details such as full URLs or credentials leaking in case of a man-in-the-middle (MITM) attack. `<nix/fetchurl.nix>` is also known as the builtin derivation builder `builtin:fetchurl`. It's not to be confused with the evaluation-time function `builtins.fetchurl`, which was not affected by this issue. A user may be affected by the risk of leaking credentials if they have a `netrc` file for authentication, or rely on derivations with `impureEnvVars` set to use credentials from the environment. In addition, the commonplace trust-on-first-use (TOFU) technique of updating dependencies by specifying an invalid hash and obtaining it from a remote store was also vulnerable to a MITM injecting arbitrary store objects. This also applied to the impure derivations experimental feature. Note that this may also happen when using Nixpkgs fetchers to obtain new hashes when not using the fake hash method, although that mechanism is not implemented in Nix itself but rather in Nixpkgs using a fixed-output derivation. The behavior was introduced in version 1.11 to make it consistent with the Nixpkgs `pkgs.fetchurl` and to make `<nix/fetchurl.nix>` work in the derivation builder sandbox, which back then did not have access to the CA bundles by default. Nowadays, CA bundles are bind-mounted on Linux. This issue has been fixed in Nix 2.18.8 and 2.24.8. As a workaround, implement (authenticated) fetching with `pkgs.fetchurl` from Nixpkgs, using `impureEnvVars` and `curlOpts` as needed.

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 nix 0 No fix
Debian:12 nix 0 No fix
Debian:13 nix 0 2.24.8+dfsg-1
Debian:14 nix 0 2.24.8+dfsg-1
Ubuntu:22.04:LTS nix 0 No fix
Ubuntu:24.04:LTS nix 0 No fix
Ubuntu:24.10 nix 0 No fix
Ubuntu:Pro:22.04:LTS nix 0 2.6.0+dfsg-3ubuntu0.1~esm1
Ubuntu:Pro:24.04:LTS nix 0 2.18.1+dfsg-1ubuntu5+esm2

Related vulnerabilities