Kafka
Log4j CVE-2021-44228
Cybersecurity
Vulnerabilities
Software Updates

Which version of Kafka are impacted due to Log4j CVE-2021-44228?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

The vulnerability known as CVE-2021-44228, widely referred to as "Log4Shell," is a severe vulnerability affecting the Apache Log4j 2 library, a popular Java-based logging utility used by many software applications and services, including Apache Kafka. The exploitation of this vulnerability allows remote code execution (RCE) on the server hosting the application, making it a critical security risk.

Impact on Apache Kafka

Apache Kafka, which is an open-source stream-processing software platform developed by the Apache Software Foundation, uses Log4j for logging purposes. However, the impact of Log4Shell on Apache Kafka varies depending on the version of Log4j used in different Kafka versions.

Here’s a breakdown of the specific Kafka versions affected by this vulnerability:

  • Kafka Versions 2.8.0 to 2.8.1 and versions 3.0.0: These versions use Log4j 2.13.3, which is vulnerable to CVE-2021-44228.
  • Kafka versions below 2.8.0: These versions use Log4j 1.x, which originally was not believed to be affected by CVE-2021-44228; however, other vulnerabilities (like CVE-2021-4104) have been identified impacting Log4j 1.x under certain configurations. Although not directly impacted by Log4Shell, users are advised to review their configurations and apply necessary security patches or mitigations.

Mitigation Steps

For Apache Kafka versions that are affected (specifically 2.8.0 to 2.8.1 and 3.0.0), it is vital to take immediate action to mitigate the risk. The following steps can be taken:

  1. Upgrade Log4j: Upgrade the Log4j library to version 2.15.0 or higher. As of Log4j 2.15.0, the issue has been addressed by disabling the problematic feature (JNDI lookup) by default.
  2. Apply Patches: For users who cannot immediately upgrade, applying the patches provided by Apache or using properties to disable JNDI lookups in Log4j is crucial. You can set the system property log4j2.formatMsgNoLookups to true or remove the JndiLookup class from the classpath.
  3. Kafka Configuration: Ensure that proper Kafka configuration settings that disable log message substitution are enforced. Kafka uses property substitution in its configuration, which can be manipulated to exploit this vulnerability if not properly secured.

Technical Example

An example mitigation in Kafka’s environment could look like this:

properties
# Add this to the Kafka startup script 
KAFKA_OPTS="-Dlog4j2.formatMsgNoLookups=true"

Or removing the JndiLookup class manually:

bash
zip -q -d path/to/log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class
Kafka VersionLog4j VersionVulnerableRecommended Action
Below 2.8.01.xNoReview and patch configurations as needed
2.8.0 - 2.8.12.13.3YesUpgrade Log4j to 2.15.0 or apply patches
3.0.02.13.3YesUpgrade Log4j to 2.15.0 or apply patches
Above 3.0.02.15.0+NoNo action required unless new vulnerabilities are discovered

Final Thoughts

The Log4Shell vulnerability in Log4j is a potent reminder of the importance of keeping dependencies up to date and monitoring for security patches consistently. Organizations using Apache Kafka must prioritize security updates to prevent exploitation and secure their data streams against potential breaches.


Course illustration
Course illustration

All Rights Reserved.