To get a SessionData object from cookie,pippo base64 decode the PIPPO_SESSION,and then deserialize the decoded data(the decoded data is a serialized SessionData object);
However,ObjectInputStream.readObject() leads to a Java deserialization vulnerability.
The Apache Shiro framework used to have a similar issue(https://issues.apache.org/jira/browse/SHIRO-550).
There exists a gadget chain in jre8u20,we can generate the attack payload based on it;Here is a blog(https://www.anquanke.com/post/id/87270) about the generating procedure,I am sorry it's writed in Chinese,or get the payload by tool(https://github.com/360-A-Team/SerialWriter) ;So,if the version lowwer than jre8u20,it may leads to a remote code execution;
For details,please refer to the picture below:

The payload I used is as follows:
jre8u20payload_base64.txt
And some third party modules also have a gadget chain;
To fix the issue,we can implement a class FilteringObjectInputStream,and replace ObjectInputStream with it,The implementation of FilterObjectInputStream is as follows:
publicclassFilteringObjectInputStreamextendsObjectInputStream {
publicFilteringObjectInputStream(InputStreamin) throwsIOException {
super(in);
}
protectedClass<?> resolveClass(java.io.ObjectStreamClassdescriptor) throwsClassNotFoundException, IOException {
StringclassName = descriptor.getName();
ClassFilterclassFilter=newClassFilter();
if(className != null && className.length() > 0 && !classFilter.isWhiteListed(className)) {
thrownewInvalidClassException("Unauthorized deserialization attempt", descriptor.getName());
} else {
returnsuper.resolveClass(descriptor);
}
}
}
publicclassClassFilter {
privateArrayList<String> WhiteList= null; publicClassFilter() {
WhiteList=newArrayList<String>();
WhiteList.add("ro.pippo.session.SessionData");
WhiteList.add("java.util.HashMap");
WhiteList.add("ro.pippo.core.Flash");
WhiteList.add("java.util.ArrayList");
}
publicbooleanisWhiteListed(StringclassName) {
if(className==null) returnfalse;
for(Stringname:WhiteList) {
if(name.equals(className)) returntrue;
}
returnfalse;
}
}It's just a demo.
To get a SessionData object from cookie,pippo base64 decode the PIPPO_SESSION,and then deserialize the decoded data(the decoded data is a serialized SessionData object);

However,ObjectInputStream.readObject() leads to a Java deserialization vulnerability.
The Apache Shiro framework used to have a similar issue(https://issues.apache.org/jira/browse/SHIRO-550).
There exists a gadget chain in jre8u20,we can generate the attack payload based on it;Here is a blog(https://www.anquanke.com/post/id/87270) about the generating procedure,I am sorry it's writed in Chinese,or get the payload by tool(https://github.com/360-A-Team/SerialWriter) ;So,if the version lowwer than jre8u20,it may leads to a remote code execution;
For details,please refer to the picture below:
The payload I used is as follows:
jre8u20payload_base64.txt
And some third party modules also have a gadget chain;
To fix the issue,we can implement a class FilteringObjectInputStream,and replace ObjectInputStream with it,The implementation of FilterObjectInputStream is as follows:
It's just a demo.