Java Serialization Hardening

Java built-in serialization as an attack surface and a permanent API commitment: why readObject is an extra constructor that accepts arbitrary bytes, gadget chains and what deserialization filters (JEP 290/415) can and cannot do, the cost of implementing Serializable, serialVersionUID and the custom serialized form, validating and defensively copying in readObject, the serialization proxy pattern, why records are different, and the same risk in JSON polymorphic typing. Use when Serializable, readObject, readResolve or Externalizable appears, when ObjectInputStream reads bytes from a cache, queue, session store, RMI or JMX, when Jackson default typing is enabled, or when a mixed-version deploy breaks a serialized cache. Format cost is serialization-performance, contract evolution is rpc-and-api-contracts, and the reflective access underneath is java-reflection-and-method-handles.

robsonkades e96c5e6 4 files · 35.4 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/java-serialization-hardening commit e96c5e67ae

Frequently asked questions

npx skillmds@latest add robsonkades/java-serialization-hardening