CVE-2026-59406
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring for Apache Kafka is the Spring project that applies core Spring concepts to building Kafka-based messaging applications, providing a template for sending records and message-driven listeners such as @KafkaListener for consuming them.
A denial of service vulnerability (CVE-2026-59406) has been identified in the Kafka header mappers of Spring for Apache Kafka, which allows attackers who can produce records to a consumed topic to make the consumer allocate memory sized by a header value. A small malicious record can exhaust the heap or raise an OutOfMemoryError that stops the listener container, repeatedly halting 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: <=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
- 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, from 4.0, JsonKafkaHeaderMapper), which the default messaging message converters use for @KafkaListener methods, deserializes each header value into the class named for that header in the producer-controlled spring_json_header_types header, provided the class's package is trusted. The default trusted packages include org.springframework.util, and the small deny list of never-trusted types, where a release has one, covers only java.net address types:
private static final List<String> DEFAULT_TRUSTED_PACKAGES = List.of(
"java.lang",
"java.net",
"java.util",
"org.springframework.util"
);
private static final Set<String> UNTRUSTED_TYPES = new HashSet<>(Arrays.asList(
"java.net.InetAddress",
"java.net.Inet4Address",
"java.net.Inet6Address",
"java.net.InetSocketAddress"
));A trusted type is then passed straight to Jackson:
Object value = headerObjectMapper.readValue(h.value(), type);A producer can therefore declare org.springframework.util.ResizableByteArrayOutputStream or org.springframework.util.ConcurrentReferenceHashMap as a header's type and send a number such as 2147483647 as its value. Jackson builds the object through its single-integer constructor, so the consumer allocates a buffer or table of that size while mapping the header. With Jackson 3, a single large header raises an OutOfMemoryError that the mapper does not catch, so the listener container stops before the record is committed and stops again on the same record after a restart. With Jackson 2, one record carrying many such headers can exhaust the heap with the same result. Any application that consumes from a topic an attacker can produce to, and maps headers with these mappers, is exposed.
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)