CVE-2026-59432
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of Kafka-based messaging solutions. It provides a template as a high-level abstraction for sending messages, and support for message-driven POJOs through @KafkaListener annotations and listener containers.
A denial of service (DoS) vulnerability (CVE-2026-59432) has been identified in the DefaultKafkaHeaderMapper and JsonKafkaHeaderMapper header mappers of Spring for Apache Kafka, which allows attackers who can produce records to a consumed topic to repeatedly stop the listener container. A single record that declares a deeply nested array type, or an array of java.util.Timer, for one of its headers is enough to halt consumption.
Per OWASP: The Denial of Service (DoS) attack is focused on making a resource (site, application, server) unavailable for the purpose it was designed.
This issue affects multiple versions of Spring for Apache Kafka.
Details
Module Info
- Product: Spring for Apache Kafka
- Affected packages:
org.springframework.kafka:spring-kafka - Affected versions: >=4.1.0 <=4.1.2, >=4.0.0 <=4.0.8, >=3.0.0 <=3.3.17, >=2.9.0 <=2.9.15, <=2.8.13
- GitHub repository: https://github.com/spring-projects/spring-kafka
- Published packages: https://central.sonatype.com/artifact/org.springframework.kafka/spring-kafka
- Package manager: Maven
- Fixed in:
- OSS Spring for Apache Kafka 4.0.9, 4.1.3
- NES for Spring for Apache Kafka
Vulnerability Info
This Medium-severity vulnerability is found in the org.springframework.kafka:spring-kafka package in multiple versions of Spring for Apache Kafka.
When mapping inbound record headers, DefaultKafkaHeaderMapper and JsonKafkaHeaderMapper read the producer-controlled spring_json_header_types header, which names a Java type for each header value. These mappers are used by the default messaging message converters, so they apply to @KafkaListener methods out of the box. If the named type passes the trusted() check, the mapper loads it with ClassUtils.forName and decodes the header value into it. The java.lang and java.util packages are trusted by default:
private static final List<String> DEFAULT_TRUSTED_PACKAGES = List.of(
"java.lang",
"java.net",
"java.util",
"org.springframework.util"
);
The trusted() check only strips a leading [ plus one character before taking the package name, and places no limit on the number of array dimensions. A name such as java.lang.String followed by many thousands of [] suffixes therefore resolves to the trusted package java.lang, and java.util.Timer is trusted as well:
String type = requestedType.startsWith("[") ? requestedType.substring(2) : requestedType;
if (!this.trustedPackages.isEmpty()) {
int lastDot = type.lastIndexOf('.');
if (lastDot < 0) {
return false;
}
String packageName = type.substring(0, lastDot);
for (String trustedPackage : this.trustedPackages) {
if (packageName.equals(trustedPackage)) {
return true;
}
}
return false;
}
ClassUtils.forName resolves a source-form array name by calling itself once per [] suffix, so a type with a very large number of dimensions overflows the consumer thread's stack with a StackOverflowError. Decoding a header value into a java.util.Timer array constructs one Timer per element, and each constructor starts a new thread, so a large array can exhaust the application's native threads. The mapper only catches Exception and IOException, so neither Error is handled:
private void populateJsonValueHeader(Header header, String requestedType, Map<String, Object> headers) {
Class<?> type = Object.class;
boolean trusted = false;
try {
trusted = trusted(requestedType);
if (trusted) {
type = ClassUtils.forName(requestedType, null);
}
}
catch (Exception e) {
logger.error(e, () -> "Could not load class for header: " + header.key());
}
...
}
The error propagates out of the listener, which stops the listener container before the record's offset is committed. After a restart the container receives the same record and stops again, so one malicious record from any party that can produce to the topic repeatedly halts consumption.
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.
Credits
- JIHUN KIM (finder)