Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsChecklistsAI RankingsNewsletterStatusTagsAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Checklists
AI Rankings
Newsletter
Status
Tags
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

629+ Articles
118+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Security
  3. CVE-2026-39860: Nix Symlink Attack Allows Root File Overwrite
CVE-2026-39860: Nix Symlink Attack Allows Root File Overwrite

Critical Security Alert

This vulnerability is actively being exploited. Immediate action is recommended.

SECURITYCRITICALCVE-2026-39860

CVE-2026-39860: Nix Symlink Attack Allows Root File Overwrite

A bypass of the CVE-2024-27297 patch in the Nix package manager allows attackers to follow symlinks during fixed-output derivation builds, enabling arbitrary overwrite of files writable by the Nix daemon — typically running as root in multi-user installations.

Dylan H.

Security Team

April 9, 2026
5 min read

Affected Products

  • Nix (multi-user installations, daemon running as root)

Executive Summary

A critical vulnerability (CVE-2026-39860, CVSS 9.0) has been disclosed in the Nix package manager that effectively bypasses the previously issued fix for CVE-2024-27297. The flaw allows an attacker to exploit symlink following during fixed-output derivation builds, enabling arbitrary overwrite of files writable by the Nix orchestration process — typically the Nix daemon running as root in multi-user installations.

This is a significant regression in the security posture of Nix environments: organizations that applied the CVE-2024-27297 patch believed they were protected against this class of symlink-based attacks, but the new vulnerability demonstrates that the fix was incomplete.


Vulnerability Overview

AttributeValue
CVE IDCVE-2026-39860
CVSS Score9.0 (Critical)
Related CVECVE-2024-27297 (bypassed)
CWECWE-61 — UNIX Symbolic Link Following
TypeSymlink Attack / Arbitrary File Overwrite
Attack VectorLocal / Build-time
Privileges RequiredLow (build process access)
User InteractionNone
Patch AvailableSee upstream advisory

Affected Versions

SoftwareConditionImpact
Nix (multi-user)Daemon running as rootArbitrary file overwrite as root
Nix (single-user)User-level daemonFile overwrite as that user

Background: CVE-2024-27297

CVE-2024-27297 was a previous vulnerability in Nix that allowed attackers to exploit symlink following during build processes. The patch introduced checks intended to prevent the Nix daemon from following attacker-controlled symlinks when writing output files during fixed-output derivation builds.

CVE-2026-39860 demonstrates that this fix contained a logic flaw that can be bypassed under specific conditions, restoring the original attack surface.


Technical Analysis

Root Cause

The vulnerability lies in Nix's handling of fixed-output derivations — a special class of builds where the output hash is known in advance. During these builds, the Nix daemon writes output to a store path, and the corrective logic from CVE-2024-27297 was intended to prevent symlink traversal during this write process.

The bug in the fix allows an attacker to race or pre-place symlinks such that the Nix daemon resolves them after the security check but before the actual write operation — a classic Time-Of-Check to Time-Of-Use (TOCTOU) vulnerability.

Attack Flow

1. Attacker submits or triggers a fixed-output derivation build
2. Nix daemon performs symlink safety check on target path (CVE-2024-27297 fix)
3. Attacker races to replace or insert a symlink at the target location
   after the check but before the write
4. Nix daemon writes output data to the attacker-controlled symlink destination
5. File owned by root (daemon) is overwritten with attacker-supplied content
6. Attacker achieves privilege escalation or persistence via overwritten system file

Exploitation Conditions

  • Multi-user Nix installation where the daemon runs as root is the highest-risk configuration
  • Attacker must be able to trigger a fixed-output derivation build (e.g., via nix-build, Nix flakes, or NixOS package builds)
  • A local account with ability to run Nix builds is sufficient
  • TOCTOU windows are narrow but automatable

Impact Assessment

Impact AreaDescription
Root File OverwriteOverwrite any file writable by the Nix daemon (typically root-owned system files)
Privilege EscalationOverwrite /etc/passwd, sudoers, or cron files to gain root shell
PersistencePlant backdoors in system binaries or service files
Integrity ViolationCorrupt the Nix store or system configuration
Supply Chain RiskIn CI/CD pipelines, compromise build outputs for downstream consumers

Remediation

Step 1: Check Your Nix Installation Mode

# Determine if running in multi-user (daemon) mode
ls -la /nix/var/nix/daemon-socket/
# If this socket exists, you are in multi-user mode
 
# Check daemon ownership
ps aux | grep nix-daemon

Step 2: Apply the Upstream Patch

Monitor the official Nix releases and security advisories for a patched version addressing CVE-2026-39860:

# Update Nix via the official installer (single-user)
nix upgrade-nix
 
# For NixOS, update your system channel and rebuild
sudo nix-channel --update
sudo nixos-rebuild switch
 
# Check current Nix version
nix --version

Step 3: Restrict Build Permissions as a Temporary Mitigation

# Limit which users can trigger Nix daemon builds
# Edit /etc/nix/nix.conf to restrict build users
# Add specific users to the trusted-users list
trusted-users = root @wheel
 
# Disable untrusted builds until patched
# In /etc/nix/nix.conf:
# allowed-users = root

Step 4: Audit for Compromise

# Check recently modified root-owned system files
find /etc /usr/bin /usr/sbin -newer /etc/nixos/configuration.nix -type f 2>/dev/null | head -30
 
# Review Nix daemon logs
journalctl -u nix-daemon --since "7 days ago" | grep -i "error\|warning\|symlink"
 
# Check Nix store integrity
nix-store --verify --check-contents

Detection Indicators

IndicatorDescription
Unexpected file modifications in /etc or /usrPossible post-exploitation file overwrite
Nix daemon logs showing symlink resolution errorsExploitation attempts
TOCTOU race condition patterns in build logsActive exploitation
Unexplained changes to cron files or sudoersPrivilege escalation attempt
Build processes accessing paths outside Nix storeSuspicious derivation behavior

Post-Remediation Checklist

  1. Apply the upstream Nix patch for CVE-2026-39860 as soon as it is released
  2. Restrict trusted-users in /etc/nix/nix.conf to minimize who can trigger daemon builds
  3. Audit system files for unauthorized modifications, particularly in /etc and /usr
  4. Review build logs for evidence of TOCTOU race patterns or symlink anomalies
  5. Disable fixed-output derivation builds from untrusted users as a temporary mitigation
  6. Monitor the Nix security mailing list for patch availability
  7. Enable file integrity monitoring on critical system paths
  8. Restrict local user accounts that have access to nix-build or nix develop

References

  • NVD — CVE-2026-39860
  • NVD — CVE-2024-27297 (original vulnerability)
  • Nix Security Advisories — GitHub
#CVE-2026-39860#CVE-2024-27297#Nix#Linux#Symlink Attack#Privilege Escalation#Package Manager#Security Updates

Related Articles

CVE-2026-4498: Kibana Fleet Plugin Privilege Escalation Exposes Elasticsearch Index Data

A high-severity privilege escalation flaw in Kibana's Fleet plugin debug route handlers allows authenticated users with limited Fleet sub-feature privileges to read Elasticsearch index data beyond their RBAC scope via CWE-250 and CAPEC-122.

5 min read

CVE-2026-4003: WordPress Users Manager PN Plugin Privilege Escalation (CVSS 9.8)

A critical privilege escalation vulnerability in the Users Manager – PN WordPress plugin (v1.1.15 and below) allows unauthenticated attackers to update arbitrary user meta and take over any account, including administrators.

5 min read

CVE-2026-1114: lollms JWT Weak Secret Key Allows Admin Takeover

A critical vulnerability (CVSS 9.8) in parisneo/lollms v2.1.0 allows attackers to brute-force the application's JWT secret key offline, forge authentication tokens, and escalate privileges to administrator without valid credentials.

6 min read
Back to all Security Alerts