SnailSploit/CVE-2026-32809
GitHub: SnailSploit/CVE-2026-32809
详细记录了 ouch 工具在 tar 解压时未校验符号链接目标路径的漏洞原理、攻击链与修复建议。
Stars: 0 | Forks: 0
# CVE-2026-32809:ouch-org/ouch Tar 解压中的符号链接目标未验证漏洞 (CVSS 7.4 高危)





**关键词:** symlink, tar extraction, path traversal, CWE-59, ouch, Rust, archive
## 目录
- [概述](#overview)
- [漏洞详情](#vulnerability-details)
- [技术分析](#technical-analysis)
- [攻击链](#attack-chain)
- [影响](#impact)
- [修复方案](#remediation)
- [CVSS v3.1 指标](#cvss-v31-metrics)
- [时间线](#timeline)
- [参考链接](#references)
- [联系方式](#contact)
- [免责声明](#disclaimer)
## 概述
`ouch-org/ouch`(一款基于 Rust 的压缩/解压工具)中存在链接解析不当漏洞,在创建 tar 归档中的符号链接之前,未对符号链接目标进行验证。`src/utils/fs.rs` 中的 `create_symlink()` 函数将用户可控的符号链接目标直接传递给 `std::os::unix::fs::symlink()`,未进行任何路径验证,而普通文件名则由 tar-rs 进行验证。
- **包名:** `ouch` (Rust/cargo)
- **受影响版本:** <= 0.6.1
- **已修复版本:** 无(待定)
## 漏洞详情
`src/archive/tar.rs` 中的 tar 解压代码通过调用 `create_symlink(&target, &full_path)` 来处理符号链接,其中 `target` 直接来自 `entry.link_name()`,未进行任何验证。普通文件使用 `entry.unpack_in(output_folder)`,该函数委托给 tar-rs 的内置路径验证。
**不对称性在于:** 普通文件名由 tar-rs 验证,但符号链接目标是手动解压的,从而绕过了所有库保护机制。
## 技术分析
### 漏洞代码 (`src/utils/fs.rs`)
```
pub fn create_symlink(target: &Path, full_path: &Path) -> Result<()> {
#[cfg(unix)]
std::os::unix::fs::symlink(target, full_path)?;
#[cfg(windows)]
std::os::windows::fs::symlink_file(target, full_path)?;
Ok(())
}
```
未对 `target` 进行验证 —— 绝对路径和 `../` 遍历路径可以直接通过。
## 攻击链
```
+---------------------------------------------------+
| Symlink Escape in ouch tar extraction |
+---------------------------------------------------+
| |
| 1. Attacker crafts malicious tar.gz with: |
| Entry: data/config (symlink) |
| Target: ../../secret-data/credentials.txt |
| |
| 2. Victim runs: |
| ouch decompress malicious.tar.gz -d /tmp/out |
| |
| 3. create_symlink() called with NO validation |
| - No absolute path check |
| - No ../ traversal check |
| - No containment verification |
| |
| 4. Symlink resolves OUTSIDE extraction dir |
| -> reads arbitrary files on disk |
| |
+---------------------------------------------------+
```
## 影响
能够向运行 ouch 的用户提供精心构造的 tar 归档文件的攻击者,可以创建指向任意文件系统位置的符号链接,从而导致:
- **读取敏感文件**(`~/.ssh/id_rsa`、`~/.aws/credentials`)
- **访问包含** API token 的配置文件
- **读取系统文件**(如果以 root 身份运行,可读取 `/etc/passwd`、`/etc/shadow`)
所有基于 tar 的格式均受影响:`.tar`、`.tar.gz`、`.tar.bz2`、`.tar.xz`、`.tar.lz4`、`.tar.lzma`、`.tar.sz`、`.tar.zst`。
## 修复方案
- 在调用 `create_symlink()` 之前**验证符号链接目标** —— 拒绝绝对路径,并解析相对路径目标以确保它们保持在解压目录内
- **或者**,对符号链接也使用 `entry.unpack_in(output_folder)`,在所有条目类型中一致地应用 tar-rs 的内置验证
## CVSS v3.1 指标
| 指标 | 值 |
|--------|-------|
| **攻击向量** | 网络 |
| **攻击复杂度** | 低 |
| **所需权限** | 无 |
| **用户交互** | 需要 |
| **范围** | 已更改 |
| **机密性** | 高 |
| **完整性** | 无 |
| **可用性** | 无 |
| **CVSS 向量** | `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N` |
| **评分** | **7.4 (高危)** |
## 时间线
| 日期 | 事件 |
|------|-------|
| 2026-03-15 | 通过 GitHub PVRT 报告漏洞 |
| 2026-03-15 | 维护者接受了报告 |
| 2026-03-16 | 由 GitHub 分配 CVE-2026-32809 |
## 参考链接
- [GHSA-pcw6-cg54-qvm8](https://github.com/ouch-org/ouch/security/advisories/GHSA-pcw6-cg54-qvm8)
- [CVE-2026-32809](https://www.cve.org/CVERecord?id=CVE-2026-32809)
- [CWE-59:文件访问前链接解析不当](https://cwe.mitre.org/data/definitions/59.html)
## 联系方式
- **网站:** [snailsploit.com](https://snailsploit.com)
- **GitHub:** [@SnailSploit](https://github.com/SnailSploit)
- **LinkedIn:** [/in/kaiaizen](https://linkedin.com/in/kaiaizen)
## 免责声明
本仓库作为负责任漏洞披露的一部分,仅用于教育和防御目的发布。该漏洞是通过 GitHub Private Vulnerability Reporting (PVRT) 报告的。未对生产系统进行任何利用。所有测试均在隔离环境中进行。
标签:0-day, Cargo, CVE-2026-32809, CVSS 7.4, CWE-59, ouch, PE 加载器, Rust, Tar提取, Unix安全, 可视化界面, 文件系统, 漏洞分析, 目录穿越, 符号链接漏洞, 网络流量审计, 解压缩工具, 路径探测, 路径遍历, 链接解析不当