Ref:

CVE-2021-44228

修复commit https://github.com/apache/logging-log4j2/pull/608

org.apache.logging.log4j.core.net.JndiManager#lookup()为sink点,org.apache.logging.log4j.spi.AbstractLogger为source点。 长达30层的调用栈 前一部分根据包名可以判断是通过配置决定是否使用某些功能,真正开始写入流是从org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender#append开始的。

在org.apache.logging.log4j.core.pattern.MessagePatternConverter#format出现了判断日志内容为${开头。 在检测到${ 在org.apache.logging.log4j.core.lookup.StrSubstitutor中有定义一下特殊字符串和变量,如:-为赋值符。 在org.apache.logging.log4j.core.lookup.StrSubstitutor#substitute中,会递归处理${}嵌套的情况。

RC1补丁绕过 在配置中默认关闭JDNI功能,且在lookup时添加白名单 JNDI 协议、白名单主机名、白名单类名。但在lookup时遇到非白名单内容时,使用try catch中并没有catch后返回,使得报错后仍然可以走到lookup()。

于是在URL中加入空格即可绕过这个补丁。在官方测试用例中也有?Type=A Type&Name=1100110&Char=!脏数据报错绕过。