commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Naozumi Taromaru (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COLLECTIONS-580) Arbitrary remote code execution with InvokerTransformer
Date Thu, 19 Nov 2015 06:23:12 GMT

    [ https://issues.apache.org/jira/browse/COLLECTIONS-580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15012958#comment-15012958
] 

Naozumi Taromaru commented on COLLECTIONS-580:
----------------------------------------------

I used commons-collections-3.2.2.

ForClosure and WhileClosure can not deserialize.
But, ChainedTransformer can deserialize.
A DoS attack similar to an infinite loop becomes possible by the following way.

{code:java}
	HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
	for (int i = Integer.MIN_VALUE + 1; i <= Integer.MIN_VALUE + 10; i++) {
		map.put(i, i);
	}
	Transformer constantTransformer = ConstantTransformer.getInstance(map);
	Transformer stringValueTransformer = StringValueTransformer.getInstance();
	Transformer transformerChain = ChainedTransformer.getInstance(constantTransformer, stringValueTransformer);
	for (int i = 0; i < 10; i++) {
		Transformer[] transformers = new Transformer[10];
		Arrays.fill(transformers, transformerChain);
		transformerChain = ChainedTransformer.getInstance(transformers);
	}
{code}

This serialized file size is less than 2KB.
But it takes 6~7 hours for deserialize. (Core i5 CPU)

I think the similar way is also possible in ChainedClosure, AllPredicate, AnyPredicate.

When other class of org.apache.commons.collections.functors package was used,
it was possible to make OutOfMemoryError occur.

I think all classes of org.apache.commons.collections.functors package should call FunctorUtils#checkUnsafeSerialization.


> Arbitrary remote code execution with InvokerTransformer
> -------------------------------------------------------
>
>                 Key: COLLECTIONS-580
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-580
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.0, 4.0
>            Reporter: Philippe Marschall
>             Fix For: 3.2.2, 4.1
>
>         Attachments: COLLECTIONS-580.patch
>
>
> With {{InvokerTransformer}} serializable collections can be build that execute arbitrary
Java code. {{sun.reflect.annotation.AnnotationInvocationHandler#readObject}} invokes {{#entrySet}}
and {{#get}} on a deserialized collection. If you have an endpoint that accepts serialized
Java objects (JMX, RMI, remote EJB, ...) you can combine the two to create arbitrary remote
code execution vulnerability.
> I don't know of a good fix short of removing {{InvokerTransformer}} or making it not
Serializable. Both probably break existing applications.
> This is not my research, but has been discovered by other people.
> https://github.com/frohoff/ysoserial
> http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message