Spring Cloud Config 安全更新:CVE-2026-22739 修复

5 阅读2分钟

发布日期: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 参数进行路径替换,从而:

  1. 访问配置目录之外的文件 — 可能泄露敏感信息
  2. 发起SSRF攻击 — 通过配置服务器访问内部资源

受影响条件:

条件说明
后端类型native(本地文件系统)
配置方式profile 参数来自请求
攻击向量恶意构造的 profile 参数

三、影响版本

版本线受影响版本修复版本
5.0.x< 5.0.25.0.2
4.3.x< 4.3.24.3.2
4.2.x< 4.2.64.2.6
4.1.x< 4.1.94.1.9
3.1.x< 3.1.133.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
解决方案升级到修复版本
紧急程度建议尽快升级