Java serialization filters need an allowlist first-run process
Java deserialization remains dangerous because the input controls object construction and can reach gadget chains in libraries the application did not intend to expose. The platform's serialization filter mechanism provides a useful constraint. It is not a switch that makes every ObjectInputStream safe, and a copied reject list can create more trouble than it prevents.
What the JVM can filter
The Java serialization filter mechanism screens incoming streams of serialized objects. A process-wide filter can be configured with the jdk.serialFilter system property or the corresponding security property. The pattern language can accept or reject class names, packages, and modules, while also limiting array size, graph depth, and references.
The filter is applied when the JVM's serialization machinery processes an object stream. Individual applications can also set an ObjectInputFilter on a stream or use a filter factory.…