Spring Web UricomponentsBuilder URL解析不当漏洞 怎么解决

Blade 未结 2 363
大葱
大葱 剑童 2024-06-17 14:36

一、该问题的重现步骤是什么?

1. Spring Web UricomponentsBuilder URL解析不当漏洞(CVE-2024-22243)

2. 只需要升级spring - web 版本能解决?

3. 


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。

2条回答
  • 2024-06-17 15:04

    手动升级spring的依赖,或者使用最新版bladex,bladex最新版为6.1.5,采用的版本已经不存在这个漏洞了

    CleanShot20240617150427@2x.png

    CleanShot20240617151838@2x.png




    低版本Spring升级参考如下配置:

    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        
        <!-- 项目基本信息等其他元素... -->
    
        <dependencyManagement>
            <dependencies>
                <!-- Spring Framework BOM -->
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-framework-bom</artifactId>
                    <version>5.3.32</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
    
                <!-- 其他依赖管理项 -->
            </dependencies>
        </dependencyManagement>
    
        <!-- 实际的依赖声明... -->
    </project>


    作者追问:2024-06-17 17:02

    blade 版本 

    2.9.1.RELEASE

    spring boot 版本2.3.12.RELEASE

    spring-web-5.2.15.RELEASE.jar截图_20240617170056.png


    想替换spring-web 相关版本到6.1.6  

    想知道具体操作方法和可行性

    回答: 2024-06-17 17:04

    只建议更新到5.3.32,如果要6.x,需要全体工程大改。

    作者追问:2024-06-17 17:07

    如果更新到5.3.32版本,具体需要怎么操作?

    回答: 2024-06-17 17:14

    项目根目录pom.xml配置Spring的版本,强制覆盖就行了

    作者追问:2024-06-18 16:00

    image.png

    image.png

    升级spring版本到5.3.32后 无法调用获取验证码接口

    回答: 2024-06-18 16:10

    检查AbstractReadWniteJackson2HttpMessaqeConventer,检查相关工具类是不是版本需要升级

    作者追问:2024-06-19 08:58

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutorBuilder' defined in class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.task.TaskExecutorBuilder]: Factory method 'taskExecutorBuilder' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutorCustomizer' defined in class path resource [org/springblade/core/boot/config/BladeExecutorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.task.TaskExecutorCustomizer]: Illegal arguments to factory method 'taskExecutorCustomizer'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.task.TaskExecutorBuilder]: Factory method 'taskExecutorBuilder' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutorCustomizer' defined in class path resource [org/springblade/core/boot/config/BladeExecutorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.task.TaskExecutorCustomizer]: Illegal arguments to factory method 'taskExecutorCustomizer'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskExecutorCustomizer' defined in class path resource [org/springblade/core/boot/config/BladeExecutorConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.task.TaskExecutorCustomizer]: Illegal arguments to factory method 'taskExecutorCustomizer'; args: ; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class

    image.png

    image.png

    image.png

    spring-boot-2.3.12.RELEASE

    spring-web 5.3.32

    启动项目报错,想以最小的改动,解决springweb版本异常问题

    回答: 2024-06-19 09:35

    我查了下,bladex 2.9.1 依赖的spring版本为5.2.15,不在这个漏洞范围内,所以你都不需要修复了。

    CleanShot20240619093346@2x.png

    回答: 2024-06-19 09:40

    另外关于框架本身的安全部署问题,推荐看下这个文档:https://center.javablade.com/blade/BladeX-Safety 

    把一些安全隐患解决,基本就不会受其他漏洞影响了,因为第一层token认证都过不去的。

    0 讨论(0)
  • 2024-06-19 09:48

    image.png

    问题:漏洞是阿里云扫描出来的,且定位是这个版本的问题。

    障碍:目前分析,如果修复的话只能提升版本,但是强制更新后初步定位是与springboot版本不兼容,导致项目无法启动

    期望:想以最小的代价把这个漏洞避免掉,是否有比较高效的方法?

    作者追问:2024-06-19 10:27

    只能升级spring的版本,然后每个进行依赖适配。注意bladex-tool的版本也需要修改,修改后适配完工具类的依赖问题。然后执行mvn clean install安装。接着再修改bladex的依赖,最后解决spring相关升级版本的问题。


    如果解决不了可以找我们官方进行有偿定制升级,联系邮箱 bladejava@qq.com

    0 讨论(0)
提交回复