CVE-2021-38153: Kafka 2.11 Observable Discrepancy Vulnerability

MODERATE
Advisory Identifier: GHSA-3j6g-hxx5-3q26
CVSS 5.9
CWE-203
Published
Advisory Summary

CVE-2021-38153 is a MODERATE (CVSS 5.9) observable discrepancy vulnerability (CWE-203: Observable Discrepancy) affecting Kafka 2.11 libraries in the Maven ecosystem. The issue involves observable discrepancy in apache kafka. Remediation is available by upgrading affected packages to version 2.6.3, 2.7.2, 2.8.1.

CVE-2021-38153 at a Glance

CVE Identifier CVE-2021-38153
GHSA Identifier GHSA-3j6g-hxx5-3q26
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-203: Observable Discrepancy
Affected Product Kafka 2.11
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2021-38153

To remediate this vulnerability, upgrade all affected Kafka 2.11 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.kafka:kafka_2.11 fixed: Latest secure release
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.11</artifactId>
    <version>Latest secure release</version>
</dependency>
org.apache.kafka:kafka_2.12 fixed: 2.6.3
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.12</artifactId>
    <version>2.6.3</version>
</dependency>
org.apache.kafka:kafka_2.12 fixed: 2.7.2
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.12</artifactId>
    <version>2.7.2</version>
</dependency>
org.apache.kafka:kafka_2.12 fixed: 2.8.1
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.12</artifactId>
    <version>2.8.1</version>
</dependency>
org.apache.kafka:kafka_2.13 fixed: 2.6.3
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.13</artifactId>
    <version>2.6.3</version>
</dependency>
org.apache.kafka:kafka_2.13 fixed: 2.7.2
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.13</artifactId>
    <version>2.7.2</version>
</dependency>
org.apache.kafka:kafka_2.13 fixed: 2.8.1
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.13</artifactId>
    <version>2.8.1</version>
</dependency>
org.apache.kafka:kafka-clients fixed: 2.6.3
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>2.6.3</version>
</dependency>
org.apache.kafka:kafka-clients fixed: 2.7.2
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>2.7.2</version>
</dependency>
org.apache.kafka:kafka-clients fixed: 2.8.1
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>2.8.1</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.kafka

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-38153, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.kafka

Analyze the terminal output to locate any version of Kafka 2.11 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.3), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.kafka command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-203: Observable Discrepancy, where the product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor. In Kafka 2.11, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Some components in Apache Kafka use `Arrays.equals` to validate a password or key, which is vulnerable to timing attacks that make brute force attacks for such credentials more likely to be successful. Users should upgrade to 2.8.1 or higher, or 3.0.0 or higher where this vulnerability has been fixed. The affected versions include Apache Kafka 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.7.1, and 2.8.0.

CVE-2021-38153 Affected Kafka 2.11 Versions

10 component(s)
Fixed Versions:
2.6.32.7.22.8.1
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.kafka:kafka_2.11
Maven
≥ 2.0.0
≤ 2.4.1
org.apache.kafka:kafka_2.12
Maven
≥ 2.0.0
< 2.6.3
2.6.3
org.apache.kafka:kafka_2.12
Maven
≥ 2.7.0
< 2.7.2
2.7.2
org.apache.kafka:kafka_2.12
Maven
≥ 2.8.0
< 2.8.1
All 1 versions
2.8.0
2.8.1
org.apache.kafka:kafka_2.13
Maven
≥ 2.4.0
< 2.6.3
2.6.3
org.apache.kafka:kafka_2.13
Maven
≥ 2.7.0
< 2.7.2
2.7.2
org.apache.kafka:kafka_2.13
Maven
≥ 2.8.0
< 2.8.1
All 1 versions
2.8.0
2.8.1
org.apache.kafka:kafka-clients
Maven
≥ 2.0.0
< 2.6.3
2.6.3
org.apache.kafka:kafka-clients
Maven
≥ 2.7.0
< 2.7.2
2.7.2
org.apache.kafka:kafka-clients
Maven
≥ 2.8.0
< 2.8.1
All 1 versions
2.8.0
2.8.1

References

NVD — CVE-2021-38153 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-38153
Kafka 2.11 Source Repository REPOSITORY
https://github.com/apache/kafka
kafka.apache.org/cve-list WEB
https://kafka.apache.org/cve-list
lists.apache.org/thread.html/r26390c... WEB
https://lists.apache.org/thread.html/r26390c8b09ecfa356582d665b0c01f4cdcf16ac047c85f9f9f06a88c@%3Cdev.kafka.apache.org%3E
lists.apache.org/thread.html/r26390c... WEB
https://lists.apache.org/thread.html/r26390c8b09ecfa356582d665b0c01f4cdcf16ac047c85f9f9f06a88c@%3Cusers.kafka.apache.org%3E
lists.apache.org/thread.html/r35322a... WEB
https://lists.apache.org/thread.html/r35322aec467ddae34002690edaa4d9f16e7df9b5bf7164869b75b62c@%3Cdev.kafka.apache.org%3E
lists.apache.org/thread.html/r45cc06... WEB
https://lists.apache.org/thread.html/r45cc0602d5f2cbb72e48896dfadf5e5b87ed85630449598b40e8f0be@%3Cdev.kafka.apache.org%3E
lists.apache.org/thread.html/r45cc06... WEB
https://lists.apache.org/thread.html/r45cc0602d5f2cbb72e48896dfadf5e5b87ed85630449598b40e8f0be@%3Cusers.kafka.apache.org%3E
lists.apache.org/thread.html/rd9ef21... WEB
https://lists.apache.org/thread.html/rd9ef217b09fdefaf32a4e1835b59b96629542db57e1f63edb8b006e6@%3Cdev.kafka.apache.org%3E
lists.apache.org/thread.html/rd9ef21... WEB
https://lists.apache.org/thread.html/rd9ef217b09fdefaf32a4e1835b59b96629542db57e1f63edb8b006e6@%3Cusers.kafka.apache.org%3E
support.confluent.io/hc/en-us/articles/4... WEB
https://support.confluent.io/hc/en-us/articles/4407632156692-CVE-2021-38153-Confluent-Platform-Vulnerability-Timing-attacks
Kafka 2.11 Security Information SECURITY
https://www.oracle.com/security-alerts/cpuapr2022.html
Kafka 2.11 Security Information SECURITY
https://www.oracle.com/security-alerts/cpujan2022.html
Kafka 2.11 Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html

Frequently Asked Questions

What is CVE-2021-38153?
CVE-2021-38153 is a security vulnerability in Kafka 2.11 involving Observable Discrepancy in Apache Kafka under CWE-203: Observable Discrepancy.
Which Kafka 2.11 versions are affected?
Affected versions include releases prior to 2.6.3, 2.7.2, 2.8.1 across affected packages: org.apache.kafka:kafka_2.11, org.apache.kafka:kafka_2.12, org.apache.kafka:kafka_2.13, org.apache.kafka:kafka-clients.
What version fixes CVE-2021-38153?
Upgrading to 2.6.3, 2.7.2, 2.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is kafka_2.11 affected?
Yes, org.apache.kafka:kafka_2.11 is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is kafka_2.12 affected?
Yes, org.apache.kafka:kafka_2.12 is affected in releases prior to 2.6.3, 2.7.2, 2.8.1. Upgrade your dependency to 2.6.3, 2.7.2, 2.8.1 or later.
What is the CVSS score of CVE-2021-38153?
CVE-2021-38153 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2021-38153?
CVE-2021-38153 is classified under CWE-203: Observable Discrepancy (The product behaves differently or sends different responses under different circumstances in a way that is observable to an unauthorized actor.).
How can I check Maven dependencies for CVE-2021-38153?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.kafka'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3j6g-hxx5-3q26",
  "modified" : "2022-02-08T20:43:00Z",
  "published" : "2021-09-23T23:18:58Z",
  "aliases" : [ "CVE-2021-38153" ],
  "summary" : "Observable Discrepancy in Apache Kafka",
  "details" : "Some components in Apache Kafka use `Arrays.equals` to validate a password or key, which is vulnerable to timing attacks that make brute force attacks for such credentials more likely to be successful. Users should upgrade to 2.8.1 or higher, or 3.0.0 or higher where this vulnerability has been fixed. The affected versions include Apache Kafka 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.7.1, and 2.8.0.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.11"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "last_affected" : "2.4.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.12"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.6.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.12"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.12"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ],
    "versions" : [ "2.8.0" ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.13"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.4.0"
      }, {
        "fixed" : "2.6.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.13"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka_2.13"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ],
    "versions" : [ "2.8.0" ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka-clients"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.6.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka-clients"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.kafka:kafka-clients"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.8.0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ],
    "versions" : [ "2.8.0" ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-38153"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/kafka"
  }, {
    "type" : "WEB",
    "url" : "https://kafka.apache.org/cve-list"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r26390c8b09ecfa356582d665b0c01f4cdcf16ac047c85f9f9f06a88c@%3Cdev.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r26390c8b09ecfa356582d665b0c01f4cdcf16ac047c85f9f9f06a88c@%3Cusers.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r35322aec467ddae34002690edaa4d9f16e7df9b5bf7164869b75b62c@%3Cdev.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r45cc0602d5f2cbb72e48896dfadf5e5b87ed85630449598b40e8f0be@%3Cdev.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r45cc0602d5f2cbb72e48896dfadf5e5b87ed85630449598b40e8f0be@%3Cusers.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rd9ef217b09fdefaf32a4e1835b59b96629542db57e1f63edb8b006e6@%3Cdev.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rd9ef217b09fdefaf32a4e1835b59b96629542db57e1f63edb8b006e6@%3Cusers.kafka.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://support.confluent.io/hc/en-us/articles/4407632156692-CVE-2021-38153-Confluent-Platform-Vulnerability-Timing-attacks"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpuapr2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujan2022.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-203" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-23T16:45:11Z",
    "nvd_published_at" : "2021-09-22T09:15:00Z"
  }
}