Which version of Kafka are impacted due to Log4j CVE-2021-44228?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
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:
- 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 (
JNDIlookup) by default. - Apply Patches: For users who cannot immediately upgrade, applying the patches provided by Apache or using properties to disable
JNDIlookups in Log4j is crucial. You can set the system propertylog4j2.formatMsgNoLookupstotrueor remove theJndiLookupclass from the classpath. - 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:
Or removing the JndiLookup class manually:
Summary Table of Affected Versions and Recommended Actions
| Kafka Version | Log4j Version | Vulnerable | Recommended Action |
| Below 2.8.0 | 1.x | No | Review and patch configurations as needed |
| 2.8.0 - 2.8.1 | 2.13.3 | Yes | Upgrade Log4j to 2.15.0 or apply patches |
| 3.0.0 | 2.13.3 | Yes | Upgrade Log4j to 2.15.0 or apply patches |
| Above 3.0.0 | 2.15.0+ | No | No 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.
Related reading
- Who keeps track of the last read message offset of the consumer in Apache Kafka?
- Why __consumer_offsets topic in kafka is not spreading to all the brokers?
- why ADD COLUMN to kafka table is not supported in Clickhouse
- Why are my environment variables not detected when starting up celery?
- Why can't I establish connection to rabbitMQ using python?
- Why can't I find the 'rabbitmq.config' file while I have already installed RabbitMQ?
- Why can't Kafka Producer connect to zookeeper to fetch broker metadata instead of connecting to brokers
- Why can't you look at messages in the Rabbit Queue

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.