CVE-2026-59438: Spring Integration MongoDbMessageStore allow-list API silently loses effect after startup
MongoDbMessageStore exposes an addAllowedPatterns() API that restricts which classes may be deserialized from stored ErrorMessage payloads. Its Javadoc does not state that it must be called before the store is initialized. The allow-list is copied by value into the internal converter only once, when the store is initialized. If addAllowedPatterns() is called after initialization, the new patterns are never applied. Because an empty allow-list permits every class, the store continues to deserialize arbitrary classes while the application believes it is restricted.
An attacker who can influence the serialized bytes stored in the backing MongoDB collection can cause an arbitrary Java class to be deserialized, which may lead to remote code execution through a gadget chain. Applications that configure the allow-list before the store is initialized are not affected.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Call addAllowedPatterns() before MongoDbMessageStore is initialized so the allow-list is copied into the internal converter.
Spring Integration MongoDbMessageStore addAllowedPatterns() = before store initialization
Event History
Frequently Asked Questions
Which applications are affected by this issue?
Applications using MongoDbMessageStore are affected only if they call addAllowedPatterns() after the store has been initialized. Applications that configure the allow-list before initialization are not affected.
What access does an attacker need to exploit it?
An attacker must be able to influence serialized bytes stored in the backing MongoDB collection. Exploitation may then deserialize an arbitrary Java class and could lead to remote code execution through a gadget chain.
Why does calling addAllowedPatterns() after startup not protect the application?
The allow-list is copied into the internal converter only once during store initialization. Later additions are not applied; if the effective allow-list is empty, every class remains permitted for deserialization.
What should be checked during triage?
Verify when addAllowedPatterns() is invoked relative to MongoDbMessageStore initialization. Also determine whether untrusted parties can write or alter serialized ErrorMessage payload bytes in the MongoDB collection.