downloadBlobToFile 路径遍历用于同一 Apache Camel 漏洞的可运行概念验证(PoC)复现程序,每种运行时一个:
| 运行时 | 目录 | 技术栈 |
|---|---|---|
| Camel Spring Boot | camel-spring-boot/ | Spring Boot 3.5.13 + camel-azure-storage-blob 4.18.2 |
| Camel Quarkus | camel-quarkus/ | Quarkus 3.36.0 + Camel Quarkus 3.36.0(内置 Camel 4.20.0) |
这两个都是受影响的版本(该问题已在 4.14.9 / 4.18.4 / 4.22.0 中修复),并且二者展示了完全相同的缺陷:camel-azure-storage-blob 消费者将容器 blob 下载到本地文件系统中由 fileDir 选项指定的目录,构建本地目标路径为 new File(fileDir, client.getBlobName()) —— 即 Azure SDK 报告的确切远程 blob 名称,没有任何规范化,也没有检查解析后的位置是否仍在 fileDir 内。blob 名称不受路由控制:消费者列出容器(BlobConsumer.createBatchExchangesFromContainer)并下载所有 blob。因此,名称中包含 ../ 片段的 blob 会被写入 fileDir 之外(CWE-22,路径遍历 → 任意文件写入)。
每个子目录都是自包含的(包含自己的 Dockerfile、用于启动 Azurite 模拟器的 docker-compose.yml 和 README)。简而言之,任选其一:
cd camel-spring-boot # or: cd camel-quarkus
mvn clean package
docker compose up -d --build
curl -s http://localhost:8080/exploit/attack
docker compose down
受影响构建(两种变体)的预期输出:
Files inside the intended download directory /app/downloads:
- report.txt
File written OUTSIDE it, at /tmp/pwned-66906.txt: true
content: PWNED via path traversal — CVE-2026-66906
>>> PROVEN: the blob name's ../ segments escaped the configured fileDir directory ... : true
公告:https://camel.apache.org/security/CVE-2026-66906.html
消费者现在通过 AzureFileNameHelper.resolveWithinDirectory 将下载目标解析并限制在配置的 fileDir 目录内,拒绝会逃逸该目录的 blob 名称。相同的修复也覆盖了同级组件 camel-azure-storage-datalake(CVE-2026-60093)。
本仓库的发布旨在教育和防御目的:帮助 Apache Camel 用户理解该漏洞、验证自己是否受影响,并确认升级能够解决该问题。写入的文件是位于 /tmp 下的良性标记文件。请勿将本材料用于攻击您不拥有或无权操作的系统。
| 属性 | 值 |
|---|
| 组件 | camel-azure-storage-blob(Spring Boot:camel-azure-storage-blob-starter;Quarkus:camel-quarkus-azure-storage-blob) |
| CWE | CWE-22(对受限目录的路径名限制不当 — 路径遍历) |
| 攻击向量 | 名称包含 ../ 片段的容器 blob,由设置了 fileDir 的消费者下载 |
| 影响 | 在配置的 fileDir 目录之外进行任意文件写入 |
| 受影响版本 | 4.0.0 至 4.14.9 之前,4.15.0 至 4.18.4 之前,4.19.0 至 4.22.0 之前 |
| 修复版本 | 4.14.9、4.18.4、4.22.0 |
| JIRA | CAMEL-23942 |
| 致谢 | n0mi1k;Hiep Nguyen |