Uh oh!
There was an error while loading. Please reload this page.
Fix 458 - #470
Conversation
rygel
commented
Oct 25, 2018
Hm, I need to check the failure in the tests. |
decebals
commented
Oct 25, 2018
I tried to resolve the conflict from merge with master from GitHub but I see that without success. What I don't like with this kind of solution is that we modified the core for a vulnerability that appear in a optional module (for example I don't use that module in my projects). And the modification is not trivial. For a new comer is hard to read this code and to quess why we did it. I don't understand why XStream doesn't come with a fix. |
rygel
commented
Oct 25, 2018
I had some difficulties while locally merging. About your reservations:
|
Pull Request Test Coverage Report for Build 1017
💛 - Coveralls |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
decebals
commented
Oct 25, 2018
Yes, you are right.
No, I will merge in the end. Maybe I will read more about this subject. Users using Pippo need to make sure we focus on security. |
rygel
commented
Oct 25, 2018
I have changed all your requests. |
mhagnumdw
commented
Oct 25, 2018
I'll take a look at everything that was said here... |
mhagnumdw
commented
Oct 26, 2018
The @rygel changes was made in the pippo-session module. Why did you guys say it was made in the pippo-core? I did not understand.
XStream provides means to avoid RCE, or in other words to avoid or not to serialize / deserialize certain classes. Those who use this API can choose whether or not to enable this security.
As I quoted here and I will detail it better in my post below, I believe there is a relationship with XStream. |
mhagnumdw
commented
Oct 26, 2018
I read and refreshed my memory! :) Serialization / Deserialization is very common and checking whether certain types may or may not be deserialized is very important because of security concerns. Regardless if it is from a json, xml, Java serialization etc. Recently (others not so) some frameworks that I use have implemented a restriction to allow or not to deserialize a set of classes and/or packages, eg: Richfaces 3.3.3 > 3.3.4, JBoss EAP 6.3.0 with jackson-mapper-asl 1.9.9.redhat-3 > JBoss EAP 6.4.20 with jackson-mapper-asl 1.9.9.redhat-6, XStream after version 1.4.6. So I had to define a set of my allowed packages for Serialization / Deserialization. I think somewhere in Pippo there could be the option where it would be possible to define a list of classes and/or packages that would be allowed to deserialize (whitelist). I believe somewhere in the core. Why the core? Because, as I said above, Serialization / Deserialization is something common. This whitelist would already come with some basic classes (eg ro.pippo.core.Flash, java.util.ArrayList etc), but would be extensible in some way (eg: system property, application.properties etc) so that it could be possible to add more classes and/or packages. Both the FilteringObjectInputStream class (created here in this PR) and the XstreamEngine class (see issue #454), as well as any other Pippo class that works with Serialization / Deserialization, should check the whitelist! Below are two implementations from where we can extract one or another idea (let's always keep in mind the simplicity, efficiency and code readability of Pippo!):
What do you guys think? |
decebals
commented
Oct 26, 2018
I find this interesting article that describes problem in detail. |
decebals
commented
Oct 26, 2018
I see some improvements in code. I will add new comments in a new review. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rygel
commented
Oct 26, 2018
@mhagnumdw Thank you for explaining the issue better. I understand now that both #458 and #454 are related. I am now just wondering if we fixed also the XStream issue with this PR or if there is more work needed? |
decebals
commented
Oct 27, 2018
I polished a litle bit this PR. Now, I think that we have enough flexibility. In the end, I think that |
We can improve the format of The line from above, could means add all classes from for (Stringpackage: whitePackageNames) {
if (className.startWith(package)) { // trivial implementationreturntrue;
}
}In the extreme case (last step), we can go (add support) with regex. So, the sky is the limit 😄. It's not very clear for me what about primitive classes, if we must add them by default in |
I've added the fix propsed by @idealzh