Long-Running-Action 头劫持 saga针对 Apache Camel 漏洞的可运行概念验证复现程序。在该漏洞中,camel-core 的 SagaProcessor 会从每个 exchange 上的 Long-Running-Action 消息头中选择 saga 协调器。该头名称不带 Camel 前缀,因此位于消费者头过滤器所剥离的命名空间之外——外部发送者可以在入站消息上提供该头,从而指定其 exchange 加入哪个 saga,将他们的请求附加到由他人启动的长时间运行操作上(或将补偿与他们并未发起的操作关联起来)。该暴露面仅限于运行 saga 的部署,但在适用的情况下,发送者控制 exchange 属于哪个 saga(CWE-20)。
| 运行时 | 目录 | 技术栈 |
|---|---|---|
| Camel Spring Boot | camel-spring-boot/ | Spring Boot 3.5.13 + camel-spring-boot 4.22.0(受影响;修复版本 4.22.1) |
| Camel Quarkus | camel-quarkus/ | Quarkus 3.39.0 + camel-quarkus-saga(Camel 4.22.0,受影响;修复对照 CQ 3.40.0 / Camel 4.22.1) |
两个模块都针对真实的 camel-core SagaProcessor 演示了受影响和修复后的行为。
该驱动程序仿照修复自身的回归测试(SagaHeaderCannotSelectCoordinatorTest)。它构建一条 saga 路由
from("direct:…").saga().propagation(MANDATORY),其后端是一个内存 saga 服务,该服务记录它被要求解析的每一个 id,然后发送一个携带入站头 Long-Running-Action = a-saga-id-from-the-wire 的 exchange——即外部发送者会放在线上的 id。判定标准很简单,就是哪些 saga id 到达了服务:
a-saga-id-from-the-wire——消息选择了协调器。在两种构建中,MANDATORY exchange 最终都会失败(没有真正可加入的 saga)——该漏洞不在于失败,而在于攻击者选择的 id 被用于选择协调器,这就是为什么判定标准关注的是查找而非结果。
# Camel Spring Boot
cd camel-spring-boot
mvn clean package
docker compose up -d --build
curl -s http://localhost:8080/exploit/attack # affected: wire id looked up = true; >>> PROVEN
docker compose down
# Patched control
mvn clean package -Dcamel.version=4.22.1
java -jar target/cve-2026-85312-saga-header-hijack-0.0.1-SNAPSHOT.jar &
curl -s http://localhost:8080/exploit/attack # fixed: wire id looked up = false; >>> Not exploited
# Camel Quarkus
cd camel-quarkus
mvn clean package
docker compose up -d --build
curl -s http://localhost:8080/exploit/attack # affected (Camel 4.22.0): wire id looked up = true
docker compose down
# Patched control: CQ 3.40.0 ships Camel 4.22.1
mvn clean package -Dcamel-quarkus.version=3.40.0 -Dquarkus.platform.version=3.40.0
java -jar target/quarkus-app/quarkus-run.jar &
curl -s http://localhost:8080/exploit/attack # fixed: wire id looked up = false
| 属性 | 值 |
|---|---|
| 组件 | camel-core(SagaProcessor.getCurrentSagaCoordinator) |
| CWE | CWE-20(输入验证不当) |
| 严重性 | 中危 |
| 攻击向量 | 外部发送者在发往运行 saga EIP 的路由的入站消息上提供无前缀的 Long-Running-Action 头 |
| 影响 | 发送者指定 exchange 加入的 saga——从而附加到另一方的长时间运行操作,或错误关联补偿 |
| 受影响版本 | 从 4.0.0 起至 4.18.5 之前,从 4.19.0 起至 4.22.1 之前 |
| 修复版本 | 4.18.5、4.22.1、4.23.0 |
| JIRA | CAMEL-24449 |
| 致谢 | Claude Security Scan Tool |
公告:https://camel.apache.org/security/CVE-2026-85312.html
受影响的 Quarkus 模块基于 CQ 3.39.0(Camel 4.22.0)构建。修复后的控制版本为 CQ 3.40.0(Camel 4.22.1)。
SagaProcessor 现在仅当 saga 服务通过新增的
CamelSagaService.isLongRunningActionHeaderSupported() 声明其参与此类协议时,才会参考 Long-Running-Action 头
(默认值为 false;LRA 服务将其覆盖为 true)。内部 exchange 状态——可经受 removeHeaders("*") 而保留——仍是
saga id 的常规载体,因此消息不再能为不运行任何外部协调器的服务选择协调器。
在每个接受来自不受信任发送者消息的消费者上,使用 removeHeaders("Long-Running-Action") 在信任边界处剥离该头。
本仓库出于教育和防御目的发布:帮助 Apache Camel 用户理解该漏洞、验证自身是否受影响,并确认升级可解决该问题。演示在进程内使用内存 saga 服务运行 saga 路由;“攻击者”的 saga id 是一个无害的占位字符串。请勿将本材料用于您不拥有或运营的系统。