Conversation
…erialization (CWE-502) Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restricting Java deserialization in ZookeeperDistributedQueue
Fixes an insecure deserialization (CWE-502) vulnerability where
ZookeeperDistributedQueue.deserialize()calledObjectInputStream.readObject()on Zookeeper-sourced bytes without any class filtering, enabling RCE via gadget chains if an attacker can write to the queue znodes.A Brief Overview
deserialize()now installs anObjectInputFilter(JDK 9+) on theObjectInputStream:The filter:
getAllowedDeserializationClasses()(String, boxed primitives, BigDecimal/BigInteger, Date, UUID, commonjava.utilcollections) or starting with a prefix ingetAllowedDeserializationPackagePrefixes()(org.broadleafcommerce.,java.util.Collections$,java.util.ImmutableCollections$)InvalidClassException, which the existing catch wraps inDistributedQueueExceptionBoth getters are
protectedso subclasses that queue other payload types can widen the allowlist. The only in-repo user (DefaultSolrIndexQueueProvider) queuesSolrUpdateCommandsubclasses, which are covered by theorg.broadleafcommerce.prefix.Added
ZookeeperDistributedQueueDeserializationTestcovering allowed round-trips (Integer, String, ArrayList, Broadleaf-package class) and rejection of a non-allowlisted class.Additional context
Labels: Security, Bug, Severity: critical. Verified with
mvn -pl core/broadleaf-framework -am test -Dtest=ZookeeperDistributedQueueDeserializationTest(2 tests pass) and module compile.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/94e302ce85d0462e89df7ed67c4281da
Open in Devin Desktop: https://app.devin.ai/desktop/session/94e302ce85d0462e89df7ed67c4281da?variant=devin
Requested by: @Colhodm