{"id":"CVE-2026-64846","summary":"Nix: Arbitrary file truncation outside the sandbox with recursive-nix experimental feature","details":"Nix is a package manager for Linux and other Unix systems. Prior to 2.35.0, a malicious derivation executed with the recursive-nix experimental feature can exploit a time-of-check/time-of-use race involving final symlink handling in the LocalStore restore path. The race can cause writeFile to follow a substituted final symlink when opening a path with O_TRUNC instead of enforcing FinalSymlink::DontFollow, allowing the Nix process or nix-daemon to create or truncate an empty file outside the build sandbox with the daemon user's permissions. The primitive does not provide arbitrary-content writes and requires winning the race. This issue is fixed in version 2.35.0.","aliases":["GHSA-6h4g-g5j9-fm5f"],"modified":"2026-08-22T09:15:58.301082Z","published":"2026-08-20T16:18:06.729Z","database_specific":{"cna_assigner":"GitHub_M","cwe_ids":["CWE-367","CWE-61"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/64xxx/CVE-2026-64846.json"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/64xxx/CVE-2026-64846.json"},{"type":"ADVISORY","url":"https://github.com/NixOS/nix/security/advisories/GHSA-6h4g-g5j9-fm5f"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-64846"},{"type":"FIX","url":"https://github.com/NixOS/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390"},{"type":"FIX","url":"https://github.com/NixOS/nix/pull/15401"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/nixos/nix","events":[{"introduced":"0"},{"fixed":"26679828f74ee6e82a4100904e6361f993ff5390"}],"database_specific":{"extracted_events":[{"introduced":"0"},{"fixed":"2.35.0"}],"source":["AFFECTED_FIELD","REFERENCES"]}}],"versions":["2.2","2.0","1.11.1","1.11","1.10","1.9","1.8","1.7","1.6.1","1.6","1.5.3","1.5.2","1.5.1","1.5","1.4","1.3","1.2","1.1","1.0"],"database_specific":{"vanir_signatures":[{"signature_version":"v1","source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390","target":{"file":"src/libutil/file-content-address.cc"},"deprecated":false,"digest":{"threshold":0.9,"line_hashes":["261979631496515240248091455680768272313","337684205262061194091550388858098463224","175336703321281864924138511037861303941","204873868654664549407135874780977676669"]},"id":"CVE-2026-64846-10508b31","signature_type":"Line"},{"target":{"file":"src/libutil/file-content-address.cc","function":"restorePath"},"deprecated":false,"digest":{"function_hash":"200093320886713666658772408323425904950","length":283},"id":"CVE-2026-64846-5796f6c8","signature_type":"Function","signature_version":"v1","source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390"},{"target":{"file":"src/libutil/include/nix/util/file-system.hh"},"deprecated":false,"digest":{"line_hashes":["173738584817477232377379188695496152279","210173992075291704696796629754366998363","89193794086563001525686165590918125239","177344224614619445062012904981437863625","197431063365938691274197682413401278871"],"threshold":0.9},"id":"CVE-2026-64846-7797733f","signature_type":"Line","signature_version":"v1","source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390"},{"signature_type":"Line","signature_version":"v1","source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390","target":{"file":"src/libutil/file-system.cc"},"deprecated":false,"digest":{"line_hashes":["181433945287688630887079180450237822480","298768339959756682046668857855529876019","199913190282373090463987298379080102386","223982893473382833425433455567421244497","301554380220323015514189563845575395728","37698757318052831710539673055272207948","327858329302783577538962900164136398853","48763889986751110118470305394524384024","211778956030963276645783390381935941030","319128749599322447418255390817269565455","82149067837396961012261524849591608315","28225169153634510548732115067309804265","171623742820104426674277692888705431779","322741862754296487941477772910968378530","199108554311106513930857924110721111921","301554380220323015514189563845575395728","37698757318052831710539673055272207948","327858329302783577538962900164136398853","48763889986751110118470305394524384024","211778956030963276645783390381935941030","319128749599322447418255390817269565455","82149067837396961012261524849591608315"],"threshold":0.9},"id":"CVE-2026-64846-96d7cd4b"},{"digest":{"function_hash":"307339821807366702887062680923383416549","length":354},"id":"CVE-2026-64846-9d1bb5d7","signature_type":"Function","signature_version":"v1","source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390","target":{"file":"src/libutil/file-system.cc","function":"writeFile"},"deprecated":false},{"source":"https://github.com/nixos/nix/commit/26679828f74ee6e82a4100904e6361f993ff5390","target":{"function":"writeFile","file":"src/libutil/file-system.cc"},"deprecated":false,"digest":{"function_hash":"251257566064089742692957332902399737336","length":718},"id":"CVE-2026-64846-d1885df2","signature_type":"Function","signature_version":"v1"}],"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-64846.json","vanir_signatures_modified":"2026-08-22T09:15:58Z"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N"}]}