有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何修补Log4j2 0天漏洞

我们将Java用于使用log4j2库的服务之一。截至2021年12月10日,发现利用Log4J2执行java的远程代码。我想知道解决这个问题的最好办法是什么?只使用另一个Java日志库是否合适?或者是否有log4j2的配置,这样我们就不必在更改日志库时遇到所有麻烦


共 (1) 个答案

  1. # 1 楼答案

    我们应该将log4j升级到版本2.15.0(可从^{}获得)As per the security notes (^{}),该漏洞已在2.15.0中修复

    “安全说明”还列出了在(当前)不允许升级的情况下减少利用漏洞的措施:

    Mitigation: In releases >=2.10, this behavior can be mitigated by setting either the system property log4j2.formatMsgNoLookups or the environment variable LOG4J_FORMAT_MSG_NO_LOOKUPS to true. 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.

    如果我们使用的spring-boot-starter-logging没有额外的配置,我们不会受到影响。有关详细信息,请参阅spring-boot infromation on the issue (^{})

    类似地,我们在使用quarkus时不会受到影响,只要我们不显式添加log4j依赖项。见the corresponding github issue (^{})