Ochrona Security

The latest in python news, security, and tutorials

Member-only story

Python Pickle is Notoriously Insecure

Andrew Scott
Ochrona Security
Published in
3 min readJan 4, 2021

--

If you’re a heavy python user you’ve probably come across the pickle module from the standard library at some point. You may have even heard that this library is dangerous. This post will take a look at how pickle works (at a high level), what the risks are, and risk prevention strategies.

What is Pickle?

Pickle is a serialization and deserialization library for Python that “pickles” (ie. serializes) and “unpickles” (ie. deserializes) Python objects. If you’re not familiar, serialization is the process of transforming a data structure or class into a portable format that can be stored or transmitted, as well as ingesting this data back into a program and generating an object that is semantically identical to the original object.

Pickle and Cpickle (a C implementation of pickle that is more performant) have been mainstays in many python programs for years. However, because of the privileges and dynamic way that pickle operates, it can be very dangerous if used in a risky way.

How Does Pickle Works?

--

--

Ochrona Security
Ochrona Security

Published in Ochrona Security

The latest in python news, security, and tutorials

Andrew Scott
Andrew Scott

Written by Andrew Scott

Maintainer @OchronaSec | PANW, ex Expanse, ex Tenable | Security & Automation | All views are my own... and awesome

Responses (1)