1,漏洞详情
漏洞名称:Apache Tomcat 信息泄露漏洞
漏洞编号:CVE-2024-21733
漏洞等级:高危
影响版本:Apache Tomcat 9.0.0-M11 至 9.0.43, Apache Tomcat 8.5.7 至 8.5.63
安全建议:目前该漏洞已经修复,受影响用户可升级到以下版本:
Apache Tomcat >= 9.0.44
Apache Tomcat >= 8.5.64
Apache Tomcat版本9.0.0-M11 - 9.0.43、8.5.7 - 8.5.63中均存在该信息泄露漏洞,由于coyote/http11/Http11InputBuffer.java中在抛出CloseNowException异常后没有重置缓冲区位置和限制,威胁者可可以通过构造特定请求,发送不完整的POST触发错误响应,从而可能导致获取其他用户先前请求的数据,造成信息泄露
2,修复方案
- 下载最新tomcat 依赖包: https://mvnrepository.com
bash
https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-core/9.0.93/tomcat-embed-core-9.0.93.jar
https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-el/9.0.93/tomcat-embed-el-9.0.93.jar
https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.93/tomcat-embed-websocket-9.0.93.jar
https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-jasper/9.0.93/tomcat-embed-jasper-9.0.93.jar
https://repo1.maven.org/maven2/org/apache/tomcat/tomcat-annotations-api/9.0.93/tomcat-annotations-api-9.0.93.jar
解压nacos jar包,替换旧版tomcat依赖包,再重新打包
bash
#1, tomcat 版本确定
[root@test nacos]# jar -tvf target/nacos-server.jar.bak |grep tomcat
405 Mon Oct 12 16:05:02 CST 2020 BOOT-INF/lib/spring-boot-starter-tomcat-2.1.17.RELEASE.jar
270124 Thu Sep 10 09:05:16 CST 2020 BOOT-INF/lib/tomcat-embed-websocket-9.0.38.jar
625262 Tue Jun 30 21:07:10 CST 2020 BOOT-INF/lib/tomcat-embed-jasper-9.0.37.jar
3401538 Thu Sep 10 09:05:16 CST 2020 BOOT-INF/lib/tomcat-embed-core-9.0.38.jar
13342 Thu Sep 10 08:05:16 CST 2020 BOOT-INF/lib/tomcat-annotations-api-9.0.38.jar
259693 Thu Sep 10 09:05:16 CST 2020 BOOT-INF/lib/tomcat-embed-el-9.0.38.jar
#2, 下载高版本tomcat依赖包,进行替换,并重新打包
cd target
mkdir aa
cd aa/
jar -xvf ../nacos-server.jar
mv ../nacos-server.jar ../nacos-server.jar.bak
ll BOOT-INF/lib/tomcat-*
rm -f BOOT-INF/lib/tomcat-*
cp /home/upay/jars/*9.0.93* BOOT-INF/lib/
cp /home/upay/jars/aa/tomcat-* BOOT-INF/lib/
vim BOOT-INF/classpath.idx #修改tomcat依赖包版本号
#jar 参数说明
# -c 创建新档案
# -f 指定档案文件名
# -0 仅存储; 不使用任何 ZIP 压缩
# -M 不创建条目的清单文件
jar -cfM0 ../nacos-server.jar *
cd ../
jar -tvf target/nacos-server.jar |grep tomcat
# 405 Mon Oct 12 16:05:02 CST 2020 BOOT-INF/lib/spring-boot-starter-tomcat-2.1.17.RELEASE.jar
#13334 Wed Aug 14 17:30:10 CST 2024 BOOT-INF/lib/tomcat-annotations-api-9.0.93.jar
#3581590 Wed Aug 14 17:30:02 CST 2024 BOOT-INF/lib/tomcat-embed-core-9.0.93.jar
#259010 Wed Aug 14 17:30:02 CST 2024 BOOT-INF/lib/tomcat-embed-el-9.0.93.jar
#284380 Wed Aug 14 17:30:02 CST 2024 BOOT-INF/lib/tomcat-embed-websocket-9.0.93.jar
#668402 Wed Aug 14 17:30:10 CST 2024 BOOT-INF/lib/tomcat-embed-jasper-9.0.93.jar
#3,重启验证,服务启动正常
./bin/startup.sh
#4,查看启动日志
grep -i 'apache tomcat' logs/*.log
#logs/nacos.log:2024-08-22 15:16:47,173 INFO Starting Servlet engine: [Apache Tomcat/9.0.93]
#logs/nacos.log:2024-08-22 15:18:47,671 INFO Starting Servlet engine: [Apache Tomcat/9.0.93]