发布日期:2026年3月23日 | 严重度:MEDIUM
一、漏洞概述
Spring Cloud Config 发布安全更新,修复了 CVE-2026-22739 漏洞。
| 项目 | 说明 |
|---|---|
| CVE编号 | CVE-2026-22739 |
| 发布日期 | 2026年3月23日 |
| 严重度 | MEDIUM(中危) |
| 影响组件 | Spring Cloud Config Server |
| 漏洞类型 | 文件访问越界、SSRF攻击 |
二、漏洞描述
问题描述:
当 Spring Cloud Config Server 配置使用本地文件系统(native)作为后端时,攻击者可以通过请求中的 profile 参数进行路径替换,从而:
- 访问配置目录之外的文件 — 可能泄露敏感信息
- 发起SSRF攻击 — 通过配置服务器访问内部资源
受影响条件:
| 条件 | 说明 |
|---|---|
| 后端类型 | native(本地文件系统) |
| 配置方式 | profile 参数来自请求 |
| 攻击向量 | 恶意构造的 profile 参数 |
三、影响版本
| 版本线 | 受影响版本 | 修复版本 |
|---|---|---|
| 5.0.x | < 5.0.2 | 5.0.2 |
| 4.3.x | < 4.3.2 | 4.3.2 |
| 4.2.x | < 4.2.6 | 4.2.6 |
| 4.1.x | < 4.1.9 | 4.1.9 |
| 3.1.x | < 3.1.13 | 3.1.13 |
四、修复方案
4.1 Maven依赖升级
5.0.x 版本:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>5.0.2</version>
</dependency>
4.3.x 版本:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>4.3.2</version>
</dependency>
4.2 Gradle依赖升级
implementation 'org.springframework.cloud:spring-cloud-config-server:5.0.2'
4.3 Spring Boot BOM管理
如果使用 Spring Cloud BOM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2025.0.2</version> <!-- 或对应版本 -->
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
五、临时缓解措施
如果暂时无法升级,可采取以下缓解措施:
5.1 限制profile参数
spring:
cloud:
config:
server:
native:
# 限制搜索目录
search-locations: file:/config/{application}
# 禁止profile参数包含路径分隔符
profile-separator: '-'
5.2 添加输入验证
@Configuration
public class ConfigSecurityConfig {
@Bean
public Filter profileValidationFilter() {
return (request, response, chain) -> {
String profile = request.getParameter("profile");
if (profile != null && (profile.contains("..") || profile.contains("/"))) {
((HttpServletResponse) response).sendError(HttpServletResponse.SC_BAD_REQUEST,
"Invalid profile parameter");
return;
}
chain.doFilter(request, response);
};
}
}
5.3 网络隔离
- Config Server 不应直接暴露在公网
- 限制 Config Server 只能被内部服务访问
- 配置防火墙规则
六、安全建议
6.1 配置安全最佳实践
| 建议 | 说明 |
|---|---|
| 使用Git后端 | 相比native,Git后端有更好的访问控制 |
| 启用认证 | Config Server应启用安全认证 |
| 加密敏感配置 | 使用加密存储数据库密码等敏感信息 |
| 最小权限 | Config Server 只读访问配置目录 |
6.2 升级检查清单
- 确认当前使用的 Spring Cloud Config 版本
- 评估是否使用 native 后端
- 升级到修复版本
- 测试配置加载功能
- 检查日志无异常
七、参考链接
| 链接 | 说明 |
|---|---|
| Spring Security Advisory | 官方安全公告 |
| Spring Cloud Config 发布说明 | 版本发布说明 |
八、总结
| 项目 | 内容 |
|---|---|
| 漏洞 | CVE-2026-22739 |
| 风险 | 文件越界访问、SSRF |
| 解决方案 | 升级到修复版本 |
| 紧急程度 | 建议尽快升级 |