1. 8
  1.  

  2. 4

    A more practical solution than “stop using serialisation” is to use a modern serialisation system that doesn’t have access to random parts of your language internals i.e. Thrift or Protocol Buffers

    1. 3

      Or the old standby of JSON or even (ugh) XML. Actually, the only big issue here is that Java serialization will deserialize arbitrary objects—which means that every Serializable anywhere on your classpath is a potential target. If not for that, this vulnerability would not exist. And since, assuming it doesn’t own your system, the response to getting the wrong class of object from a deserializer is almost always to throw a ClassCastException or similar, it’s a pretty terrible oversight on the part of the language designers that users can’t specify what class or set of classes they expect to get out of the deserializer and not deserialize any other classes.

      1. 1

        Maybe an alternative phrasing would be “only serialize to and from the language’s primitive types and structures”

        1. 1

          Unfortunately, Java’s primitives structures are classes…