Fixed: Prevent deserialization of untrusted data in JMS listener#1078
Fixed: Prevent deserialization of untrusted data in JMS listener#1078jacopoc wants to merge 2 commits intoapache:trunkfrom
Conversation
jacopoc
commented
Apr 8, 2026
- Restrict XStream allowlist in UtilXml to the exact types handled by XmlSerializer.serializeSingle
- Replace the broad java..* and org.apache.ofbiz..* wildcards in SafeObjectInputStream with an explicit minimal allowlist of the same safe types
- Remove cus-obj custom Java deserialization support from XmlSerializer (both serialize and deserialize paths) as it allowed arbitrary Serializable objects over JMS
- Move the isExport() authorization check before XmlSerializer.deserialize in AbstractJmsListener.runService so gadget chains cannot fire for non-exported or unknown services
… Java objects in XmlSerializer for security reasons
- Restrict XStream allowlist in UtilXml to the exact types handled by XmlSerializer.serializeSingle - Replace the broad java..* and org.apache.ofbiz..* wildcards in SafeObjectInputStream with an explicit minimal allowlist of the same safe types - Move the isExport() authorization check before XmlSerializer.deserialize in AbstractJmsListener.runService so gadget chains cannot fire for non-exported or unknown services
f3cf6a1 to
25e449d
Compare
|
Hi Jacopo, I'm not sure why you removed still being in CatalogServices.groovy::createMissingCategoryAndProductAltUrls Could it be related with now using Groovy 5.0.0-alpha-11, or another specific change? |
|
@JacquesLeRoux This is just an experiment and work in progress. |
|
OK thanks, please let me know when I should review :) |
|
@JacquesLeRoux this PR is ready for review. I’d appreciate it if you could check whether all the previously reported issues (e.g., in ticket OFBIZ-10837 ) that were fixed at the time are still properly addressed. |
|
Hi Jacopo, I tested the issues from the 2 1st related Jiras and reviewed the last related Jira, it's OK with me. As I explained above you need to put back "org.codehaus.groovy.runtime.GStringImpl", "groovy.lang.GString" in SafeObjectInputStream::DEFAULT_ALLOWLIST_PATTERN. On the other hand, "sun.util.calendar." can be removed from both SafeObjectInputStream::DEFAULT_ALLOWLIST_PATTERN. and SafeObjectInputStream.properties since it's no longer used in OFBiz current supported branches after https://issues.apache.org/jira/browse/OFBIZ-12721 For "Serialization of custom Java objects (cus-obj) is no longer supported. " I guess you decided that because none custom Java objects are serialised OOTB, or is there another reason? I must say I did not completely check the change in createXStream::createXStream. At 1st glance it's OK. The rest is OK with me. |
|
@JacquesLeRoux, thank you. I introduced these changes because I am working to fix this: I'd like to keep DEFAULT_ALLOWLIST_PATTERN as minimal as possible in order to easily allow framework setups that do not require to deserialize special objects, such as GString, that may open some security related concerns. This is the primary reason to remove the ability to deserialize custom object (cus-obj) as they are difficult/impossible to check for safety. Thanks for your note on removing "sun.util.calendar": I will have a look at it. |
|
I understand for custom object. Then another way must be found for OFBIZ-11398, even if It's a weak probability. |
|
I think it is fine, assuming that the feature mentioned in OFBIZ-11398 requires the current configuration in SafeObjectInputStream.properties. There are many other features in OFBiz that work only with specific configurations. |