CVE-2023-34040: Spring-Kafka Java Deserialization Vulnerability

Summary

24/08/2023
Yes i
High
7.8

CVE-2023-34040: Spring-Kafka has Java Deserialization vulnerability When Improperly Configured. Affects org.springframework.kafka:spring-kafka across 2 version ranges.

>= 2.8.1, < 2.9.11 >= 3.0.0, < 3.0.10

Fixed in 2.9.11 or 3.0.10, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Spring-Kafka is a library that provides support for Kafka-based messaging in Spring applications. It allows developers to easily integrate Kafka messaging into their Spring projects. The library is widely used in Java applications that rely on Kafka for asynchronous communication and event-driven architectures. However, versions 2.9.10 and earlier, as well as 3.0.9 and earlier, are vulnerable to a Java deserialization vulnerability when improperly configured.

Vulnerability Detail

The vulnerability in Spring-Kafka arises when an application is configured in a specific way and allows untrusted sources to publish to a Kafka topic. In this scenario, an attacker can construct a malicious serialized object in the deserialization exception record headers. To exploit the vulnerability, the following conditions must be met: 1) The user does not configure an ErrorHandlingDeserializer for the key and/or value of the record. 2) The user explicitly sets the container properties checkDeserExWhenKeyNull and/or checkDeserExWhenValueNull to true. By default, these properties are false, and the container only attempts to deserialize the headers if an ErrorHandlingDeserializer is configured. The vulnerability can lead to remote code execution and other potential security risks.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.8.1, < 2.9.11 2.9.11
  • >= 3.0.0, < 3.0.10 3.0.10

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If upgrading to the fixed versions is not immediately possible, a workaround is to configure an ErrorHandlingDeserializer for the key and/or value of the record. This can be done by implementing a custom deserializer that handles deserialization exceptions appropriately and configuring it in the application. By using an ErrorHandlingDeserializer, the vulnerability can be mitigated even if the checkDeserExWhenKeyNull and checkDeserExWhenValueNull properties are set to true.

Conclusion

The Java deserialization vulnerability in Spring-Kafka can be mitigated by upgrading to the fixed versions or implementing a workaround. It is crucial to take immediate action to protect your application from potential remote code execution and other security risks. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.springframework.kafka:spring-kafka →

Share this vulnerability

FAQ

Spring-Kafka is a library that provides support for Kafka-based messaging in Spring applications. It allows developers to easily integrate Kafka messaging into their Spring projects.

Versions 2.9.10 and earlier, as well as 3.0.9 and earlier, are affected by this vulnerability.

The vulnerability can lead to remote code execution and other potential security risks.

To fix the vulnerability, it is recommended to upgrade to the fixed versions of Spring-Kafka (2.9.11 or later for 2.x versions, and 3.0.10 or later for 3.x versions).

Yes, a workaround is to configure an ErrorHandlingDeserializer for the key and/or value of the record.

Related vulnerabilities

Recent vulnerabilities recorded for org.springframework.kafka:spring-kafka.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.8.1, < 2.9.11 2.9.11
  • >= 3.0.0, < 3.0.10 3.0.10

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback