关于 Log4j2 的王炸,各位对不能升级版本的中间件都有什么修复的方法?

2021-12-13 09:40:35 +08:00
 jasondennis12139
2453 次点击
所在节点    问与答
9 条回复
clf
2021-12-13 09:58:15 +08:00
不对外网开放+改环境变量。

能够单独引入指定版本 log4j2 的项目单独引入修复的版本。
wolfie
2021-12-13 10:06:50 +08:00
找特定版本 JDK trustURLCodebase 为 false 的。
Depth
2021-12-13 10:43:17 +08:00
coolwind1981
2021-12-13 11:43:42 +08:00
临时解决,设定参数:formatMsgNoLookups=true

Temporary Mitigation​
As per this discussion on HackerNews:

The 'formatMsgNoLookups' property was added in version 2.10.0, per the JIRA Issue LOG4J2-2109 [1] that proposed it. Therefore the 'formatMsgNoLookups=true' mitigation strategy is available in version 2.10.0 and higher, but is no longer necessary with version 2.15.0, because it then becomes the default behavior [2][3].

If you are using a version older than 2.10.0 and cannot upgrade, your mitigation choices are:

Modify every logging pattern layout to say %m{nolookups} instead of %m in your logging config files, see details at https://issues.apache.org/jira/browse/LOG4J2-2109 (only works on versions >= 2.7) or,

Substitute a non-vulnerable or empty implementation of the class org.apache.logging.log4j.core.lookup.JndiLookup, in a way that your classloader uses your replacement instead of the vulnerable version of the class. Refer to your application's or stack's classloading documentation to understand this behavior.

参考
https://www.lunasec.io/docs/blog/log4j-zero-day/
ltxlouis
2021-12-13 12:09:06 +08:00
补充一个
For releases from 2.0-beta9 to 2.10.0, the mitigation is to remove the JndiLookup class from the classpath: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class.

https://logging.apache.org/log4j/2.x/
PiersSoCool
2021-12-13 14:42:08 +08:00
如果业务运行在内网,需要很注意这个问题吗?我个人感觉是没必要啊,没有入口可以注入 LOG 吧?
fdgdbr
2021-12-13 15:45:46 +08:00
@Depth 有意思
amrom
2021-12-13 15:59:18 +08:00
我提供一个思路,不知道对不对,用 nginx 来拦截输入,匹配关键字
aragakiyuii
2021-12-14 07:38:21 +08:00
https://github.com/Glavo/log4j-patch
推荐 glavo 大佬的 patch

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/821763

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX