...
Even when hostile code does not have access to the serializable class's members, serialization may fail to work as expected. The ObjectInputStream.readObject()
and ObjectOutputStream.writeObject()
methods are declared final
and cannot be overridden. The custom form of serialization involves a method mechanism that allows the JVM to detect and use private
implementations of the two methods in the serializable class. If the accessibility of the two methods is not private
, the default serialization form takes effect. This can be insecure from many standpoints, for instance, input validation checks installed in the custom serialized form may be bypassed.
...