Fix insecure deserialization in ZookeeperDistributedQueue (CWE-502)#21
Open
devin-ai-integration[bot] wants to merge 2 commits intodevelop-7.0.xfrom
Open
Fix insecure deserialization in ZookeeperDistributedQueue (CWE-502)#21devin-ai-integration[bot] wants to merge 2 commits intodevelop-7.0.xfrom
devin-ai-integration[bot] wants to merge 2 commits intodevelop-7.0.xfrom
Conversation
Add ObjectInputFilter to restrict deserialization to known safe classes, preventing potential Remote Code Execution via untrusted data from Zookeeper. Only org.broadleafcommerce.**, java.lang.*, java.util.*, java.io.Serializable, java.math.*, and java.time.* classes are now permitted during deserialization. Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
Author
🤖 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:
|
IncrementalUpdateCommand contains SolrInputDocument (org.apache.solr.common) which must be permitted during deserialization for distributed Solr index updates to function correctly. Co-Authored-By: Arjun Mishra <arjunsaxmishra@gmail.com>
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.
Fix insecure deserialization in ZookeeperDistributedQueue (CWE-502)
A Brief Overview
ZookeeperDistributedQueue.deserialize()usesObjectInputStream.readObject()on data from Zookeeper without any class filtering or validation. This is a well-known insecure deserialization vulnerability (CWE-502) that can lead to Remote Code Execution (RCE) if an attacker can influence the data stored in Zookeeper.This PR adds an
ObjectInputFilter(Java 9+ API) to thedeserialize()method that restricts deserialization to an allowlist of known safe classes:org.broadleafcommerce.**— all Broadleaf Commerce domain types (includingSolrUpdateCommandand subclasses)org.apache.solr.**— Solr types required byIncrementalUpdateCommand(SolrInputDocument,SolrInputField, etc.)java.lang.*— standard Java types (Integer, String, etc.)java.util.*— standard collectionsjava.io.Serializable— the serialization marker interfacejava.math.*— BigDecimal, BigIntegerjava.time.*— temporal typesAll other classes are rejected (
!*), preventing gadget-chain attacks via malicious serialized payloads.Labels: Security, critical, ready-for-code-review
Additional context
ObjectInputFilter.Config.createFilter()which is a stable API since Java 9 and well-suited for the project's Java 17 target.deserialize()method is called in two places: once for queue element data (line 652, typed asT extends Serializable) and once for config data (line 794, cast toInteger). Both are covered by the allowlist.org.apache.solr.**is required becauseIncrementalUpdateCommandcontainsList<SolrInputDocument>fields that must be permitted during deserialization.Link to Devin session: https://app.devin.ai/sessions/8ebbbcec22c7462b80e77373ea7926a8
Requested by: @Colhodm
Devin Review