CVE-2024-45593
NoneCVSS
—
EPSS
0.6%
Published
Sep 10, 2024
CISA due date
—
Cloudanix analysis
A flaw in the Nix package manager lets attackers overwrite important system files when it installs software, which could let them take over the computer.
- Exploitation
- Supply Chain
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Full Compromise
- Component
- Application
- Class
- Path Traversal
- Remediation
- Upgrade
- Effort
- Low
- Patch risk
- Low
What it actually does
Path traversal in NAR unpacking allows writing to arbitrary filesystem paths with the privileges of the Nix process, including root via the daemon.
Why it matters to the business
Attackers can overwrite critical system files, install persistent malware, or disrupt package management across Unix environments, leading to full host compromise and operational downtime.
How an attack unfolds
An attacker acting as a substituter or supplying a malicious NAR crafts a specially formed archive that exploits insufficient path validation during unpacking; when Nix processes the NAR, it writes attacker-controlled content to chosen locations outside the intended store, potentially replacing binaries or configuration with root privileges.
How to fix it
Upgrade Nix to version 2.24.6 or later; for nixos/nix apply commit eb11c1499876cd4c9c188cbda5b1003b36ce2e59. Restrict untrusted substituters and review NAR sources until patched.
How to confirm the fix worked
Confirm Nix reports version 2.24.6 or newer; test unpacking of known-good NARs in a sandbox and verify no writes occur outside the Nix store.
Typical attack path
- Register a malicious substituter or serve a crafted NAR to a target Nix installation
- Trigger package fetch or build that causes Nix to unpack the NAR
- Exploit path traversal to write files to arbitrary locations such as /etc or /root
- Achieve persistence or privilege escalation by replacing system binaries or startup scripts
How to detect it
Review Nix daemon and build logs for NAR unpacking events that reference unexpected paths; look for file modification timestamps on system directories that coincide with package operations.
What your security team should do
- Immediately upgrade all Nix installations to the fixed version
- Audit and restrict substituter configurations to trusted sources only
- Monitor package build and fetch logs for unexpected file writes
The record
Nix is a package manager for Linux and other Unix systems. A bug in Nix 2.24 prior to 2.24.6 allows a substituter or malicious user to craft a NAR that, when unpacked by Nix, causes Nix to write to arbitrary file system locations to which the Nix process has access. This will be with root permissions when using the Nix daemon. This issue is fixed in Nix 2.24.6.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| 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
- CVE-2024-47174 Nix is a package manager for Linux and other Unix systems. Also affects nix
- CVE-2024-45845 Rejected reason: DO NOT USE THIS CVE RECORD. Also affects nix
- CVE-2024-38531 Nix is a package manager for Linux and other Unix systems that makes package management… Also affects nix
- CVE-2024-36050 Nix through 2.22.1 mishandles certain usage of hash caches, which makes it easier for… Also affects nix