Pcornel
Security · Web Security

Insecure Deserialization

Cheat sheet · https://pcornel.dk/topic.php?topic=4760

Back to the Topic

Answer

Insecure deserialization turns untrusted serialized data back into objects in a way that lets attackers run code or change logic. Avoid native deserialization of user input; use JSON with strict schemas.

Remember

  • Insecure deserialization can lead to code execution.
  • Avoid native deserialization of untrusted input.
  • Use JSON with strict schemas.

First checks

  • Code review: pickle/ObjectInputStream/unserialize on untrusted data — unsafe deserialization
  • Use JSON with schema validation — safe formats
  • Dependency scan for gadget libraries — known issues

Verify in this order

untrusted data → safe parser/validation → objects

Where it usually breaks

First mismatch in asset/subject identity → trust/authentication → authorization/policy → enforcement/control → telemetry/detection → protected outcome/response; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4760

Confirmation

Confirm action

Continue?