5 ms·
One of the attack vector in Java was classes storing native pointers as integer fields calling free on the above pointers in the finalizer. So the moment one ca
by fpoling 8y ago
One of the attack vector in Java was classes storing native pointers as integer fields calling free on the above pointers in the finalizer. So the moment one can force deserialiazation of such classes one ends up with corrupted heap and trivially weponized exploits. Does pickle in Python suffer from the same problem?
- rjzzleep 8y agowell theres this comment in the docs: > Warning > The pickle module is not secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source.
- icebraining 8y agoArbitrary code execution: https://www2.cs.uic.edu/~s/musings/pickle/ https://www2.cs.uic.edu/~s/musings/pickle/
- bitL 8y agoThat only works because Python is an interpreter. Won't cause a thing on Java.
- joshuamorton 8y agoDeserialization in Java requires reflection, which puts you firmly in the land of "I'm basically interpreted now". Javas serialization has basically the same set of vulnerability.
- dwaite 8y agoThe JRE has had arbitrary code execution attacks on serialization. The leaked classes eventually invoke a class loader and instantiate your binary code as a new java class.
- bitL 8y agoDoes the serialization work with bytecode though? Doesn't it stream just data members, not method implementations?
- icebraining 8y agoThe JVM is a Java Bytecode interpreter; don't be so sure you can't make it run things.
- the_new_guy_29 8y agoThx fpr the good read
- jerf 8y agoThe primary difference between pickle and all the other problematic serialization mechanisms that have been causing security issues is that pickle has been labeled for decades now as being unsuitable for any use with public data. No sarcasm, I'm quite serious. It hasn't been 100% successful at preventing issues, there have been a couple, but it does seem to have been enough to keep it from being the star of it's own massive disaster, even though the potential is theoretically there. As with many of the dynamic language deserializers, such as the Ruby YAML one, for pickle it's not even an exploit or something... it's a feature of the code that it can call methods, and getting to arbitrary methods isn't that hard.
- bonzini 8y agoWhy the heck are those classes marked as `implements Serializable`?...
- dwaite 8y agoPossibly because a superclass or interface are marked, and it is inherited? The problem is that (excluding the new filtering mechanism) deserialization is unscoped - any class in your code, a third party library, or the core VM is fair game in an attack.
- dionian 8y agoIt is a marker interface. You are supposed to consciously opt-in.
- bonzini 8y agoExactly, so I am not sure why wrappers to native pointers are Serializable.