The vulnerability exists in the camel-consul component of Apache Camel and is due to the insecure deserialization of data retrieved from a Consul Key-Value store. The root cause is in the org.apache.camel.component.consul.ConsulRegistry.ConsulRegistryUtils.deserialize method, which uses ObjectInputStream.readObject() without any filtering mechanism to prevent the deserialization of malicious objects.
The primary attack vector involves an attacker with write access to the Consul KV store used by a Camel application. The attacker can store a specially crafted serialized Java object (a gadget chain) in the KV store. When the Camel application performs a lookup for this key using the org.apache.camel.component.consul.ConsulRegistry.lookupByName method, the stored value is fetched and passed to the vulnerable deserialize method. This triggers the deserialization of the malicious object, leading to arbitrary code execution on the server running the Camel application.
The patch mitigates this vulnerability by introducing an ObjectInputFilter. The deserialize method is updated to accept a filter string, which is then used to configure the ObjectInputStream. This filter restricts which classes are allowed to be deserialized, preventing the execution of malicious gadget chains. By default, the filter allows classes from the java.** and org.apache.camel.** packages, while blocking all others.