VYPR
High severity7.5NVD Advisory· Published Apr 22, 2026· Updated Apr 22, 2026

CVE-2026-6857

CVE-2026-6857

Description

A flaw was found in camel-infinispan. This vulnerability involves unsafe deserialization in the ProtoStream remote aggregation repository. A remote attacker with low privileges could exploit this by sending specially crafted data, leading to arbitrary code execution. This allows the attacker to gain full control over the affected system, impacting its confidentiality, integrity, and availability.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.apache.camel:camel-infinispanMaven
< 4.20.04.20.0

Affected products

1

Patches

1
ec297f89065b

CAMEL-23322: Add deserialization filtering to camel-infinispan remote aggregation repository (#22599)

https://github.com/apache/camelAndrea CosentinoApr 14, 2026via ghsa
3 files changed · +119 0
  • components/camel-infinispan/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/remote/protostream/DefaultExchangeHolderUtils.java+19 0 modified
    @@ -19,17 +19,28 @@
     import java.io.ByteArrayInputStream;
     import java.io.ByteArrayOutputStream;
     import java.io.IOException;
    +import java.io.ObjectInputFilter;
     import java.io.ObjectInputStream;
     import java.io.ObjectOutputStream;
     
     import org.apache.camel.support.DefaultExchangeHolder;
     import org.apache.camel.util.ClassLoadingAwareObjectInputStream;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
     
     /**
      * Utilities for {@link DefaultExchangeHolder} and the Infinispan Protostream marshaller.
      */
     final class DefaultExchangeHolderUtils {
     
    +    /**
    +     * Default deserialization filter that restricts which classes can be deserialized. Allows standard Java types and
    +     * Apache Camel types. Can be overridden via the JVM system property {@code jdk.serialFilter}.
    +     */
    +    static final String DEFAULT_DESERIALIZATION_FILTER = "java.**;javax.**;org.apache.camel.**;!*";
    +
    +    private static final Logger LOG = LoggerFactory.getLogger(DefaultExchangeHolderUtils.class);
    +
         private DefaultExchangeHolderUtils() {
             // Utility class
         }
    @@ -46,6 +57,14 @@ static byte[] serialize(DefaultExchangeHolder holder) {
         static DefaultExchangeHolder deserialize(byte[] bytes) {
             try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                  ObjectInputStream ois = new ClassLoadingAwareObjectInputStream(bais)) {
    +            ObjectInputFilter jvmFilter = ObjectInputFilter.Config.getSerialFilter();
    +            if (jvmFilter != null) {
    +                ois.setObjectInputFilter(jvmFilter);
    +            } else {
    +                LOG.debug("No JVM-wide deserialization filter set, applying default Camel filter: {}",
    +                        DEFAULT_DESERIALIZATION_FILTER);
    +                ois.setObjectInputFilter(ObjectInputFilter.Config.createFilter(DEFAULT_DESERIALIZATION_FILTER));
    +            }
                 return (DefaultExchangeHolder) ois.readObject();
             } catch (IOException | ClassNotFoundException e) {
                 throw new RuntimeException(e);
    
  • components/camel-infinispan/camel-infinispan/src/test/java/com/example/external/NotAllowedSerializable.java+37 0 added
    @@ -0,0 +1,37 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package com.example.external;
    +
    +import java.io.Serializable;
    +
    +/**
    + * Serializable type living outside the {@code java.**}, {@code javax.**} and {@code org.apache.camel.**} packages, used
    + * to verify that the default deserialization allowlist rejects unknown classes.
    + */
    +public final class NotAllowedSerializable implements Serializable {
    +    private static final long serialVersionUID = 1L;
    +
    +    private final String value;
    +
    +    public NotAllowedSerializable(String value) {
    +        this.value = value;
    +    }
    +
    +    public String getValue() {
    +        return value;
    +    }
    +}
    
  • components/camel-infinispan/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/remote/protostream/DefaultExchangeHolderUtilsTest.java+63 0 added
    @@ -0,0 +1,63 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.camel.component.infinispan.remote.protostream;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.io.ObjectOutputStream;
    +
    +import com.example.external.NotAllowedSerializable;
    +import org.apache.camel.impl.DefaultCamelContext;
    +import org.apache.camel.support.DefaultExchange;
    +import org.apache.camel.support.DefaultExchangeHolder;
    +import org.junit.jupiter.api.Test;
    +
    +import static org.junit.jupiter.api.Assertions.assertEquals;
    +import static org.junit.jupiter.api.Assertions.assertNotNull;
    +import static org.junit.jupiter.api.Assertions.assertThrows;
    +
    +public class DefaultExchangeHolderUtilsTest {
    +
    +    @Test
    +    public void testDeserializeAcceptsDefaultExchangeHolder() {
    +        DefaultCamelContext context = new DefaultCamelContext();
    +        DefaultExchange exchange = new DefaultExchange(context);
    +        exchange.getIn().setBody("hello");
    +
    +        DefaultExchangeHolder holder = DefaultExchangeHolder.marshal(exchange, true);
    +        byte[] bytes = DefaultExchangeHolderUtils.serialize(holder);
    +
    +        DefaultExchangeHolder roundTripped = DefaultExchangeHolderUtils.deserialize(bytes);
    +        assertNotNull(roundTripped);
    +
    +        DefaultExchange restored = new DefaultExchange(context);
    +        DefaultExchangeHolder.unmarshal(restored, roundTripped);
    +        assertEquals("hello", restored.getIn().getBody());
    +    }
    +
    +    @Test
    +    public void testDeserializeRejectsUnlistedType() throws Exception {
    +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    +        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
    +            oos.writeObject(new NotAllowedSerializable("blocked"));
    +        }
    +
    +        RuntimeException thrown = assertThrows(RuntimeException.class,
    +                () -> DefaultExchangeHolderUtils.deserialize(baos.toByteArray()));
    +        Throwable cause = thrown.getCause();
    +        assertNotNull(cause);
    +    }
    +}
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.