Live data from Hacker News

Oracle plans to dump risky Java serialization

infoworld.com

51–60 of 157 posts

Re: Oracle plans to dump risky Java serialization

#51

Won't this have serious implications for Spark, Hadoop, and other frameworks that distribute workloads across multiple JVM instances?

So to be clear most "code" shipping frameworks in jvm land use jar files. Big data systems are not using native serialization for either code or data.

Re: Oracle plans to dump risky Java serialization

#52
all web applications use serialization to do session replication. Now this is safe as the both stream ends are controlled by the developer, and only if they are stupid, (instead of malicious) will there problems. Still if java serialization goes away, this will be the most widespread impacting change in the java ecosphere wrt changing how serialization works.

Re: Oracle plans to dump risky Java serialization

#53
post #10

I would hate to see serialization go completely. It has its uses. Maybe Java should copy the attributes that the C# data contract serializer uses to mark the subset of classes that may appear in serialized form. It coukd be retrofitted and would be a less drastic change at the same time.

Ugh, don't remind me about the data contract serializer. Silent failure for unexpected ordering of XML elements is boneheaded default behavior.

Re: Oracle plans to dump risky Java serialization

#54
post #6

Having used java serialization a few times for POC level work, I'll be sorry to see it go. I wish they would just rename it something sufficiently ominous sounding that people wouldn't think about using it on untrusted data sources. Maybe AribitraryCodeAndDataSerialization

Yes it was a nice/quick/dirty way to persist an object graph, I bet it's been abused richly in a lot of codebases out there, it'll be curious to see how this is handled in terms of breakage i.e. the JDK that introduces this might be the Python 2/3 showdown (if that's still a thing). Be curious to do a Github wide grep for ObjectOutputStream or something similar and see what it's like in open source land.

Speaking of Python, pickle is `eval` soooo be a little careful with that one.

Re: Oracle plans to dump risky Java serialization

#55
post #39

Won't this have serious implications for Spark, Hadoop, and other frameworks that distribute workloads across multiple JVM instances?

AFAIK, Hadoop uses protocol buffers for message passing, not Java serialization.

Last time I dived into details, the communication protocol for HDFS was serialized java objects using the built in serialization mechanism.

Edit, they switched to Protocol Buffers in 0.23

https://wiki.apache.org/hadoop/HadoopRpc

Re: Oracle plans to dump risky Java serialization

#56

I was trying to understand if C# has the same issue. From what I can tell, as long as you use the default serialization, it seems to be safe. But I can't really tell. https://www.alphabot.com/security/blog/2017/net/How-to-confi...

I'm rusty on C#, but I believe the equivalent would probably be [Serializable] types being read from a Stream using a BinaryFormatter or SoapFormatter. A malicious stream could include any known types in the system marked as [Serializable], and as they are deserialized any associated static constructor/no argument constructor/property setters could be called.

In the JSON case linked, I presume there is a root type given when you are attempting to deserialize a document. However, if one of the properties of that type is ambiguous (say System.Object), and the deserialization algorithm looks for a 'type' property in the JSON with a class name to determine what is instantiated, then there can be all sorts of unintentional types that might be built by the processing of that malicious JSON.

Re: Oracle plans to dump risky Java serialization

#57

I was trying to understand if C# has the same issue. From what I can tell, as long as you use the default serialization, it seems to be safe. But I can't really tell. https://www.alphabot.com/security/blog/2017/net/How-to-confi...

The biggest cause of vulnerabilities in Java serialization is that the class is part of the serialization format, so an attacker can cause the serialization to produce classes that you aren't expecting.

Json.NET seems to allow the same behavior, but has it disabled by default.

> In fact the only kind that is not vulnerable is the default: TypeNameHandling.None

Re: Oracle plans to dump risky Java serialization

#58
post #16
post #4

Earlier quoted context omitted.

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?

Why the heck are those classes marked as `implements Serializable`?...

It is a marker interface. You are supposed to consciously opt-in.

Re: Oracle plans to dump risky Java serialization

#59
There are so many great alternatives available. It's a no-brainer. I applaud.

[edit] so why the downvote? We have YAML, JSON, protobuf, Thrift, Avro. Yup, these serialize "contents" rather than "structure + contents" but one gets interop with other technologies for free. Every tech mentioned above is so simple to use that removing Java serialization is a no-brainer.

Re: Oracle plans to dump risky Java serialization

#60

Can someone briefly explain the problems and how general they are to other serialization interfaces?

> and how general they are to other serialization interfaces?

This class of problems was very common when that serialization appeared in Java. It was possible to inject code into pretty much anything, e-mails (1), office documents (2), web pages. Since that time, most developers / managers have learned their lesson and started to pay attention / allocate resources so modern software/protocols/formats tend to be more secure, at least on average.

(1) https://en.wikipedia.org/wiki/ILOVEYOU

(2) https://en.wikipedia.org/wiki/Melissa_(computer_virus)

Post reply on HN