Lion Cipher Lab

Build a Java deserialization gadget chain to RCE — then shut it with an ObjectInputFilter allowlist

Why it matters

Java's built-in serialization — ObjectOutputStream to turn an object into bytes, ObjectInputStream.readObject() to turn bytes back into an object — is one of the most quietly dangerous features in enterprise software. The trap is the same one the Python pickle lab shows, but bigger: readObject() does not just copy fields, it RUNS code as it rebuilds an object graph (each class's own readObject, plus side effects in methods that get invoked during reconstruction). By itself that is harmless. The danger is a GADGET CHAIN: an attacker strings together classes that are ALREADY on the…

What you'll learn

Steps in this lab

  1. The vocabulary: serialization, readObject, and what a 'gadget chain' really is
  2. Set up a throwaway Java lab in Docker (install nothing but Docker)
  3. Build the VULNERABLE service (it deserializes untrusted bytes)
  4. Get ysoserial — the gadget-chain generator
  5. Fire the chain — prove remote code execution
  6. Why this works, and where it hides in real systems
  7. Defense 1 — an ObjectInputFilter allowlist (JEP 290), the JDK's own brake
  8. Defense 2 — the durable fix: don't deserialize untrusted native Java at all
  9. What you did — and the judgment to carry
  10. Clean up

Open the full interactive lab →