Reputation: 10151
I have an application that exposes an endpoint using HttpInvokerServiceExporter
from Spring. I have been trying to investigate whether or not this is at risk from the Java (Apache commons-collections) serialisation exploit (as detailed here).
I have been trying to generate payloads that can be sent to the endpoint for testing, but I haven't managed to get a definitive answer so far. I have checked out the ysoserial project for generating payloads but I believe the problem with this is that the HttpInvoker expects the serialised Object to be of type RemoteInvocation
, which is not what ysoserial
generates.
So my questions are:
Upvotes: 1
Views: 278
Reputation: 10151
I have found the answer to my own questions:
Spring Http Invoker expects the object it receives to be a RemoteInvocation
instance, which contains a method to be executed on the server side (i.e. a method that you are exposing on some interface). It has the following constructor:
public RemoteInvocation(String methodName, Class[] parameterTypes, Object[] arguments)
so to use the exploit you just have to put the object that ysoserial generates into the Object[]
arguments. This will result in it being unserialised before attempting and failing to execute the method on the exposed interface and therefore it will execute the command you specified.
Upvotes: 1