CVE-2026-59438
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Spring Integration extends the Spring programming model to support the well-known Enterprise Integration Patterns. It enables lightweight messaging within Spring-based applications and supports integration with external systems through declarative adapters, including message stores backed by databases such as MongoDB.
A remote code execution vulnerability (CVE-2026-59438) has been identified in the Spring Integration MongoDbMessageStore, which allows attackers who can influence the serialized bytes stored in the backing MongoDB collection to cause arbitrary Java classes to be deserialized. Deserialization allow-list patterns added through addAllowedPatterns() after the store is initialized are silently ignored, so the store keeps accepting every class while the application believes it is restricted. With a suitable gadget chain on the classpath, this can lead to remote code execution.
Per OWASP: Data which is untrusted cannot be trusted to be well formed. Malformed data or unexpected data could be used to abuse application logic, deny service, or execute arbitrary code, when deserialized.
This issue affects multiple versions of Spring Integration.
Details
Module Info
- Product: Spring Integration
- Affected packages:
org.springframework.integration:spring-integration-mongodb - Affected versions: <=5.5.22, >=6.4.0 <=6.4.13, >=6.5.0 <=6.5.11, >=7.0.0 <=7.0.7, >=7.1.0 <=7.1.2
- GitHub repository: https://github.com/spring-projects/spring-integration
- Published packages: https://central.sonatype.com/artifact/org.springframework.integration/spring-integration-mongodb
- Package manager: Maven
- Fixed in:
- OSS Spring Integration 7.0.8, 7.1.3
- NES for Spring Integration
Vulnerability Info
This Medium-severity vulnerability is found in the spring-integration-mongodb package in multiple versions of Spring Integration. MongoDbMessageStore persists the payload of an ErrorMessage as Java-serialized bytes and restores it through an AllowListDeserializingConverter. The addAllowedPatterns() method is the API for restricting which classes that converter may deserialize, but it only stores a copy of the patterns in a field of the store:
public void addAllowedPatterns(String... patterns) {
this.allowedPatterns = patterns != null ? Arrays.copyOf(patterns, patterns.length) : null;
}
The patterns reach the deserializer only once, when the store's internal MessageReadingMongoConverter builds its converters during afterPropertiesSet(). Each DocumentToErrorMessageConverter owns its own AllowListDeserializingConverter, and the field is copied into it at that moment:
DocumentToErrorMessageConverter docToErrorMessageConverter = new DocumentToErrorMessageConverter();
if (MongoDbMessageStore.this.allowedPatterns != null) {
docToErrorMessageConverter.deserializingConverter
.addAllowedPatterns(MongoDbMessageStore.this.allowedPatterns);
}
converters.add(docToErrorMessageConverter);
Any call to addAllowedPatterns() after the store has been initialized only replaces the field and never updates the converter that is already registered. When an ErrorMessage document is read back, its payload is deserialized with that converter:
Object payload = this.deserializingConverter.convert(((Binary) source.get("payload")).getData());
AllowListDeserializingConverter treats an empty pattern set as "allow everything", so a store configured this way deserializes any class named in the stored bytes. An attacker who can write to or tamper with the MongoDB collection used by the message store can therefore store a crafted serialized object that is deserialized when the message is retrieved, which may lead to remote code execution through a gadget chain on the application's classpath. Applications that call addAllowedPatterns() before the store is initialized are not affected.
Mitigation
Only recent versions of Spring Integration receive community support. Older lines are End-of-Life and will not receive public updates to address this issue.
If an upgrade is not possible, make sure MongoDbMessageStore.addAllowedPatterns() is called during bean configuration, before afterPropertiesSet() runs, so the allow-list is applied to the internal deserializer.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a currently supported version of Spring Integration.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- Yu Bao from PayPal Cyber Security Team (finder)