CVE-2026-40858 Overview
CVE-2026-40858 is an insecure deserialization vulnerability in the Apache Camel camel-infinispan component. The ProtoStream-based remote aggregation repository deserializes data read from a remote Infinispan cache using java.io.ObjectInputStream without applying any ObjectInputFilter. An attacker who can write to the Infinispan cache used by a Camel application can inject a crafted serialized Java object that, when read during normal aggregation repository operations such as get or recover, results in arbitrary code execution in the context of the application.
This vulnerability follows the same class of insecure deserialization issues previously addressed in CVE-2024-22369, CVE-2024-23114, and CVE-2026-25747.
Critical Impact
Attackers with write access to an Infinispan cache can achieve remote code execution by injecting malicious serialized Java objects, potentially leading to full system compromise.
Affected Products
- Apache Camel versions 4.0.0 through 4.14.6
- Apache Camel versions 4.15.0 through 4.18.1
- Apache Camel version 4.19.0
Discovery Timeline
- 2026-04-27 - CVE CVE-2026-40858 published to NVD
- 2026-04-28 - Last updated in NVD database
Technical Details for CVE-2026-40858
Vulnerability Analysis
This vulnerability (CWE-502: Deserialization of Untrusted Data) exists in the camel-infinispan component's handling of remote aggregation repository data. The core issue stems from the use of Java's native ObjectInputStream class to deserialize data retrieved from a remote Infinispan cache without implementing any filtering mechanism.
When a Camel application uses the ProtoStream-based remote aggregation repository, it reads serialized objects from the Infinispan cache during standard operations like get() and recover(). Because no ObjectInputFilter is applied, any serialized Java object—including malicious gadget chains—will be deserialized and instantiated by the application.
An attacker who has obtained write access to the target Infinispan cache can exploit this by inserting a specially crafted serialized payload containing a gadget chain. When the Camel application subsequently reads this data during normal aggregation operations, the malicious object is deserialized, triggering arbitrary code execution with the privileges of the application.
Root Cause
The root cause is the absence of input validation during the deserialization process. The camel-infinispan component directly uses java.io.ObjectInputStream.readObject() to deserialize data from the remote Infinispan cache without implementing an ObjectInputFilter to restrict which classes can be deserialized. This allows any serializable class available on the application's classpath to be instantiated, enabling exploitation through known deserialization gadget chains.
Attack Vector
The attack requires network access and the ability to write to the Infinispan cache that the target Camel application uses for its aggregation repository. The attack flow consists of:
Cache Access: The attacker must first gain write access to the remote Infinispan cache. This could be achieved through compromised credentials, misconfigured cache permissions, or exploitation of another vulnerability in the Infinispan infrastructure.
Payload Injection: The attacker crafts a malicious serialized Java object using known deserialization gadget chains (such as those from ysoserial) and writes it to the cache with a key that will be read by the Camel application.
Triggering Deserialization: When the Camel application performs a normal aggregation repository operation that reads the attacker-controlled entry, the malicious object is deserialized, executing arbitrary code in the application context.
The vulnerability requires low privileges (cache write access) and no user interaction to exploit. Once triggered, the attacker gains code execution with full access to the application's data and resources.
Detection Methods for CVE-2026-40858
Indicators of Compromise
- Unexpected or anomalous entries in Infinispan cache logs indicating writes from unknown sources
- Unusual process spawning or network connections originating from Camel application processes
- Presence of known deserialization gadget chain classes in memory or application logs
- Abnormal CPU or memory usage during aggregation repository operations
- Error logs showing ClassNotFoundException or InvalidClassException for unexpected classes during deserialization
Detection Strategies
- Implement application-level logging for all aggregation repository read operations to capture the classes being deserialized
- Deploy runtime application self-protection (RASP) solutions capable of detecting deserialization attacks
- Monitor Infinispan cache access patterns and alert on writes from unauthorized or unexpected sources
- Use SentinelOne's behavioral AI to detect post-exploitation activities such as command execution or lateral movement
Monitoring Recommendations
- Enable detailed audit logging on Infinispan cache servers to track all read and write operations
- Implement network segmentation and monitor traffic between Camel applications and Infinispan caches
- Configure alerts for any Java deserialization exceptions that may indicate blocked exploitation attempts
- Deploy endpoint detection and response (EDR) solutions to monitor for suspicious process behavior on systems running affected Camel applications
How to Mitigate CVE-2026-40858
Immediate Actions Required
- Upgrade Apache Camel to version 4.20.0, 4.18.2, or 4.14.7 depending on your release stream
- Audit Infinispan cache access controls to ensure only authorized applications can write to caches used by Camel
- Review network segmentation to restrict access to Infinispan infrastructure
- Implement monitoring for suspicious cache operations and application behavior
- Consider temporarily disabling the remote aggregation repository functionality if upgrade is not immediately possible
Patch Information
Apache has released patched versions that address this vulnerability by implementing proper ObjectInputFilter restrictions on deserialized data. Users should upgrade to the following versions based on their current release stream:
- Version 4.20.0: Recommended for users on the latest release stream
- Version 4.18.2: For users on the 4.18.x release stream
- Version 4.14.7: For users on the 4.14.x LTS release stream
For detailed information on the commits that resolved this issue, refer to the Apache Camel CVE-2026-40858 Advisory and the associated JIRA ticket CAMEL-23322.
Workarounds
- Restrict write access to Infinispan caches to only trusted, authenticated services until patching is possible
- Implement network-level access controls to limit which systems can communicate with Infinispan servers
- Consider switching to local aggregation repositories if remote caching is not strictly required
- Apply Java security manager policies or use a JEP 290-compatible ObjectInputFilter at the JVM level to restrict deserialization
# Example: Restrict JVM-wide deserialization using JEP 290 filter
# Add to JVM startup arguments
java -Djdk.serialFilter="!*" -jar your-camel-application.jar
# More permissive filter allowing specific packages
java -Djdk.serialFilter="org.apache.camel.**;java.lang.*;java.util.*;!*" -jar your-camel-application.jar
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


