You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pulsar.apache.org by Lari Hotari <lh...@apache.org> on 2021/12/15 08:17:16 UTC

Analysis of impact of most recent Log4j CVE, CVE-2021-45046 to Pulsar

There's a new CVE,  CVE-2021-45046 in Log4j < 2.16.0
details:
https://blogs.apache.org/foundation/entry/apache-log4j-cves

Summary:
Pulsar isn't impacted with CVE-2021-44228 when the default log4j
configuration is used.
However, remember that Pulsar is impacted by the actual Log4Shell CVE and
Pulsar users should patch immediately. Patching instructions in the blog
post https://pulsar.apache.org/blog/2021/12/11/Log4j-CVE/ .

You can patch previous Docker images to upgrade to Log4j 2.16.0 with the
solution in
https://github.com/lhotari/pulsar-docker-images-patch-CVE-2021-44228 . That
could be used to address both CVEs for old Pulsar releases. If you are
running old Pulsar versions, please note that Pulsar <2.6.4 or 2.7.0
contain a severe Pulsar specific CVE
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22160 .

Detailed analysis of impact of CVE-2021-45046 to Pulsar:

Description of CVE-2021-45046,
https://logging.apache.org/log4j/2.x/security.html#cve-2021-45046

> It was found that the fix to address CVE-2021-44228 in Apache Log4j 2.15.0
> was incomplete in certain non-default configurations. This could allows
> attackers with control over Thread Context Map (MDC) input data when the
> logging configuration uses a non-default Pattern Layout with either a
> Context Lookup (for example, $${ctx:loginId}) or a Thread Context Map
> pattern (%X, %mdc, or %MDC) to craft malicious input data using a JNDI
> Lookup pattern resulting in a denial of service (DOS) attack. Log4j 2.15.0
> restricts JNDI LDAP lookups to localhost by default. Note that previous
> mitigations involving configuration such as to set the system property
> log4j2.noFormatMsgLookup to true do NOT mitigate this specific
> vulnerability.


In Pulsar Log4J configuration (conf/log4j2.yaml), context lookup or thread
context map patterns are: $${ctx:function} , $${ctx:instance} and
%X{instance} .
These are only used in Pulsar when running Functions in Thread runtime.
The user could impact the function name, but ${ are not valid characters
for any names in Pulsar. Therefore, Pulsar isn't impacted with
CVE-2021-44228 when the default log4j configuration is used.

Source code references:
This is where the thread context map is set in Pulsar Function instances:
https://github.com/apache/pulsar/blob/7bf14b5ac049d71c7ff74bbe758cb41aaffeb0af/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java#L179-L182
Pulsar name validation pattern:
https://github.com/apache/pulsar/blob/7bf14b5ac049d71c7ff74bbe758cb41aaffeb0af/pulsar-common/src/main/java/org/apache/pulsar/common/naming/NamedEntity.java#L31-L34


BR,

Lari