CVE-2026-59401

Resource Injection
Affects
Spring for Apache Kafka
in
Spring
No items found.
Versions
<=2.8.13, >=2.9.0 <=2.9.15, >=3.0.0 <=3.3.17, >=4.0.0 <=4.0.8, >=4.1.0 <=4.1.2

Patch Available.

Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

Spring for Apache Kafka (spring-kafka) applies core Spring concepts to the development of Kafka-based messaging solutions. It provides a template for sending messages and support for message-driven POJOs, and its header mappers convert Kafka record headers to and from typed message headers.

A resource injection vulnerability (CVE-2026-59401) has been identified in the DefaultKafkaHeaderMapper and JsonKafkaHeaderMapper classes of Spring for Apache Kafka, which allows attackers who can produce records to a consumed topic to make the consumer load, and with some Jackson versions initialize, any class on its classpath regardless of the trusted packages configuration. The impact depends on the side effects of the static initializers of the classes present on the classpath, such as resource allocation, driver registration, or blocking.

Per OWASP: This attack consists of changing resource identifiers used by an application in order to perform a malicious task.

This issue affects multiple versions of Spring for Apache Kafka.

Details

Module Info

Vulnerability Info

This Low-severity vulnerability is found in the org.springframework.kafka:spring-kafka package in multiple versions of Spring for Apache Kafka.

When a record is consumed, DefaultKafkaHeaderMapper (and JsonKafkaHeaderMapper in newer lines) reads the spring_json_header_types header, which maps each header name to the Java type its value should be decoded as. Before decoding, the mapper checks the requested type against its trusted packages. The check compares only the package of the requested type, and java.lang is in the default trusted list:

private static final List<String> DEFAULT_TRUSTED_PACKAGES = List.of(
                "java.lang",
                "java.net",
                "java.util",
                "org.springframework.util"
        );
protected boolean trusted(String requestedType) {
    ...
    String type = requestedType.startsWith("[") ? requestedType.substring(2) : requestedType;
    if (!this.trustedPackages.isEmpty()) {
        int lastDot = type.lastIndexOf('.');
        ...
        String packageName = type.substring(0, lastDot);
        for (String trustedPackage : this.trustedPackages) {
            if (packageName.equals(trustedPackage)) {
                return true;
            }
        }
        return false;
    }
    return true;
}

A producer can therefore declare a header's type as java.lang.Class. The type passes trusted(), is resolved with ClassUtils.forName, and the header value is then handed to Jackson:

trusted = trusted(requestedType);
if (trusted) {
    type = ClassUtils.forName(requestedType, null);
}
...
Object value = decodeValue(header, type);   // headerObjectMapper.readValue(h.value(), type)

Jackson deserializes a java.lang.Class by treating the JSON string in the header value as a class name and loading that class. The class named in the value is never checked against the trusted packages, so any class on the consumer's classpath can be loaded, and with some Jackson versions initialized, running its static initializer. An application is exposed when it consumes from a topic an attacker can produce to and maps inbound headers with DefaultKafkaHeaderMapper or JsonKafkaHeaderMapper, which is the default when Jackson is on the classpath. Adding packages with addTrustedPackages, including *, does not prevent it.

Mitigation

Only recent versions of Spring for Apache Kafka receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.

Users of the affected components should apply one of the following mitigations:

  • Upgrade to a currently supported version of Spring for Apache Kafka.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Low
ID
CVE-2026-59401
PROJECT Affected
Spring for Apache Kafka
Versions Affected
<=2.8.13, >=2.9.0 <=2.9.15, >=3.0.0 <=3.3.17, >=4.0.0 <=4.0.8, >=4.1.0 <=4.1.2
NES Versions Affected
Published date
November 20, 2026
≈ Fix date
Category
Resource Injection
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Spring
Rss feed icon
Subscribe via RSS
or

By submitting the form I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.