VYPR
Low severityNVD Advisory· Published Dec 18, 2024· Updated Dec 18, 2024

Apache Kafka: SCRAM authentication vulnerable to replay attacks when used without encryption

CVE-2024-56128

Description

Incorrect Implementation of Authentication Algorithm in Apache Kafka's SCRAM implementation.

Issue Summary: Apache Kafka's implementation of the Salted Challenge Response Authentication Mechanism (SCRAM) did not fully adhere to the requirements of RFC 5802 [1]. Specifically, as per RFC 5802, the server must verify that the nonce sent by the client in the second message matches the nonce sent by the server in its first message. However, Kafka's SCRAM implementation did not perform this validation.

Impact: This vulnerability is exploitable only when an attacker has plaintext access to the SCRAM authentication exchange. However, the usage of SCRAM over plaintext is strongly discouraged as it is considered an insecure practice [2]. Apache Kafka recommends deploying SCRAM exclusively with TLS encryption to protect SCRAM exchanges from interception [3]. Deployments using SCRAM with TLS are not affected by this issue.

How to Detect If You Are Impacted: If your deployment uses SCRAM authentication over plaintext communication channels (without TLS encryption), you are likely impacted. To check if TLS is enabled, review your server.properties configuration file for listeners property. If you have SASL_PLAINTEXT in the listeners, then you are likely impacted.

Fix Details: The issue has been addressed by introducing nonce verification in the final message of the SCRAM authentication exchange to ensure compliance with RFC 5802.

Affected Versions: Apache Kafka versions 0.10.2.0 through 3.9.0, excluding the fixed versions below.

Fixed Versions: 3.9.0 3.8.1 3.7.2

Users are advised to upgrade to 3.7.2 or later to mitigate this issue.

Recommendations for Mitigation: Users unable to upgrade to the fixed versions can mitigate the issue by: - Using TLS with SCRAM Authentication: Always deploy SCRAM over TLS to encrypt authentication exchanges and protect against interception. - Considering Alternative Authentication Mechanisms: Evaluate alternative authentication mechanisms, such as PLAIN, Kerberos or OAuth with TLS, which provide additional layers of security.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Apache Kafka's SCRAM authentication fails to verify client nonce per RFC 5802, enabling replay attacks when used without TLS encryption.

Vulnerability

Apache Kafka's SCRAM authentication implementation omitted a crucial validation required by RFC 5802 [1]. During the SCRAM exchange, the server must verify that the nonce sent by the client in its final message matches the nonce the server originally sent. Kafka did not perform this check, leaving the authentication flow incomplete and vulnerable to replay attacks.

Exploitation

An attacker with plaintext access to the SCRAM authentication exchange can exploit this flaw. Since SCRAM is typically used over TLS, the vulnerability only affects deployments using SASL_PLAINTEXT listeners without TLS encryption [2]. In such scenarios, an adversary can capture and replay authentication messages to impersonate a valid client. Apache Kafka strongly recommends deploying SCRAM exclusively over TLS to protect exchanges from interception [3].

Impact

Successful exploitation allows an attacker to replay a captured SCRAM exchange, potentially gaining unauthorized access to Kafka brokers. The vulnerability affects Apache Kafka versions 0.10.2.0 through 3.9.0, excluding fixed versions [3].

Mitigation

The issue is addressed in Kafka versions 3.7.2, 3.8.1, and 3.9.0, which introduce proper nonce verification in the final SCRAM message [4]. Users unable to upgrade should ensure SCRAM is always used with TLS, or consider alternative authentication mechanisms like PLAIN, Kerberos, or OAuth over TLS.

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.apache.kafka:kafka_2.13Maven
>= 0.10.2.0, < 3.7.23.7.2
org.apache.kafka:kafka_2.13Maven
>= 3.8.0, < 3.8.13.8.1
org.apache.kafka:kafka_2.12Maven
>= 0.10.2.0, < 3.7.23.7.2
org.apache.kafka:kafka_2.12Maven
>= 3.8.0, < 3.8.13.8.1
org.apache.kafka:kafka_2.11Maven
>= 0.10.2.0, <= 2.4.1
org.apache.kafka:kafka_2.10Maven
>= 0.10.2.0, <= 0.10.2.2

Affected products

37

Patches

1
2cbc5bd3ca22

KAFKA-17636 Fix missing SCRAM bootstrap records (#17305)

https://github.com/apache/kafkaDavid ArthurSep 28, 2024via ghsa
2 files changed · +51 2
  • core/src/main/scala/kafka/tools/StorageTool.scala+2 0 modified
    @@ -130,6 +130,8 @@ object StorageTool extends Logging {
         if (namespace.getBoolean("standalone")) {
           formatter.setInitialVoters(createStandaloneDynamicVoters(config))
         }
    +    Option(namespace.getList("add_scram")).
    +      foreach(scramArgs => formatter.setScramArguments(scramArgs.asInstanceOf[util.List[String]]))
         configToLogDirectories(config).foreach(formatter.addDirectory(_))
         formatter.run()
       }
    
  • core/src/test/scala/unit/kafka/tools/StorageToolTest.scala+49 2 modified
    @@ -21,12 +21,14 @@ import java.io.{ByteArrayOutputStream, File, PrintStream}
     import java.nio.charset.StandardCharsets
     import java.nio.file.Files
     import java.util
    -import java.util.Properties
    +import java.util.{Optional, Properties}
     import kafka.server.KafkaConfig
     import kafka.utils.TestUtils
     import net.sourceforge.argparse4j.inf.ArgumentParserException
    +import org.apache.kafka.common.metadata.UserScramCredentialRecord
     import org.apache.kafka.common.utils.Utils
     import org.apache.kafka.server.common.Features
    +import org.apache.kafka.metadata.bootstrap.BootstrapDirectory
     import org.apache.kafka.metadata.properties.{MetaPropertiesEnsemble, PropertiesUtils}
     import org.apache.kafka.metadata.storage.FormatterException
     import org.apache.kafka.raft.QuorumConfig
    @@ -37,6 +39,7 @@ import org.junit.jupiter.params.ParameterizedTest
     import org.junit.jupiter.params.provider.ValueSource
     
     import scala.collection.mutable.ListBuffer
    +import scala.jdk.CollectionConverters.IterableHasAsScala
     
     @Timeout(value = 40)
     class StorageToolTest {
    @@ -433,5 +436,49 @@ Found problem:
           contains("Formatting dynamic metadata voter directory %s".format(availableDirs.head)),
           "Failed to find content in output: " + stream.toString())
       }
    -}
     
    +  @Test
    +  def testBootstrapScramRecords(): Unit = {
    +    val availableDirs = Seq(TestUtils.tempDir())
    +    val properties = new Properties()
    +    properties.putAll(defaultDynamicQuorumProperties)
    +    properties.setProperty("log.dirs", availableDirs.mkString(","))
    +    val stream = new ByteArrayOutputStream()
    +    val arguments = ListBuffer[String](
    +      "--release-version", "3.9-IV0",
    +      "--add-scram", "SCRAM-SHA-512=[name=alice,password=changeit]",
    +      "--add-scram", "SCRAM-SHA-512=[name=bob,password=changeit]"
    +    )
    +
    +    assertEquals(0, runFormatCommand(stream, properties, arguments.toSeq))
    +
    +    // Not doing full SCRAM record validation since that's covered elsewhere.
    +    // Just checking that we generate the correct number of records
    +    val bootstrapMetadata = new BootstrapDirectory(availableDirs.head.toString, Optional.empty).read
    +    val scramRecords = bootstrapMetadata.records().asScala
    +      .filter(apiMessageAndVersion => apiMessageAndVersion.message().isInstanceOf[UserScramCredentialRecord])
    +      .map(apiMessageAndVersion => apiMessageAndVersion.message().asInstanceOf[UserScramCredentialRecord])
    +      .toList
    +    assertEquals(2, scramRecords.size)
    +    assertEquals("alice", scramRecords.head.name())
    +    assertEquals("bob", scramRecords.last.name())
    +  }
    +
    +  @Test
    +  def testScramRecordsOldReleaseVersion(): Unit = {
    +    val availableDirs = Seq(TestUtils.tempDir())
    +    val properties = new Properties()
    +    properties.putAll(defaultDynamicQuorumProperties)
    +    properties.setProperty("log.dirs", availableDirs.mkString(","))
    +    val stream = new ByteArrayOutputStream()
    +    val arguments = ListBuffer[String](
    +      "--release-version", "3.4",
    +      "--add-scram", "SCRAM-SHA-512=[name=alice,password=changeit]",
    +      "--add-scram", "SCRAM-SHA-512=[name=bob,password=changeit]"
    +    )
    +
    +    assertEquals(
    +      "SCRAM is only supported in metadata.version 3.5-IV2 or later.",
    +      assertThrows(classOf[FormatterException], () => runFormatCommand(stream, properties, arguments.toSeq)).getMessage)
    +  }
    +}
    

Vulnerability mechanics

Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

8

News mentions

0

No linked articles in our index yet.