Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreDelegatingDeserializer selects the delegate deserializer for each record from the spring.kafka.serialization.selector (value) or spring.kafka.key.serialization.selector (key) header. When the selector matched no configured delegate, it loaded the class named in the header, without any restriction, and, for a type supported by Kafka's Serdes (such as String or Long), deserialized the record with the corresponding standard deserializer.
Since the producer sets the header, a malicious producer can choose how records are deserialized, regardless of the configured delegates, so that listeners receive data of an unexpected type, and can make the consumer load any class on its classpath. Combined with the selection of the configured delegates by the same header, this can let an attacker apply a delegate to data it was not intended for.
An application is affected if it consumes records from a topic that an attacker can produce to and uses DelegatingDeserializer as the key or value deserializer.
Spring for Apache Kafka:
| Fix version | Availability |
|---|---|
| 4.1.3 | OSS |
| 4.1.2.1 | Enterprise Support Only |
| 4.0.9 | OSS |
| 4.0.8.1 | Enterprise Support Only |
| 3.3.18 | Enterprise Support Only |
| 2.9.16 | Enterprise Support Only |
| 2.8.14 | Enterprise Support Only |
Users of affected versions should upgrade to the corresponding fixed version.
In the fixed versions, DelegatingDeserializer only uses the configured delegates and returns the raw byte[] when the selector matches none of them; it no longer creates deserializers for the standard Serdes types named in the header. Applications that relied on that behavior should configure delegates using the class names as selectors, for example java.lang.Long:org.apache.kafka.common.serialization.LongDeserializer. Because the producer of each record selects which of the configured delegates is applied to its data, only configure delegates that are safe to use with any data that can be published to the topic.
This vulnerability was discovered and responsibly reported by Yu Bao from PayPal Cyber Security Team.
To report a security vulnerability for a project within the Spring portfolio, see the Security Policy