Skip to content

Lesson 6 of 11 · 6 min read

Insecure Deserialization

Deserialization turns bytes back into objects. Formats that can describe arbitrary objects, such as Python pickle, Java native serialization and unsafe YAML loaders, can be made to call functions during loading, so untrusted input becomes code execution. The fix is to never deserialize untrusted data with such formats: use data-only formats like JSON, safe loaders, schemas, and for machine learning, safetensors instead of pickle-based checkpoints. Signing proves origin, not safety.

Reviewed By the AISecurityInterviews editorial team
free sign-in, no card required

Practise it as an interviewer asks it

Related lessons