1. 漏洞通知
早上醒来就看到腾讯云发的漏洞通知的邮件,虽然是个人项目也得赶紧处理一下。
首先看看CVE-2024-24549
这个漏洞是什么,有什么影响。
可以看到对这个漏洞的描述。
Denial of Service due to improper input validation vulnerability for HTTP/2 requests in Apache Tomcat. When processing an HTTP/2 request, if the request exceeded any of the configured limits for headers, the associated HTTP/2 stream was not reset until after all of the headers had been processed.This issue affects Apache Tomcat: from 11.0.0-M1 through 11.0.0-M16, from 10.1.0-M1 through 10.1.18, from 9.0.0-M1 through 9.0.85, from 8.5.0 through 8.5.98. Users are recommended to upgrade to version 11.0.0-M17, 10.1.19, 9.0.86 or 8.5.99 which fix the issue.
这是Apache Tomcat的一个拒绝服务(DoS)漏洞,是由于HTTP/2请求处理过程中输入验证不当所导致的。具体来说,当Tomcat在处理HTTP/2请求时,如果请求中包含超出配置限制的头部信息,相关的HTTP/2流不会被及时重置,直到所有头部信息都被处理完毕。
此漏洞影响了多个版本的Apache Tomcat,包括但不限于以下版本:
从11.0.0-M1到11.0.0-M16
从10.1.0-M1到10.1.18
从9.0.0-M1到9.0.85
从8.5.0到8.5.98
官方建议用户升级至已修复该问题的版本,这些版本分别是:
Apache Tomcat 11.0.0-M17
Apache Tomcat 10.1.19
Apache Tomcat 9.0.86
Apache Tomcat 8.5.99
2. 项目自检
项目是一个SpringBoot项目,服务器使用的是默认的Tmcat,Springboot版本是2.6.13。
通过命令mvn dependency:tree | grep tomca
t查看项目中Tomcat的版本是9.0.68,刚好在受影响的范围内。
然后我们打开maven
仓库搜一搜,看看spring-boot-starter-tomcat
在哪个版本修复了这个漏洞。
可以看到一直到版本3.3.7,所有无漏洞的版本,Tomcat的版本是10.1.34,不在受影响的版本范围内,可行。
3. 解决
3.1 修改http2配置
关闭http2(默认就是false),但这么做腾讯云还是会告警。
application.yaml
server:
http2:
enabled: false
3.2 修改tomcat版本
pom.xml
<properties>
<tomcat.version>10.1.34</tomcat.version>
</properties>
3.3 修改springboot的版本
pom.xml
<properties>
<spring-boot.version>3.3.7</spring-boot.version>
</properties>
以上。