Apache Kafka: SCRAM authentication vulnerable to replay attacks when used without encryption
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.
- RFC 5802: Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms
- RFC 5802: Salted Challenge Response Authentication Mechanism (SCRAM) SASL and GSS-API Mechanisms
- NVD - CVE-2024-56128
- security - CVE-2024-56128: Apache Kafka: SCRAM authentication vulnerable to replay attacks when used without encryption
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.
| Package | Affected versions | Patched versions |
|---|---|---|
org.apache.kafka:kafka_2.13Maven | >= 0.10.2.0, < 3.7.2 | 3.7.2 |
org.apache.kafka:kafka_2.13Maven | >= 3.8.0, < 3.8.1 | 3.8.1 |
org.apache.kafka:kafka_2.12Maven | >= 0.10.2.0, < 3.7.2 | 3.7.2 |
org.apache.kafka:kafka_2.12Maven | >= 3.8.0, < 3.8.1 | 3.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- osv-coords35 versionspkg:apk/chainguard/kafka_exporter-strimzi-compatpkg:apk/chainguard/kafka-strimzi-compatpkg:apk/chainguard/prometheus-jmx-exporter-strimzi-compatpkg:apk/chainguard/strimzi-kafka-operatorpkg:apk/chainguard/strimzi-kafka-operator-cluster-operatorpkg:apk/chainguard/strimzi-kafka-operator-kafka-agentpkg:apk/chainguard/strimzi-kafka-operator-kafka-agent-3pkg:apk/chainguard/strimzi-kafka-operator-kafka-basepkg:apk/chainguard/strimzi-kafka-operator-kafka-initpkg:apk/chainguard/strimzi-kafka-operator-kafka-thirdparty-libspkg:apk/chainguard/strimzi-kafka-operator-kafka-thirdparty-libs-ccpkg:apk/chainguard/strimzi-kafka-operator-mirror-maker-agentpkg:apk/chainguard/strimzi-kafka-operator-topic-operatorpkg:apk/chainguard/strimzi-kafka-operator-tracing-agentpkg:apk/chainguard/strimzi-kafka-operator-user-operatorpkg:apk/wolfi/kafka_exporter-strimzi-compatpkg:apk/wolfi/kafka-strimzi-compatpkg:apk/wolfi/prometheus-jmx-exporter-strimzi-compatpkg:apk/wolfi/strimzi-kafka-operatorpkg:apk/wolfi/strimzi-kafka-operator-cluster-operatorpkg:apk/wolfi/strimzi-kafka-operator-kafka-agentpkg:apk/wolfi/strimzi-kafka-operator-kafka-agent-3pkg:apk/wolfi/strimzi-kafka-operator-kafka-basepkg:apk/wolfi/strimzi-kafka-operator-kafka-initpkg:apk/wolfi/strimzi-kafka-operator-kafka-thirdparty-libspkg:apk/wolfi/strimzi-kafka-operator-kafka-thirdparty-libs-ccpkg:apk/wolfi/strimzi-kafka-operator-mirror-maker-agentpkg:apk/wolfi/strimzi-kafka-operator-topic-operatorpkg:apk/wolfi/strimzi-kafka-operator-tracing-agentpkg:apk/wolfi/strimzi-kafka-operator-user-operatorpkg:bitnami/kafkapkg:maven/org.apache.kafka/kafka_2.10pkg:maven/org.apache.kafka/kafka_2.11pkg:maven/org.apache.kafka/kafka_2.12pkg:maven/org.apache.kafka/kafka_2.13
< 0.46.1-r0+ 34 more
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: < 0.46.1-r0
- (no CPE)range: >= 3.8.0, < 3.8.1
- (no CPE)range: >= 0.10.2.0, <= 0.10.2.2
- (no CPE)range: >= 0.10.2.0, <= 2.4.1
- (no CPE)range: >= 0.10.2.0, < 3.7.2
- (no CPE)range: >= 0.10.2.0, < 3.7.2
- Apache Software Foundation/Apache Kafkav5Range: 0.10.2.0
Patches
12cbc5bd3ca22KAFKA-17636 Fix missing SCRAM bootstrap records (#17305)
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- github.com/advisories/GHSA-p7c9-8xx8-h74fghsaADVISORY
- lists.apache.org/thread/84dh4so32lwn7wr6c5s9mwh381vx9wkwghsavendor-advisoryWEB
- nvd.nist.gov/vuln/detail/CVE-2024-56128ghsaADVISORY
- www.openwall.com/lists/oss-security/2024/12/18/3ghsaWEB
- datatracker.ietf.org/doc/html/rfc5802ghsarelatedWEB
- datatracker.ietf.org/doc/html/rfc5802ghsarelatedWEB
- github.com/apache/kafka/commit/2cbc5bd3ca22185d9cd357c9db23a2cfb43a0fffghsaWEB
- kafka.apache.org/documentation/ghsaWEB
News mentions
0No linked articles in our index yet.